1
$\begingroup$

I'm wondering why the following code

NDSolve[{y''[t] + y[t] == 0, y[0] == 1., y'[0] == 0}, y, {t, 0, 10}, 
WorkingPrecision -> 6]

throws the error/warning, that the precision of the ode (i.e. MachinePrecision) is less than WorkingPrecision, while

NDSolve[{y''[t] + y[t] == 0, y[0] == N[1, 6], y'[0] == 0}, y, {t, 0, 10}, 
WorkingPrecision -> 6]

doesn't, although 6 is smaller than MachinePrecision. Is there a good reason for this behaviour?

$\endgroup$
3
  • 2
    $\begingroup$ MachinePrecision is a separate type of precision than “arbitrary precision” (for which search the docs, if necessary). Some solvers treat MP as below arbitrary precision no matter what. The main difference is that arbitrary precision tracks an uncertainty bound. When the bound exceeds the point estimate for the number, the number is treated as equal to zero (within a certain uncertainty). I’m pretty sure in all solvers set the precision of the code passed to them to WorkingPrecision, and the message is just a warning. Some solvers DON’T check that the code actually computes in WP. $\endgroup$
    – Michael E2
    Aug 2, 2021 at 14:04
  • 1
    $\begingroup$ The reason for the warning (imo) is that the input represents one desire of the user and the WorkingPrecision represent a different one: MP = fast, native FP; no error tracking. WP -> 6 = slower, software FP; but with error tracking. $\endgroup$
    – Michael E2
    Aug 2, 2021 at 14:08
  • 2
    $\begingroup$ From doc "MachinePrecision is considered smaller than any explicit precision." Whereas, N[1, 6] is an arbitrary-precision number with precision of 6. $\endgroup$
    – Bob Hanlon
    Aug 2, 2021 at 14:43

0

Your Answer

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