Help please: Numerical solution to system of 4 nonlinear equations
- To: mathgroup at smc.vnet.net
- Subject: [mg118691] Help please: Numerical solution to system of 4 nonlinear equations
- From: Amatya <amatya.rakshasa at gmail.com>
- Date: Sat, 7 May 2011 07:33:42 -0400 (EDT)
Hi Guys, I have a system of 4 nonlinear equations in four variables, and in addition I have a fifth inequality constraint. Can you tell me how to solve this. Without the inequality I was using Findroot but I need to use the inequality to pick out a solution which is also meaningful to the underlying setup. Here is my code. (I am new to mathematica) I have written the 4 equations and 1 inequality within the FindInstance command, along with 4 more non negativity constraints. The early part of the code involves a whole bunch of parameters (not all of which I am using in this particular calculation but I need them in other set ups) and some other variables. At the bottom, in the last 4 lines I have the find instance command (which is not working) which contains my equalities and inequalities which I need to numerically solve. Any help will be greatly appreciated. Thanks a lot values = {{r, \[Delta], \[Sigma], Subscript[i, e], Subscript[i, u], Subscript[\[Lambda], e ], Subscript[\[Lambda], u ], Subscript[H, 0], Subscript[C, f] , F, \[Tau], Subscript[C, Ren]}, {0.047, 0.05, 0.1632, 5, 0, 0.005, 0.02, 100, 17, 80, 0.3, 8}}; G = Grid[values, Dividers -> {{None, None, None}, {{Blue}, {Blue}, None}}]; r = values[[2, 1]]; \[Delta] = values[[2, 2]]; \[Sigma] = values[[2, 3]]; Subscript[i, e] = values[[2, 4]]; Subscript[i, u] = values[[2, 5]]; Subscript[\[Lambda], e] = values[[2, 6]]; Subscript[\[Lambda], u] = values[[2, 7]]; Subscript[H, 0] = values[[2, 8]]; Subscript[C, f] = values[[2, 9]]; F = values[[2, 10]]; \[Tau] = values[[2, 11]]; Subscript[C, Ren] = values[[2, 12]]; Subscript[I, e] = Subscript[i, e]/ r - (Subscript[i, e] - Subscript[i, u]) Subscript[\[Lambda], e]/(r (r + Subscript[\[Lambda], e] + Subscript[\[Lambda], u])); Subscript[I, u] = Subscript[i, u]/ r + (Subscript[i, e] - Subscript[i, u]) Subscript[\[Lambda], u]/(r (r + Subscript[\[Lambda], e] + Subscript[\[Lambda], u])); Solve[k (k - 1) + 2 (r - \[Delta])/\[Sigma]^2 k - 2 r/\[Sigma]^2 == 0, k]; {Subscript[k, 1 ], Subscript[k, 2 ]} = k /. % ; Clear[k]; Subscript[k, 1] Subscript[k, 2] L1 = (H1S^(-Subscript[k, 1])* (F - (c1*F)/r + ( H1S^(Subscript[k, 2])*((F* H1D^(Subscript[k, 1])* (-c1 + r))/r + H1S^(Subscript[k, 1])*(-(c0* F)/r + (c1*F)/ r + (H1D^(Subscript[k, 2])*(-F*H0D^(Subscript[k, 1])* (c0 - r) + H0S^(Subscript[k, 1])* (c0*F - H0D *r + r* Subscript[C, f])))/((H0D^(Subscript[k, 2])* H0S^(Subscript[k, 1]) - H0D^(Subscript[k, 1])* H0S^(Subscript[k, 2]))* r) + (H1D^(Subscript[k, 1])*(F*H0D^(Subscript[k, 2])*(c0 - r) - H0S^(Subscript[k, 2])* (c0*F - H0D* r + r* Subscript[C, f])))/((H0D^(Subscript[k, 2])* H0S^(Subscript[k, 1]) - H0D^(Subscript[k, 1])* H0S^(Subscript[k, 2]))*r) + Subscript[C, Ren])))/( H1D^(Subscript[k, 2])* H1S^(Subscript[k, 1]) - H1D^(Subscript[k, 1])* H1S^(Subscript[k, 2])))); M1 = (((F* H1D^(Subscript[k, 1])* (-c1 + r))/r + H1S^(Subscript[k, 1])*(-(c0* F)/r + (c1*F)/ r + (H1D^(Subscript[k, 2])*(-F*H0D^(Subscript[k, 1])* (c0 - r) + H0S^(Subscript[k, 1])* (c0*F - H0D *r + r* Subscript[C, f])))/((H0D^(Subscript[k, 2])* H0S^(Subscript[k, 1]) - H0D^(Subscript[k, 1])* H0S^(Subscript[k, 2]))* r) + (H1D^(Subscript[k, 1])*(F*H0D^(Subscript[k, 2])*(c0 - r) - H0S^(Subscript[k, 2])* (c0*F - H0D* r + r* Subscript[C, f])))/((H0D^(Subscript[k, 2])* H0S^(Subscript[k, 1]) - H0D^(Subscript[k, 1])* H0S^(Subscript[k, 2]))*r) + Subscript[C, Ren]))/( H1D^(Subscript[k, 2])* H1S^(Subscript[k, 1]) - H1D^(Subscript[k, 1])* H1S^(Subscript[k, 2]))); L0 = ((-F*H0D^(Subscript[k, 2])*(c0 - r) + H0S^(Subscript[k, 2])*(c0*F - H0D*r + r*Subscript[C, f]))/((H0D^(Subscript[k, 2])* H0S^(Subscript[k, 1]) - H0D^(Subscript[k, 1])* H0S^(Subscript[k, 2]))* r)); M0 = ((-F*H0D^(Subscript[k, 1])*(c0 - r) + H0S^(Subscript[k, 1])*(c0*F - H0D*r + r*Subscript[C, f]))/((H0D^(Subscript[k, 2])* H0S^(Subscript[k, 1]) - H0D^(Subscript[k, 1])* H0S^(Subscript[k, 2]))* r)); c0 = ((-F*H0D^(Subscript[k, 2])*r*Subscript[k, 1] + H0S^(Subscript[k, 2])* r*(-H0D + (H0D + Subscript[C, f])*Subscript[k, 1]))/( F*(H0D^(Subscript[k, 2]) - H0S^(Subscript[k, 2]))*(-1 + \[Tau])* Subscript[k, 1])); c1 = (H1D^(Subscript[k, 1])*H1S^(Subscript[k, 1])* r*(-1* F*H1S^(-Subscript[k, 1]) + H1D^(-Subscript[k, 1]) *Subscript[C, Ren] + ( F*H1D^(-Subscript[k, 1])* (1 - \[Tau])*(-80* H0D^(Subscript[k, 2])*Subscript[k, 1] + H0S^(Subscript[k, 2])*(- H0D + (15 + H0D)* Subscript[k, 1])))/((-56* H0D^(Subscript[k, 2]) + 56*H0S^(Subscript[k, 2]))*Subscript[ k, 1]) + ( F*H0S^(-Subscript[k, 1])*(r + ((1 - \[Tau])* (-80* H0D^(Subscript[k, 2])* r* Subscript[k, 1] + H0S^(Subscript[k, 2])* r* (-H0D + (15 + H0D)*Subscript[k, 1])))/((-56* H0D^(Subscript[k, 2]) + 56* H0S^(Subscript[k, 2]))* Subscript[k, 1])))/r))/( F *(H1S^(Subscript[k, 1]) - H1D^(Subscript[k, 1]))*(1 - \[Tau])); A1 = (F*H1S^(-Subscript[k, 1])*(r + c1*(-1 + \[Tau]))*Subscript[k, 2])/(r *(Subscript[k, 1] - Subscript[k, 2])); B1 = (F*H1S^(-Subscript[k, 2])*(r + c1*(-1 + \[Tau]))*Subscript[k, 1])/(r *(Subscript[k, 2] - Subscript[k, 1])); FindInstance[ L1*Subscript[H, 0]^(Subscript[k, 1]) + M1*Subscript[H, 0]^Subscript[k, 2] + c1*F/r == F && L0*H1D^(Subscript[k, 1]) + M0*H1D^Subscript[k, 2] + c0*F/r - Subscript[C, Ren] == H1D - Subscript[C, f] && (F*H0S^(-Subscript[k, 1])*(r + c0*(-1 + \[Tau]))* Subscript[ k, 2]) == (H0D^(-Subscript[k, 1])*(-H0D* r + (H0D*r + c0*F *(-1 + \[Tau]) + r* Subscript[C, f])* Subscript[k, 2])) && (F* H1S^(-Subscript[k, 2])*(r + c1*(-1 + \[Tau]))*Subscript[k, 1]) == (H0S^(-Subscript[k, 2])* H1D^(-Subscript[k, 2])*((-c0 + c1)*F* H0S^(Subscript[k, 2])*(-1 + \[Tau]) + F*H1D^(Subscript[k, 2])* (c0 + r - c0 *\[Tau]) + H0S^(Subscript[k, 2])* r* Subscript[C, Ren])* Subscript[k, 1]) && A1*(Subscript[H, 0])^(Subscript[k, 1]) + B1*(Subscript[H, 0])^(Subscript[k, 2]) + (H1S) - (1 - \[Tau])*c1* F/r > 0 && H1S > 0 && H0S > 0 && H1D > 0 && H0D > 0, {H1S, H0S, H1D, H0D}, Reals] Clear[c0, c1, L0, L1, M0, M1, H1D, H0D, H1S, H0S]