Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2002
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2002

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

Search the Archive

Re: Bug in NSolve?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33974] Re: Bug in NSolve?
  • From: Rodger Rosenbaum <rodgerroSPAMNOT at siteconnect.com>
  • Date: Thu, 25 Apr 2002 02:59:45 -0400 (EDT)
  • References: <a9oe60$d9r$1@smc.vnet.net> <a9r3eo$lrg$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Sat, 20 Apr 2002 06:56:24 +0000 (UTC), lalu_bhatt at yahoo.com (Bhuvanesh) wrote:

>Andrzej Kozlowski <andrzej at tuins.ac.jp> wrote:
>
>> Unlike Solve, NSolve  returns only one root when it finds multiple roots 
>> it considers to be sufficiently close to be identical. In fact it seems 
>> that it applies Union to the final result. So when you use more 
>> precision the roots which were considered as distinct due to possible 
>> error become identified and appear only once.
><snipped>
>> Why do Solve and NSolve behave differently here? Well, it seems to me 
>> that it is probably a matter of "philosophy". Solve is basically an 
>> "algebraic function" and from the algebraic point of view the 
>> multiplicity of roots is an important property of a solution. But most 
>> people looking for numerical solutions would be I think inclined to 
>> consider multiple roots as "the same".
>
>But there should be two solutions, right? Solve returns:
>
>In[1]:= Solve[4877361379 x^2 -9754525226 x + 4877163849==0,x]
>
>               4877262613 - I Sqrt[2]         4877262613 + I Sqrt[2]
>Out[1]= {{x -> ----------------------}, {x -> ----------------------}}
>                     4877361379                     4877361379
>
>The two solutions *are* close, as you wrote.

Andrzej Kozlowski suggests that when there is a root of multiplicity greater than 1, we
should not be surprised if Mathematica only reports one root.  In his examples, we can
determine the multiplicity by inspection; but suppose we had a polynomial of relatively
high order, say fifth degree, with, say, 2 distinct roots, and 1 of multiplicity 3, e.g.: 

NSolve[x^5 - 15 x^4 + 74 x^3 - 142 x^2 + 117 x - 35,x,20]

Mathematica gives:
 {{ x--> 1.000000},{ x--> 1.000000},{ x--> 5.00000000000000000},{x-->7.00000000000000000}}

What am I to make of this?  Why didn't Mathematica form the Union of the three identical
roots and only show one?  Can I be sure that the root, 5, doesn't have multiplicity
greater than one?  The lesser precision of the two roots, 1, implies higher multiplicity
than the roots, 5 and 7, but but can I rely on such an inference?  And there is that claim
in the Mathematica Book:

"NSolve will always give you the complete set of numerical solutions to any
polynomial equation in one variable."

And here is some further peculiar behavior; try:

NSolve[x^3 - 3 x^2 + 3 x - 1,x,20]

NSolve[x^4 - 4 x^3 + 6 x^2 - 4 x + 1,x,20]

These give two roots of unity, but if you remove the third argument (the 20), then they
give 3 and 4 roots of unity, respectively. Make the third argument in the cubic 25, and
get three roots of unity; make the third argument 200 and get only two roots.

and

NSolve[x^5 - 5 x^4 + 10 x^3 - 10 x^2 + 5 x - 1,x,20]

This gives 4 roots of unity; make the third argument 25 and get only 3 roots.  Make the
third argument 200, or 10000, and get two roots.


  • Prev by Date: RE: Re: Pattern matching
  • Next by Date: help read file
  • Previous by thread: Re: Bug in NSolve?
  • Next by thread: Re: Re: Bug in NSolve?