Is this a mistake in NSolve in math?

One could expect and hope that if you ask to Mathematicafind the roots of the polynomial, it should give the same (approximate) answers, do you do it symbolically, then find numerical approximations for these exact answers or do you do it numerically. Here is an example that (in Mathematica 7, running on OS X) where this fails:

poly = -112 + 1/q^28 + 1/q^26 - 1/q^24 - 6/q^22 - 14/q^20 - 25/q^18 -
  38/q^16 - 52/q^14 - 67/q^12 - 81/q^10 - 93/q^8 - 102/q^6 - 108/
  q^4 - 111/q^2 - 111 q^2 - 108 q^4 - 102 q^6 - 93 q^8 - 81 q^10 -
  67 q^12 - 52 q^14 - 38 q^16 - 25 q^18 - 14 q^20 - 6 q^22 - q^24 +
  q^26 + q^28;

Total[q^4 /. NSolve[poly == 0, q]] - Total[q^4 /. N[Solve[poly == 0, q]]]

(Note: this is actually a Laurent polynomial, and if you multiply by more power q, the problem goes away.)

The last line is just a demonstration that the solutions found are very different; this is actually the amount we were trying to calculate in the problem we were working on.

If you look closely at the result NSolve[poly == 0, q]and N[Solve[poly == 0, q], you will see that NSolve gives only roots 54instead of what is expected 56. It is not that he simply missed the repeated root or something else; it misses the two largest roots in size (approximately +/- 1.59)

Is this a mistake in Mathematica? Does anyone explain why this is happening?

+3
source share
1 answer

Unfortunately, your expectations are unfounded.

, Solve[] , N[] , , . NSolve[], , get go , , .

, , , (. ). , NSolve[] , :

In[1]  := Total[q^4 /. NSolve[poly == 0, q, WorkingPrecision -> 50]] - 
          Total[q^4 /. N[Solve[poly == 0, q]]]
Out[1] := 0. - 3.66374*10^-15 I

. .. .. , Mathematica , , WorkingPrecision .

+7

Source: https://habr.com/ru/post/1770243/


All Articles