Version 7 and 8, different behavior of NSolve. Is it reproducible?

2

I noticed the following difference, and I wonder if it's a problem of my system or the results difference is actually due to the two different versions

oldsa = {0.29289321881345254` - 
    0.6666666666666666` Sin[0.5235987755982988` + phi] == 
   0.75` Cos[psi1], -0.7071067811865475` + h + 
    0.6666666666666666` Cos[0.5235987755982988` + phi] == 
   0.75` Sin[psi1], -0.5` + 
    0.6666666666666666` Sin[0.5235987755982988` - phi] == 
   0.75` Cos[psi2], -0.4660254037844386` + h + 
    0.6666666666666666` Cos[0.5235987755982988` - phi] == 
   0.75` Sin[psi2]}

NSolve[oldsa, {h, phi, psi1, psi2}]

gives solutions in Mathematica version 7, and no solution in ver. 8 Both run on Ubuntu 12.04 x64 Do you get the same resuts?

Fabio Dalla Libera

Posted 2012-12-20T11:21:04.783

Reputation: 509

2Yes, I find the same issue, it works in ver.7 and ver.9 yielding a list of 24 solutions and also this message : NSolve::ifun: Inverse functions are being used by NSolve, so some solutions may not be found; use Reduce for complete solution information. >> but it does not work in ver.8 i.e. it yields {}. – Artes – 2012-12-20T11:38:17.557

Haha not only that, but, in v8, if you apply the replacement rule /. 0.5235987755982988\ -> π/6` it DOES produce a solution – gpap – 2012-12-20T11:50:43.843

1Confirming. Solution in 7 on Linux and no solution in 8.0.4 on Windows. – Andreas Lauschke – 2012-12-20T11:59:17.493

@Artes Well, in my v8, if you define oldsa2 = oldsa/. 0.5235987755982988\ -> π/6(i.e. copy-paste the numerical value from within the trig functions and replace it with its symbolic equivalent), thenNSolve[oldsa, {h, phi, psi1, psi2}]gives{}andNSolve[oldsa2, {h, phi, psi1, psi2}]` gives a list of solutions of length 24! – gpap – 2012-12-20T12:57:16.033

To all the commenters, thank you guys – Fabio Dalla Libera – 2012-12-20T13:09:09.070

@gpap Indeed, there has been a wrong imput, so +1 for the answer. – Artes – 2012-12-20T15:27:58.103

Answers

1

Just adding to how strange this is in version 8 where the code below has been tested.

First, observe that the numerical value within the trigonometric function (0.523599) is $ \pi/6 $:

0.5235987755982988`== π/6

gives

True

Now, as above, define the equation to solve

oldsa = {0.29289321881345254` - 
0.6666666666666666` Sin[0.5235987755982988` + phi] == 
0.75` Cos[psi1], -0.7071067811865475` + h + 
0.6666666666666666` Cos[0.5235987755982988` + phi] == 
0.75` Sin[psi1], -0.5` + 
0.6666666666666666` Sin[0.5235987755982988` - phi] == 
0.75` Cos[psi2], -0.4660254037844386` + h + 
0.6666666666666666` Cos[0.5235987755982988` - phi] == 
0.75` Sin[psi2]}

and a version of it with the numerical value of $ \pi/6 $ replaced by the symbolic π/6, i.e.

oldsaSymbolic = oldsa/. 0.5235987755982988` -> π/6

Indeed,

NSolve[oldsa, {h, phi, psi1, psi2}] 

gives

{}

But

NSolve[oldsaSymbolic, {h, phi, psi1, psi2}]

gives 24 solutions!?!

gpap

Posted 2012-12-20T11:21:04.783

Reputation: 9 237