Re: Cannot NSolve a system of equations
- To: mathgroup at smc.vnet.net
- Subject: [mg88932] Re: Cannot NSolve a system of equations
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 21 May 2008 14:53:13 -0400 (EDT)
- Reply-to: hanlonr at cox.net
zet = 0.083; phi = 0.75; eta = 1.75; alpha = 0.64; y1 = 0.235457064; y2 = 0.512465374; y3 = 0.781779009; y4 = 1.109572176; y5 = 2.360726377; tau1 = zet y1^phi; tau2 = zet y2^phi; tau3 = zet y3^phi; tau4 = zet y4^phi; tau5 = zet y5^phi; taubar = (tau1 y1 + tau2 y2 + tau3 y3 + tau4 y4 + tau5 y5)/5; a1 = (1 + phi) tau1; a2 = (1 + phi) tau2; a3 = (1 + phi) tau3; a4 = (1 + phi) tau4; a5 = (1 + phi) tau5; eqns1 = {x1 == (roverw (1 - tau1) + ((roverw + (1 - x)) y1 - 1) ((1 - taubar + (1 - abar)/eta) x + (taubar - tau1) roverw - (1 - taubar)))/ (roverw (1 - tau1 + (1 - a1)/eta) - ((1 - taubar + (1 - abar)/eta) x + (taubar - tau1) roverw - (1 - taubar))), x2 == (roverw (1 - tau2) + ((roverw + (1 - x)) y2 - 1) ((1 - taubar + (1 - abar)/eta) x + (taubar - tau2) roverw - (1 - taubar)))/ (roverw (1 - tau2 + (1 - a2)/eta) - ((1 - taubar + (1 - abar)/eta) x + (taubar - tau2) roverw - (1 - taubar))), x3 == (roverw (1 - tau3) + ((roverw + (1 - x)) y3 - 1) ((1 - taubar + (1 - abar)/eta) x + (taubar - tau3) roverw - (1 - taubar)))/ (roverw (1 - tau3 + (1 - a3)/eta) - ((1 - taubar + (1 - abar)/eta) x + (taubar - tau3) roverw - (1 - taubar))), x4 == (roverw (1 - tau4) + ((roverw + (1 - x)) y4 - 1) ((1 - taubar + (1 - abar)/eta) x + (taubar - tau4) roverw - (1 - taubar)))/ (roverw (1 - tau4 + (1 - a4)/eta) - ((1 - taubar + (1 - abar)/eta) x + (taubar - tau4) roverw - (1 - taubar))), x5 == (roverw (1 - tau5) + ((roverw + (1 - x)) y5 - 1) ((1 - taubar + (1 - abar)/eta) x + (taubar - tau5) roverw - (1 - taubar)))/ (roverw (1 - tau5 + (1 - a5)/eta) - ((1 - taubar + (1 - abar)/eta) x + (taubar - tau5) roverw - (1 - taubar))), x == (x1 + x2 + x3 + x4 + x5)/5, abar == (a1 x1 + a2 x2 + a3 x3 + a4 x4 + a5 x5)/(5 x), roverw == (1 - x) (1 - alpha)/alpha}; sol = NSolve[eqns1, {x, x1, x2, x3, x4, x5, abar, roverw}]; Select[sol, And @@ (eqns1 /. #) &] {} Increasing the working precision helps Off[NSolve::precw]; sol2 = NSolve[eqns1, {x, x1, x2, x3, x4, x5, abar, roverw}, WorkingPrecision -> 50]; Select[sol2, And @@ (eqns1 /. #) &] {{x->0.41708623092950157741569019179902289185045201412813,x1->0.\ 692440249232143611072102477625080745344157628899,x2->0.\ 604422024572264901699315484017555974822809818657,x3->0.\ 5127989690938688778766742187652415932939481958373,x4->0.\ 39437767611147931754234647185921962409136124978897,x5->-0.\ 11860776436224882111198769327198347830001682254199,abar->0.\ 08545766887516266300728185720734114355092900559414,roverw->0.\ 327888995102155362703674267113049623334120742053},{x->1.\ 0000000000000000000000000000000000000000000000000,x1->1.\ 000000000000000000000000000000000000000000000000,x2->1.\ 000000000000000000000000000000000000000000000000,x3->1.\ 0000000000000000000000000000000000000000000000000,x4->1.\ 0000000000000000000000000000000000000000000000000,x5->1.\ 0000000000000000000000000000000000000000000000000,abar->0.\ 13829898904658144378180892316051003528822699194006,roverw->0}} Bob Hanlon ---- murat.koyuncu at gmail.com wrote: > Dear all, > > I have the following system that I need to solve, but I cannot get a > sensible result. > > Unprotect[In,Out];Clear[In,Out];ClearAll["Global`*"]; > zet=0.083; > phi=0.75;eta=1.75;alpha=0.64;y1=0.235457064;y2=0.512465374;y3=0.781779009; > y4=1.109572176; y5=2.360726377;tau1=zet y1^phi;tau2=zet > y2^phi;tau3=zet y3^phi;tau4=zet y4^phi;tau5=zet y5^phi; > taubar=(tau1 y1+tau2 y2+tau3 y3+tau4 y4+tau5 y5)/ > 5;a1=(1+phi)tau1;a2=(1+phi)tau2;a3=(1+phi)tau3;a4=(1+phi)tau4;a5=(1+phi)tau5; > > eqns1={x1==(roverw(1-tau1)+((roverw+(1-x))y1-1)( (1-taubar+(1-abar)/ > eta)x+(taubar-tau1)roverw-(1-taubar)))/(roverw (1-tau1+(1-a1)/eta)- > ( (1-taubar+(1-abar)/eta)x+(taubar-tau1)roverw-(1-taubar))), > x2==(roverw(1-tau2)+((roverw+(1-x))y2-1)( (1-taubar+(1-abar)/eta)x+ > (taubar-tau2)roverw-(1-taubar)))/(roverw (1-tau2+(1-a2)/eta)-( (1- > taubar+(1-abar)/eta)x+(taubar-tau2)roverw-(1-taubar))), > x3==(roverw(1-tau3)+((roverw+(1-x))y3-1)( (1-taubar+(1-abar)/eta)x+ > (taubar-tau3)roverw-(1-taubar)))/(roverw (1-tau3+(1-a3)/eta)-( (1- > taubar+(1-abar)/eta)x+(taubar-tau3)roverw-(1-taubar))), > x4==(roverw(1-tau4)+((roverw+(1-x))y4-1)( (1-taubar+(1-abar)/eta)x+ > (taubar-tau4)roverw-(1-taubar)))/(roverw (1-tau4+(1-a4)/eta)-( (1- > taubar+(1-abar)/eta)x+(taubar-tau4)roverw-(1-taubar))), > x5==(roverw(1-tau5)+((roverw+(1-x))y5-1)( (1-taubar+(1-abar)/eta)x+ > (taubar-tau5)roverw-(1-taubar)))/(roverw (1-tau5+(1-a5)/eta)-( (1- > taubar+(1-abar)/eta)x+(taubar-tau5)roverw-(1-taubar))), > x==(x1+x2+x3+x4+x5)/5, abar == (a1 x1+a2 x2+a3 x3+a4 x4+a5 x5)/ > (5x),roverw==(1-x)(1-alpha)/alpha }; > > sol=NSolve[eqns1,{x, x1,x2,x3,x4,x5,abar, roverw}]; > > eqns1 /. sol > > Out[741]={{False, False, False, False, False, True, True, True}, > {False, False, > False, False, False, True, True, True}, {False, False, False, > False, False, True, False, True}, {False, False, True, False, False, > True, False, True}, {False, False, True, False, False, True, False, > True}, {False, False, True, True, False, True, True, False}} > > > What am I doing wrong? Is it just because the system is too > complicated? > > Any help would be truly appreciated. > Murat >