Find maximum of the output from reduce
Let the large result of Reduce
be rs
. Then the maximum of each quantity is determined by
Max@Cases[rs, Equal[Subscript[n, 1], z_] -> z, Infinity]
(* 94 *)
Max@Cases[rs, Equal[Subscript[n, 2], z_] -> z, Infinity]
(* 94 *)
not 91
as speculated in the question. The corresponding terms in rs
can be obtained by
Position[rs, 94, Infinity]
(* {{94, 2, 2}, {4559, 1, 2}} *)
rs[[94]]
(* Subscript[n, 1] == 0 && Subscript[n, 2] == 94 *)
rs[[4559]]
(* Subscript[n, 1] == 94 && Subscript[n, 2] == 0 *)
An alternative is to use Solve
after Rationalize
ing input expressions:
driftParamSet = Rationalize[1.9 - 0.2 n2 +
n1 (-0.2 + (2.91434*10^-16 n1)/(1. n1 + 1.5 n2)), 10^-16]
driftγ = 17;
solutions = Solve[driftParamSet > -driftγ && n1 >= 0 && n2 >= 0, {n1, n2}, Integers];
Max /@ Transpose[{n1, n2} /. solutions]
{94, 94}
Yet another approach is using ArgMax
:
Extract[ArgMax[{#, driftParamSet > -driftγ && n1 >= 0 && n2 >= 0}, {n1, n2}, Integers]& /@
{n1, n2}, {{1, 1}, {-1, -1}}]
{94, 94}