6

Running Mathematica 8.0.4 and 10.0.0 on a Windows 8.1 machine. Processed the same code with both kernels:

k = .2; NSolve[Rationalize[2 r^2 - .2 r^(k + 2) - 1 == 0], r, Reals]

The version 8 kernel returns two values as expected:

{{r -> 0.742979}, {r -> 100000.}}

The version 10 kernel returns only the first value by default. The second value doesn't appear as a solution until setting WorkingPrecision to at least 28.

The same behavior occurs for other values of k: the version 10 kernel needs massaging to return values the version 8 kernel finds by default. What would cause this?

Paul Masson
  • 391
  • 3
  • 8

2 Answers2

5

The equation is numerically unstable. The second root is not valid at machine precision so is rejected. Higher precision is required to arrive at a valid second root. Use Solve to see exact solutions as root objects. Then use higher precision when converting root objects to numbers.

k = .2;
eqn = Rationalize[2 r^2 - .2 r^(k + 2) - 1 == 0];
sol = Solve[eqn, r, Reals]

{{r -> Root[5 - 10 #1^10 + #1^11 &, 2]^5}, {r -> Root[5 - 10 #1^10 + #1^11 &, 3]^5}}

eqn /. sol // FullSimplify

{True, True}

soln = sol // N[#, 30] &

{{r -> 0.742978680869997548585535979527}, {r -> 99999.9999749999999899999999927}}

eqn /. soln

{True, True}

eqn[[1]] /. soln

{0.*10^-30, 0.*10^-20}

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
  • $MachinePrecision has the same default value for both versions. If it is a matter of rejecting a solution at machine precision, then why doesn't that occur in version 8? I've also verified that the current version 9 CDF Player does not reject the second solution at default machine precision. The question remains as to why version 10 is behaving differently. – Paul Masson Jul 21 '14 at 19:14
  • I don't know but in both V8 and V10 the VerifySolutuons option for Solve default is Automatic (presumably neither always True nor always False). Perhaps the "automatic" setting for V10 checked whereas V8 didn't. – Bob Hanlon Jul 21 '14 at 20:06
  • 1
    Correction to above since you used NSolve. In V8 NSolve does not have a VerifySolutions option whereas in V10 it does. In V10 VerifySolutuons option for NSolve default is Automatic. Presumably it decided to check. – Bob Hanlon Jul 21 '14 at 20:17
4

Wolfram support has confirmed to me that there is a known problem with NSolve in version 10. Hopefully it will be fixed soon.

Paul Masson
  • 391
  • 3
  • 8