Re: N and NSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg7335] Re: [mg7300] N and NSolve
• From: Allan Hayes <hay at haystack.demon.co.uk>
• Date: Tue, 27 May 1997 22:27:10 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```23 May 1997
C L C Fu <es2136 at eng.warwick.ac.uk>
[mg7300] N and NSolve

>I sued NSolve to solve a  qubic equations. It gave me three real
>numerical solution.  However, when I used Solve to solve the same
>solution symbolicly, it gave me three roots in symbolic form and
>when I used N to solve the roots numerically, it gave me three
>solution in complex forms.
>The  real parts are the same in both cases.
>
>The solutions are  in the first case:
>
>{{Cp -> -8.104589570312425*^-8}, {Cp -> 2.522495922927543*^-8},
>  {Cp -> 4.500002377739561*^-8}}
>
> The second case:
>
> {{4.500002377739564*^-8 + 1.52201232709757*^-22*I},
>  {-8.104589570312425*^-8 + 2.977850205190899*^-23*I},
>  {2.522495922927541*^-8 - 1.720535674110297*^-22*I}}
>
>Why is that?

Col:
Ths difference comes from the details of the numerical evaluation -
in the second case the very small imaginary parts are accidental
You can remove them :

Chop[{{4.500002377739564*^-8 + 1.52201232709757*^-22*I},
{-8.104589570312425*^-8 + 2.977850205190899*^-23*I},
{2.522495922927541*^-8 - 1.720535674110297*^-22*I}}]

{{4.500002377739564*^-8}, {-8.104589570312425*^-8},
{2.522495922927541*^-8}}

Allan Hayes
hay at haystack.demon.co.uk
http://www.haystack.demon.co.uk/
voice:+44 (0)116 2714198
fax: +44 (0)116 2718642
12 Copse Close, Leicester, LE2 4FB, UK

```

• Prev by Date: Re: Line thickness for ParametricPlot3D
• Next by Date: How do you make Mma assume a parameter is real and positive?
• Previous by thread: N and NSolve
• Next by thread: Importing graphics