1
$\begingroup$

I'm trying to solve the following system for different values of the parameter b

system={y1 - (-1 + x) (1 + E^(-((1 - x + y2)/(5 z2)))/(20 z2)) + (
   E^(-((1 - x + y2)/(5 z2))) y2)/(20 z2) == 
  0, -100 (y1 - b/(
     1 + (y1 - y2)/(-1 + E^(1/4 x (y1 - y2))))) == 
  0, -100 (y2 - b/(
     1 + (y1 - y2)/(1 - E^(-(1/4) x (y1 - y2))))) == 0, 
 5 (1 - z1) - E^((-1 + x - y1)/(5 z1)) z1 == 0, 
 5 (1 - z2) - E^((-1 + x - y2)/(5 z2)) z2 == 0}
vars = {x,y1,y2,z1,z2}

Overall I will need about ~100 sets of solutions for this system (i.e, different values of b).

So far I'm trying to use NSolve[system,vars] but mathematica is stuck running, and looking for advise on a handling procedure of such equations so that an accurate solution could be obtained quickly

$\endgroup$

1 Answer 1

4
$\begingroup$

Try NMinimize :

sol[b_?NumericQ] := NMinimize[{1, {y1 - (-1 + x) (1 + E^(-((1 - x + y2)/(5 z2)))/(
20 z2)) + (E^(-((1 - x + y2)/(5 z2))) y2)/(20 z2) == 
0, -100 (y1 - b/(1 + (y1 - y2)/(-1 + E^(1/4 x (y1 - y2))))) == 
0, -100 (-(b/(1 + (y1 - y2)/(1 - E^(-(1/4) x (y1 - y2))))) + 
y2) == 0, 5 (1 - z1) - E^((-1 + x - y1)/(5 z1)) z1 == 0, 
5 (1 - z2) - E^((-1 + x - y2)/(5 z2)) z2 == 0}}
, vars][[2]] 

solution b==1

sol[1]
(*{x -> 1.23605, y1 -> 0.236065, y2 -> 0.236065, z1 -> 0.833334,z2 -> 0.833334}*)

addendum additional constraint {x > 0, y1 > 0, y2 > 0, z1 > 0, z2 > 0}

solN[b_?NumericQ] := NMinimize[{1, 
Join[{y1 - (-1 + x) (1 +E^(-((1 - x + y2)/(5 z2)))/(20 z2)) + (E^(-((1 - x +y2)/(5 z2))) y2)/(20 z2) ==0, -100 (y1 - b/(1 + (y1 - y2)/(-1 + E^(1/4 x (y1 - y2))))) ==0, -100 (-(b/(1 + (y1 - y2)/(1 - E^(-(1/4) x (y1 - y2))))) +y2) == 0,5 (1 - z1) - E^((-1 + x - y1)/(5 z1)) z1 == 0,5 (1 - z2) - E^((-1 + x - y2)/(5 z2)) z2 == 0},
Map[# > 0 &, vars]]}, vars][[2]]

solN[10]
(*{x -> 2.64438*10^-8, y1 -> 9.22828*10^-6, y2 -> 0.0000405658,z1 -> 0.862207, z2 -> 0.863707}*)
$\endgroup$
2
  • $\begingroup$ it doest not find the currect roots, the roots I'm looking for are positive, and for example for b=10 you get negative roots $\endgroup$
    – jarhead
    Commented Sep 29, 2020 at 9:58
  • 1
    $\begingroup$ @jarhead That's an important infomation you didn't mention! Add Map[# > 0 &, vars] to the constraints! $\endgroup$ Commented Sep 29, 2020 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.