I'm working with a system of n-equations and Nsolve takes too long to get the results. I'm trying to speed things up by adding a restriction to the solutions, but I'm not sure how to set the restriction to all the variables in the list.
EQ = {eq1, eq2, ..., eqN}
X = {var1, var2, ..., varN}
NSolve[EQ, X]
How can I add that:
var1,`va2, ..., varN ∈ Interval[{0,a}]
without going 1 by 1 since the size n may change?
Edit
So here is the actual code for n=4:
EQ =
{5. (1/4 (Subsuperscript[respr, 1, 2]/2 - Subscript[respr, 1] + 1/2) +
1/4 (Subsuperscript[respr, 2, 2]/2 - Subscript[respr, 2] + 1/2) +
1/4 (Subsuperscript[respr, 3, 2]/2 - Subscript[respr, 3] + 1/2) +
1/4 (Subsuperscript[respr, 4, 2]/2 - Subscript[respr, 4] +
1/2)) -
Subscript[respr, 1] + (1 - Subscript[respr, 1])
((1 - Subscript[respr, 1])/
(4 (1/4 (1 - Subscript[respr, 2]) +
1/4 (1 - Subscript[respr, 3]) +
1/4 (1 - Subscript[respr, 4])) + 0.8) + 1) + 0.5,
5. (1/4 (Subsuperscript[respr, 1, 2]/2 - Subscript[respr, 1] + 1/2) +
1/4 (Subsuperscript[respr, 2, 2]/2 - Subscript[respr, 2] + 1/2) +
1/4 (Subsuperscript[respr, 3, 2]/2 - Subscript[respr, 3] + 1/2) +
1/4 (Subsuperscript[respr, 4, 2]/2 - Subscript[respr, 4] +
1/2)) -
Subscript[respr, 2] + (1 - Subscript[respr, 2])
((1 - Subscript[respr, 2])/
(4 (1/4 (1 - Subscript[respr, 1]) +
1/4 (1 - Subscript[respr, 3]) +
1/4 (1 - Subscript[respr, 4])) + 0.8) + 1) + 0.5,
5. (1/4 (Subsuperscript[respr, 1, 2]/2 - Subscript[respr, 1] +
1/2) + \1/4 (Subsuperscript[respr, 2, 2]/2 -
Subscript[respr, 2] + 1/2) +
1/4 (Subsuperscript[respr, 3, 2]/2 - Subscript[respr, 3] + 1/2) +
1/4 (Subsuperscript[respr, 4, 2]/2 - Subscript[respr, 4] +
1/2)) -
Subscript[respr, 3] + (1 - Subscript[respr, 3])
((1 - Subscript[respr, 3])/
(4 (1/4 (1 - Subscript[respr, 1]) +
1/4 (1 - Subscript[respr, 2]) +
1/4 (1 - Subscript[respr, 4])) + 0.8) + 1) + 0.5,
5. (1/4 (Subsuperscript[respr, 1, 2]/2 - Subscript[respr, 1] + 1/2) +
1/4 (Subsuperscript[respr, 2, 2]/2 - Subscript[respr, 2] + 1/2) +
1/4 (Subsuperscript[respr, 3, 2]/2 - Subscript[respr, 3] + 1/2) +
1/4 (Subsuperscript[respr, 4, 2]/2 - Subscript[respr, 4] +
1/2)) +
((1 - Subscript[respr, 4])/
(4 (1/4 (1 - Subscript[respr, 1]) +
1/4 (1 - Subscript[respr, 2]) +
1/4 (1 - Subscript[respr, 3])) + 0.8) + 1)
(1 - Subscript[respr, 4]) - Subscript[respr, 4] + 0.5}
X =
{Subscript[respr, 1], Subscript[respr, 2],
Subscript[respr, 3], Subscript[respr, 4]}
Im solving this by:
NSolve[EQ, X]
I would like to set a restriction to all the variables Subscript[respr,1]. However I cannot use && Subscript[respr,1] \[Element] Interval[{0,1}], 1 by 1 since n may be 10 or 100 in each run.
FindRoot– Alexei Boulbitch Jun 26 '18 at 20:44Nsolve; there isNSolve, though. – corey979 Jun 26 '18 at 20:48Subsuperscript[respr, 1, 2]has no relation to the variableSubscript[respr, 1]. I suppose you meant to square the variableSubscript[respr, 1]? That's done with ``Subscript[respr, 1]^2(orPower[]). [The standard advice is to avoidSubscript`, except for output formatting -- see https://mathematica.stackexchange.com/a/18395/4999.] – Michael E2 Jun 26 '18 at 22:10