Re: NSolve unable to find all possible roots
- To: mathgroup at smc.vnet.net
- Subject: [mg115613] Re: NSolve unable to find all possible roots
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sun, 16 Jan 2011 05:54:20 -0500 (EST)
----- Original Message -----
> From: "Luiz Melo" <luiz.melo at polymtl.ca>
> To: mathgroup at smc.vnet.net
> Sent: Saturday, January 15, 2011 3:45:17 AM
> Subject: [mg115577] NSolve unable to find all possible roots
> Dear mathgroup,
> The equation below has three possible roots, namely: 0., 1.99, -1.99.
>
> eq = x*(Sqrt[-13.319 - x^2] + 2.41*Sqrt[1.004 - x^2])
>
> If we try NSolve[eq == 0, x], we get {{kx-> 0.}} only.
>
> How to instruct NSolve to search for the other two roots of the above
> equation?
>
> Thank you
> Luiz Melo
Actually only 0 is a root. A graph (command below) will show this.
Plot[Abs[eq], {x, -5, 5}]
The other two are what are generally called parasite roots, that is, they solve a closely related system of equations. These are obtained by treating the square roots as variables, with new polynomial equations that define them. Can be done as below.
In[34]:= e2 = {x*(s1 + 2.41*s2), s1^2 - (-13.319 - x^2),
s2^2 - (1.004 - x^2)};
In[35]:= Union[x /. NSolve[e2]]
Out[35]= {-1.995728284766841, 0., 1.995728284766838}
The issue (I think) is that Sqrt[] is a function, returning the principal square root of a complex number. You might have been regarding it instead as "multivalued function", returning the set of all square roots.
Daniel Lichtblau
Wolfram Research