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?
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 toWorkingPrecision
, and the message is just a warning. Some solvers DON’T check that the code actually computes in WP. $\endgroup$WorkingPrecision
represent a different one: MP = fast, native FP; no error tracking. WP -> 6 = slower, software FP; but with error tracking. $\endgroup$doc
"MachinePrecision is considered smaller than any explicit precision." Whereas,N[1, 6]
is an arbitrary-precision number with precision of6
. $\endgroup$