Re: Cannot NSolve a system of equations
- To: mathgroup at smc.vnet.net
- Subject: [mg88938] Re: Cannot NSolve a system of equations
- From: dh <dh at metrohm.ch>
- Date: Wed, 21 May 2008 14:54:20 -0400 (EDT)
- References: <g0uahi$4tk$1@smc.vnet.net>
Hi Murat, try to check your equations not with Equal, but subtract the left from the right side. E.g. by: eqns1 /. Equal -> Subtract /. sol As you are working with machine numbers, you can not expect an 100% accurate solution. In your case, you will see that the equations are o.k. with an error better than 10^-8. This is not overwhelming, but may be good enough for your purpose. If not, one can consider: Rationalizing, Condition number of equations, Arbitrary precision calculation etc. hope this helps, Daniel 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 > -- Daniel Huber Metrohm Ltd. Oberdorfstr. 68 CH-9100 Herisau Tel. +41 71 353 8585, Fax +41 71 353 8907 E-Mail:<mailto:dh at metrohm.com> Internet:<http://www.metrohm.com>