FindRoot
documentation reports that if the equation and the initial point are reals, the solutions are searched in the real domain.
However, in the following case I get a complex solution
FindRoot[eq, {h, 1.7}]
{h -> -0.990042 - 0.689686 I}
Same for
Assuming[Reals, FindRoot[eq, {h, 1.7}]]
Where eq
is the following. What can I do to force Mathematica to return only real solutions?
eq = 0.2888960456513873` \[Sqrt](0.4149486782073932` + (0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 2.2076945564517114` h \[Sqrt](0.4149486782073932` +
(0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 6.735521430523215` h^2 \[Sqrt](0.4149486782073932` +
(0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 10.54153050379155` h^3 \[Sqrt](0.4149486782073932` +
(0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 8.93280406600778` h^4 \[Sqrt](0.4149486782073932` +
(0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 3.8752891330788843` h^5 \[Sqrt](0.4149486782073932` +
(0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 0.666148416209407` h^6 \[Sqrt](0.4149486782073932` +
(0.5637605604986459` +
h)^2) \[Sqrt](0.4756674436221575` + (0.9900423417575865` +
h)^2) + 0.4167441738314279` \[Sqrt](0.4756674436221575` +
(0.9900423417575865` +
h)^2) \[Sqrt](1 - (0.4444444444444444`
(-0.022551321792606827` + (0.5637605604986459` +
h)^2)^2)/(0.4149486782073932` + (0.5637605604986459` +
h)^2))
NSolve[ eq == 0, h, Reals]
yields{}
i.e. there are no real solutions. $\endgroup$Plot[Re[eq], {h, -1, 1}]
. $\endgroup$NSolve[ eq == 0&& -5 < h < 5, h, Reals]
. $\endgroup$