TransWikia.com

Solving a non-linear 5 variable system

Mathematica Asked by jarhead on October 9, 2020

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

One Answer

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}*)

Correct answer by Ulrich Neumann on October 9, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP