Re: NSolve and array

• To: mathgroup at smc.vnet.net
• Subject: [mg64742] Re: [mg64714] NSolve and array
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Thu, 2 Mar 2006 06:47:26 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```poly=3+3*x-7*x^2-x^3+2*x^4+
3*x^7-3*x^8-x^9+x^10;

soln=NSolve[poly==0,x];

Chop[poly/.soln]

{0,0,0,0,0,0,0,0,0,0}

allRoots=x/.soln

{-1.7320508075688774, -0.8686883014299476 -
0.585281855209975*I, -0.8686883014299476 +
0.585281855209975*I, -0.4962920713893364,
0.07635557774869899 - 1.1409461420499265*I,
0.07635557774869899 + 1.1409461420499265*I,
0.9999999999999999, 1.0404787593759168 -
0.567349582684565*I, 1.0404787593759168 +
0.567349582684565*I, 1.7320508075688774}

realRoots=Cases[allRoots,_Real]

{-1.7320508075688774, -0.4962920713893364,
0.9999999999999999, 1.7320508075688774}

Bob Hanlon

>
> From: "behnam.kia at gmail.com" <behnam.kia at gmail.com>
To: mathgroup at smc.vnet.net
> Subject: [mg64742] [mg64714] NSolve and array
>
> Hi every body. I have a problem with mathematica and I would be very
> glad if some one helps me.
> The problem is that I find the roots of  polynomial by NSolve and I
> want to put the results in an array for further manipulation, but I do
> not know how can I do it. More precisely I want to return the results
> of NSolve to an array or similary list.
>
>
> thanks
>
>

```

• Prev by Date: Ploting a changing constant
• Next by Date: Re: NSolve and array
• Previous by thread: Re: NSolve and array
• Next by thread: Re: NSolve and array