Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE : Beware of NSolve

  • To: mathgroup at
  • Subject: [mg50168] RE : [mg50165] Beware of NSolve
  • From: "Florian Jaccard" <florian.jaccard at>
  • Date: Wed, 18 Aug 2004 04:34:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

Very interesting... thank you to have taken time to show this.
It is a good example to show some dangers... 

In fact, the Help browser says the following :


"NSolve[lhs==rhs, var] gives a list of numerical approximations to the roots
of a polynomial equation...." 

Your equation is not polynomial, so NSolve is not really the best way to
solve it.

As the equation is not complicated, Solve should manage...
And it does :

N[Solve[f == 0, x]]

{{x -> -0.014126116704662368}, 
  {x -> 0.0028165928951385567}}


-----Message d'origine-----
De : Carlos Felippa [mailto:carlos at] 
Envoyé : mercredi, 18. août 2004 07:20
À : mathgroup at
Objet : [mg50165] Beware of NSolve

Run v. 4.2 on Mac:

f=5/432 - 11/(27*Sqrt[70]*Sqrt[19 - 1890*x]) + x/(2*Sqrt[38/35 - 108*x]);

 Solve[f==0,x]  returns 2 real roots:

{{x -> (-171 - 25*Sqrt[105])/30240}, {x -> (-171 + 25*Sqrt[105])/30240}}

NSolve[f==0,x]  returns 4 real roots:

{{x -> -0.10481082961146104}, {x -> -0.014126116704662378}, 
 {x -> 0.002816592895138556}, {x -> 0.0003796126802330315}}

Roots 1 and 4 are incorrect.  (Just plot f)

Had a similar problem with a quartic 3 months ago.  This is a
simpler example.

  • Prev by Date: Re: Re: Simplify stuck in simple expression
  • Next by Date: Re: Beware of NSolve
  • Previous by thread: question: override Multiply[]
  • Next by thread: Label of Max[list]