6
$\begingroup$

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?

$\endgroup$
5
  • $\begingroup$ Win7,10.0.0,give two solutions,0.742979 and 100000. $\endgroup$
    – Apple
    Commented Jul 20, 2014 at 6:01
  • $\begingroup$ 100000 is not a solution. You are experiencing numerical issues. $\endgroup$
    – Mike Z.
    Commented Jul 20, 2014 at 12:20
  • $\begingroup$ This is closely related: Issue with NSolve $\endgroup$
    – Artes
    Commented Jul 20, 2014 at 15:44
  • $\begingroup$ When using VerifySolutions -> False, it gives three, one wrong. $\endgroup$
    – Szabolcs
    Commented Jul 20, 2014 at 16:56
  • $\begingroup$ @Chenminqi did you get this result with a default installation or have you made configuration changes that would affect precision? $\endgroup$ Commented Jul 21, 2014 at 19:10

2 Answers 2

5
$\begingroup$

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}

$\endgroup$
3
  • $\begingroup$ $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. $\endgroup$ Commented Jul 21, 2014 at 19:14
  • $\begingroup$ 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. $\endgroup$
    – Bob Hanlon
    Commented Jul 21, 2014 at 20:06
  • 1
    $\begingroup$ 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. $\endgroup$
    – Bob Hanlon
    Commented Jul 21, 2014 at 20:17
4
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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