Re: NSolve unable to find all possible roots
- To: mathgroup at smc.vnet.net
- Subject: [mg115597] Re: NSolve unable to find all possible roots
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 16 Jan 2011 05:51:17 -0500 (EST)
- References: <igrqbc$qn2$1@smc.vnet.net>
On 15.01.2011 10:45, Luiz Melo wrote:
> 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
>
> --
>
>
Hi Luiz,
your expression has got exactly one root at x=0. Obvously you did not try:
In[1]:= expr = x*(Sqrt[-13.319 - x^2] + 2.41*Sqrt[1.004 - x^2]);
Table[expr, {x, {-1.99, 0, 1.99}}]
Out[2]= {0. - 16.5178 I, 0. + 0. I, 0. + 16.5178 I}
maybe there' s just a typo (subtract the squareroots):
In[3]:= expr2 = x*(Sqrt[-13.319 - x^2] - 2.41*Sqrt[1.004 - x^2]);
Table[expr2, {x, {-1.99, 0, 1.99}}]
Out[4]= {0. - 0.0263184 I, 0. + 0. I, 0. + 0.0263184 I}
comes at least near zero. So lets try to solve the equation expr2 = 0
using NSolve :
In[5]:= NSolve[expr2 == 0]
Out[5]= {{x -> 1.99573}, {x -> -1.99573}, {x -> 0.}}
is this the expected result?
Cheers,
Peter