# Non solutions returned by NSolve. And why does it return both phi and Cos[phi]?

Similarly to this thread NSolve gives additional solutions that don't satisfy the equations!

NSolve returns "spurious" solutions, even increasing the working precision

fsys={1 - Cos[(11 \[Pi])/45] - (3 Cos[psi1])/4 - 2/3 Sin[phi + \[Pi]/6] == 0, h + 2/3 Cos[phi + \[Pi]/6] + Sin[(11 \[Pi])/45] - (3 Sin[psi1])/4 == 0, -0.0436952 - (3 Cos[psi2])/4 - 2/3 Sin[phi - \[Pi]/6] == 0,2/5 + h + 2/3 Cos[phi - \[Pi]/6] + Sin[(17 \[Pi])/180] - (3 Sin[psi2])/4 == 0}

NSolve[N[fsys], {phi, h, psi1, psi2}, WorkingPrecision -> 100]


The second solution returned is

    {h -> -1.99515, psi2 -> -1.22627, psi1 -> 1.68803, phi -> 0.0618559,
Sin[psi1] -> -0.993136, Cos[psi1] -> -0.116967,
Sin[psi2] -> -0.941237, Cos[psi2] -> 0.337748, Sin[phi] -> 0.0618165,
Cos[phi] -> 0.998088}, {h -> -1.99515, psi2 -> 1.22627,
psi1 -> -1.68803, phi -> 0.0618559, Sin[psi1] -> -0.993136,
Cos[psi1] -> -0.116967, Sin[psi2] -> -0.941237,
Cos[psi2] -> 0.337748, Sin[phi] -> 0.0618165, Cos[phi] -> 0.998088}


,

I do not understand why both psi1 and Cos[psi1] are returned, with Sin[1.68803] actually not equal to 0.993136 (the sign is different)

-
I don't get the Sin[...], Cos[...] bits (on version 9). – b.gatessucks Dec 17 '12 at 6:29
Good to know (I am using version 7). And do you get the wrong solutions (which do not satisfy the original equations) or no? – Fabio Dalla Libera Dec 17 '12 at 6:32
Yes I do and I think it's fair as NSolve is not the right tool as stated in the documentation and the warnings. Why not using FindRoot ? – b.gatessucks Dec 17 '12 at 6:34
Sorry, on v.7 I do not get the warning either. The reason is that I want all the real roots, and not just one – Fabio Dalla Libera Dec 17 '12 at 6:38

I would use FindRoot rather than NSolve for your problem (this is on version 7):

sol = NSolve[N[fsys], {phi, h, psi1, psi2}, WorkingPrecision -> 100];
fsys /. sol
(* {{False, True, False, False}, {False, True, True, False},
{False, False, False, False}, {False, False, False, False},
{True, True, False, False}, {True, False, False, False}} *)


but

sol2 = FindRoot[fsys, {{phi, 0.5}, {h, 0.21}, {psi1, 0.3}, {psi2, 0.4}},
WorkingPrecision -> 100];

fsys /. sol2
(* {True, True, True, True} *)

-