Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Cannot NSolve a system of equations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg88930] Re: Cannot NSolve a system of equations
  • From: "Steve Luttrell" <steve at _removemefirst_luttrell.org.uk>
  • Date: Wed, 21 May 2008 14:52:50 -0400 (EDT)
  • References: <g0uahi$4tk$1@smc.vnet.net>

You are using == to test equality of approximate solutions to the equations. 
You can verify that your solution is correct by slightly modifying how you 
test the solution.

eqns1 /. Equal[u_, v_] -> Plus[u - v]  /. sol // Chop

The (/. Equal[u_, v_] -> Plus[u - v]) replacement takes the difference 
between the left and right sides of each of your equations, then the (/. 
sol) substitutes in your solution (as before), then finally the (// Chop) 
truncates to zero numbers that are nearly zero. This makes almost all of the 
differences zero (as required), and there are a few that survive the Chop 
but which are nevertheless small enough to also be zero. You can use the 
2-argument form of Chop to control the range of numbers that is truncated to 
zero.

Stephen Luttrell
West Malvern, UK

<murat.koyuncu at gmail.com> wrote in message news:g0uahi$4tk$1 at smc.vnet.net...
> 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
> 



  • Prev by Date: Re: Colors chosen for ListPlot, etc., in v. 6 -- followup
  • Next by Date: Re: Re: Range of Use of Mathematica
  • Previous by thread: Re: Cannot NSolve a system of equations
  • Next by thread: Re: Cannot NSolve a system of equations