1

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 π)/45] - (3 Cos[ψ1])/4 - 2/3 Sin[φ + π/6] == 0, h + 2/3 Cos[φ + π/6] + Sin[(11 π)/45] - (3 Sin[ψ1])/4 == 0, -0.0436952 - (3 Cos[ψ2])/4 - 2/3 Sin[φ - π/6] == 0,2/5 + h + 2/3 Cos[φ - π/6] + Sin[(17 π)/180] - (3 Sin[ψ2])/4 == 0}

NSolve[N[fsys], {φ, h, ψ1, ψ2}, WorkingPrecision -> 100]

The second solution returned is

    {h -> -1.99515, ψ2 -> -1.22627, ψ1 -> 1.68803, φ -> 0.0618559,
Sin[ψ1] -> -0.993136, Cos[ψ1] -> -0.116967, 
 Sin[ψ2] -> -0.941237, Cos[ψ2] -> 0.337748, Sin[φ] -> 0.0618165,
  Cos[φ] -> 0.998088}, {h -> -1.99515, ψ2 -> 1.22627, 
 ψ1 -> -1.68803, φ -> 0.0618559, Sin[ψ1] -> -0.993136, 
 Cos[ψ1] -> -0.116967, Sin[ψ2] -> -0.941237, 
 Cos[ψ2] -> 0.337748, Sin[φ] -> 0.0618165, Cos[φ] -> 0.998088}

,

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

Fabio Dalla Libera
  • 529
  • 1
  • 3
  • 11

1 Answers1

2

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} *)
b.gates.you.know.what
  • 20,103
  • 2
  • 43
  • 84