7
$\begingroup$

I recently got an update to Mathematica Version 11.0.1 (Linux 3.10.0-327.36.3.el7.x86_64, RHEL 7.2, Lustre 2.5.42.8.ddn5), and run some test routines to check, if my Mathematica packages are still compatible with the newest version. During the test, I encountered the following strange result:

In[1]:= foc=(433 - 2*q[4])/10                                                                                                                                                                                                                                                   

        433 - 2 q[4]
Out[1]= ------------
            10

In[2]:= NSolve[foc==0,q[4]]                                                                                                                                                                                                                                                     

Out[2]= {{}}

In[3]:= Solve[foc==0,q[4]]                                                                                                                                                                                                                                                      

                  433
Out[3]= {{q[4] -> ---}}
                   2

In contrast, if I set, for instance,

In[10]:= NSolve[433/10==2/10*q[4],q[4]]                                                                                                                                                                                                                                         

Out[10]= {{q[4] -> 216.5}}

No effect, when I change $q[4]$ simply to $x$.

However, under Mathematica Version 10.3.1 I get the correct result

In[2]:= NSolve[foc==0,q[4]]                                                                                                                                                                                                                                                      

Out[2]= {{q[4] -> 216.5}}

Can anybody reproduce the above strange result? How to fix it?

$\endgroup$
  • 1
    $\begingroup$ I can reproduce it on Mac too, setting WorkingPrecision -> \[Infinity] fixes this. Also changing any number to real or specifying the Reals domain. $\endgroup$ – swish Dec 23 '16 at 18:11
  • 2
    $\begingroup$ A better bug representation would be just NSolve[2 x == 0, x] $\endgroup$ – swish Dec 23 '16 at 18:22
  • 3
    $\begingroup$ This is a bug that will be fixed in the 11.1 release. More details in my post here. $\endgroup$ – ilian Dec 23 '16 at 18:43
6
$\begingroup$

I am running V11.0.1 on OS X 10.10.2 (Yosemite). I can confirm that something strange is going on with NSolve with a much simpler example than the one given in the question.

NSolve[4 x - 3 == 0, x]

{{x -> 0.75}}

However, neither of the following work

NSolve[(4 x - 3)/2 == 0, x]

{{}}

and

NSolve[(4 x - 3)/2. == 0, x]

{{}}

while all these work.

NSolve[Expand[(4. x - 3)/2] == 0, x]

{{x -> 0.75}}

NSolve[Expand[(4 x - 3)/2.] == 0, x]

{{x -> 0.75}}

NSolve[(4 x - 3)/2 == 0., x] 

{{x -> 0.75}}

NSolve[(4 x - 3)/2 == 0, x, Reals]

{{x -> 0.75}}

I say it looks like a bug, walks like a bug, and quacks like a bug, so let's call it a bug.

Update

I reported this issue to Wolfram tech support and received a reply. I quote the relevant portions thereof.

I have confirmed the behavior you are observing with NSolve not being able to find the roots in the example you have provided. I have filed a report with our developers regarding this issue and include the example you have provided. Thank you for bringing this to our attention.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.