[Date Index]
[Thread Index]
[Author Index]
RE: Emergent Help: NSolve Problems!
*To*: mathgroup at smc.vnet.net
*Subject*: [mg39797] RE: [mg39753] Emergent Help: NSolve Problems!
*From*: "David Park" <djmp at earthlink.net>
*Date*: Fri, 7 Mar 2003 03:40:17 -0500 (EST)
*Sender*: owner-wri-mathgroup at wolfram.com
Chengzhou,
It looks like the first root is sensitive. However, it appears that you
retyped the s value and thus threw away 10 of its digits. Save the solutions
and then you can substitute them directly with ReplaceAll (\.). Furthermore,
you can get Mathematica to return exact solutions and then use N to obtain
extended precision.
temp[s_] = s^10 + 10 s^9 + 10 s^8 + 10 s^7 + 10 s^6 + 10 s^5 + 10 s^4 + 1;
sols = Solve[temp[s] == 0, s]
{{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 + 10*#1^8 +
10*#1^9 + #1^10 & , 1]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 2]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 3]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 4]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 5]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 6]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 7]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 8]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 9]},
{s -> Root[1 + 10*#1^4 + 10*#1^5 + 10*#1^6 + 10*#1^7 +
10*#1^8 + 10*#1^9 + #1^10 & , 10]}}
Those are Root objects. Look them up in Help. We can now substitute them
using machine precision and obtain
temp[s] /. sols // N // Chop
{-4.76837*^-7, 0, 0, 0, 0, 0, 0, 0, 0, 0}
But if we use N to first convert the solutions to 20 place precision, we
obtain
temp[s] /. N[sols, 20] // Chop
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: Chengzhou Wang [mailto:wcz at ece.ucsd.edu]
To: mathgroup at smc.vnet.net
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[4]= {{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[5]:= temp[-8.99998]
Out[5]= -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.
Thanks in advance!
PS: Please reply (cc) to my email. I did not subscribe my email to the
this email group!
--
Chengzhou
Prev by Date:
**Re: Emergent Help: NSolve Problems!**
Next by Date:
**Re: Functional differentiation on lattice**
Previous by thread:
**Re: Emergent Help: NSolve Problems!**
Next by thread:
**Re: Emergent Help: NSolve Problems!**
| |