Re: Cannot NSolve a system of equations

• To: mathgroup at smc.vnet.net
• Subject: [mg88900] Re: Cannot NSolve a system of equations
• From: Szabolcs Horvát <szhorvat at gmail.com>
• Date: Wed, 21 May 2008 14:47:12 -0400 (EDT)
• Organization: University of Bergen
• References: <g0uahi\$4tk\$1@smc.vnet.net>

```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?

The solutions are correct.  The 'False' answers are due to numerical
errors.  Try this to see what I mean:

In[51]:= eqns1 /. Equal -> Subtract /. sol

Out[51]= {{2.45322*10^-10, 2.81113*10^-9, 2.42972*10^-9,
8.77617*10^-9, 1.59243*10^-8, -6.03961*10^-14, -1.8785*10^-13,
0.}, {-2.41096*10^-11, -8.28258*10^-10, -1.75126*10^-10,
9.1064*10^-11, 1.57208*10^-11, -6.66134*10^-16, -8.74301*10^-16,
0.}, {8.98925*10^-12 - 2.66187*10^-11 I,
2.56666*10^-11 + 6.06653*10^-11 I, -1.45572*10^-11 +
6.01381*10^-11 I,
2.02049*10^-11 - 3.9833*10^-11 I, -1.3828*10^-11 - 6.41887*10^-12 I,
4.44089*10^-16 - 8.88178*10^-16 I, -1.67227*10^-15 -
3.71925*10^-15 I, 0.+ 0. I}, {8.98925*10^-12 + 2.66187*10^-11 I,
2.56666*10^-11 - 6.06653*10^-11 I, -1.45572*10^-11 -
6.01381*10^-11 I,
2.02049*10^-11 + 3.9833*10^-11 I, -1.3828*10^-11 + 6.41887*10^-12 I,
4.44089*10^-16 + 8.88178*10^-16 I, -1.67227*10^-15 +
3.71925*10^-15 I, 0.+ 0. I}, {1.11022*10^-16, 1.38778*10^-14,
9.15934*10^-15, -2.96985*10^-15, -2.52021*10^-14,
5.55112*10^-17, -1.2032*10^-14, 0.}, {-2.15383*10^-14,
5.72875*10^-14, 2.22045*10^-15, -7.54952*10^-15, -3.08642*10^-14,
0., 1.94289*10^-15, 9.36751*10^-15}}

```

• Prev by Date: Colors chosen for ListPlot, etc., in v. 6
• Next by Date: Re: Computing n-grams
• Previous by thread: Re: Cannot NSolve a system of equations
• Next by thread: Re: Cannot NSolve a system of equations