       Thank you very much (Emergent Help: NSolve Problems!)

• To: mathgroup at smc.vnet.net
• Subject: [mg39838] Thank you very much (Emergent Help: NSolve Problems!)
• From: Chengzhou Wang <wcz at ece.ucsd.edu>
• Date: Sat, 8 Mar 2003 02:50:13 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hi,

Thank you very much for your kind replies. I am so impressed that I got so
many warm-hearted replies right after I sent the email to this email
group. Now I am clear for this problem, which is quite important for my
research. I am really indebted to you guys.

Thanks again! Have a good time!

--
Chengzhou

On Thu, 6 Mar 2003, Daniel Lichtblau wrote:

> Chengzhou Wang wrote:
> >
> > Hi, guys
> >
> > I have some complicated polynomials, and I want to calculate its roots.
> > HOwever, when I use NSolve, it creates some problems. Say a simple
> > example:
> >
> > temp[s_]=s^10+10 s^9+ 10 s^8 +10 s^7 +10 s^6+ 10 s^5 +10 s^4 +1;
> > NSolve[temp[s]==0, s]
> >
> > It will give:
> >
> > Out= {{s -> -8.99998}, {s -> -1.06539}, {s -> -0.468828 - 0.886239 I},
> >
> > >    {s -> -0.468828 + 0.886239 I}, {s -> -0.409684 - 0.469948 I},
> >
> > >    {s -> -0.409684 + 0.469948 I}, {s -> 0.401048 - 0.312597 I},
> >
> > >    {s -> 0.401048 + 0.312597 I}, {s -> 0.51015 - 0.878693 I},
> >
> > >    {s -> 0.51015 + 0.878693 I}}
> >
> > But when I plug in the first number, which is "-8.99998", it should give a
> > value close to zero. However, it gives:
> >
> > In:= temp[-8.99998]
> > Out= -411.473
> >
> > The other roots seems OK. Does anyone know why? This is just a simple
> > example. I have some more complicated polynomials to deal with.
> >
> >
> > PS: Please reply (cc) to my email. I did not subscribe my email to the
> > this email group!
> >
> > --
> > Chengzhou
>
> You are only plugging in the first 6 significant digits of the actual
> solution, and error from this truncation is sufficiently large to make
> the residual appear big.
>
> temp[s_]=s^10+10 s^9+ 10 s^8 +10 s^7 +10 s^6+ 10 s^5 +10 s^4 +1;
> In:= soln = NSolve[temp[s]==0, s];
>
> In:= InputForm[First[soln]]
> Out//InputForm= {s -> -8.999981180131652}
>
> In:= temp[-8.999981180131652]
>                     -7
> Out= -4.76837 10
>
> If you plug in via rule replacement you do not risk this problem of
>
> In:= InputForm[temp[s] /. soln]
> Out//InputForm=
> {-4.76837158203125*^-7, 2.220446049250313*^-15,
>  2.581268532253489*^-15 - 1.5543122344752192*^-15*I,
>  2.581268532253489*^-15 + 1.5543122344752192*^-15*I,
>  1.8388068845354155*^-16 - 1.0234868508263162*^-16*I,
>  1.8388068845354155*^-16 + 1.0234868508263162*^-16*I,
>  1.968911145233676*^-16 - 2.2036409155767878*^-16*I,
>  1.968911145233676*^-16 + 2.2036409155767878*^-16*I,
>  -8.770761894538737*^-15 + 7.549516567451064*^-15*I,
>  -8.770761894538737*^-15 - 7.549516567451064*^-15*I}
>
> By the way, if you take into account the magnitude of that solution
> (around 10^1), the degree of the equation (10), magnitude of coefficient
> sizes (1 for lead, 10 for the rest), and the fact that the error is
> around the 7th digit, you can estimate that the error in residual
> computation may be as large as roughly 10^(-6)*10^10. So obtaining a
> residual around O(10^3) using the truncated solution is not surprising.
>
> Daniel Lichtblau
> Wolfram Research
>

```

• Prev by Date: Re: Tentative conclusion: Mathematica cannot outputplain text
• Next by Date: Re: integer sequence periodicity
• Previous by thread: AW: Emergent Help: NSolve Problems!
• Next by thread: AW: Desciphering Solve[] output.