42
$\begingroup$

I'm trying to understand exactly what WorkingPrecision, AccuracyGoal and PrecisionGoal mean for the result of NDSolve.

I presume WorkingPrecision simply means the number of decimal places used internally by Mathematica at various points throughout the calculation on its scratchpad, and therefore essentially gives upper limit to what the accuracy/precision of final result can be.

Now I understand Accuracy/Precision somewhat in the lab sense (Accuracy is how close you are to the true value, Precision is how repeatable the value you get is in some sense; or to use the dartboard analogy-if you're near the bullseye that's accurate-if you hit the the outskirts in the same place 100 times that's precise but not accurate), but not sure I know how these correlate to the Mathematica concepts...

If I set AccuracyGoal->3, PrecisionGoal->4 in NDSolve, what does that say about the function I get spat out? It looks like the definition on the help pages is that AccuracyGoal of 3 would mean 3 significant figures are correct, whereas PrecisionGoal of 4 would give 4 digits after the decimal are correct... e.g if the answer spat out is $89.7895$. What does it mean though in this case to say 3 significant figs are correct, but 4 digits after decimal place are also correct? Seems inconsistent (just a rule of thumb?).

The help pages also state:

With AccuracyGoal->a and PrecisionGoal->p, Mathematica attempts to make the numerical error in a result of size be less than $10^{-a}+|x|10^{-p}$

Does this mean if I did have AccuracyGoal->3, PrecisionGoal->4 and NDSolve spat out $89.7895$ the numerical error would be $10^{-3}+89.7895\cdot 10^{-4}=0.0997895$ ? so my answer is really $89.7895\pm 0.0997895$ ? or is there a different definition of numerical error here?

Thanks for any clarifications.

$\endgroup$
2
  • $\begingroup$ there is an answer here that is related (but does not answer your particular question) $\endgroup$
    – acl
    Aug 6, 2012 at 17:00
  • $\begingroup$ This is a very nice question! $\endgroup$
    – Leo Fang
    Jul 22, 2013 at 14:08

1 Answer 1

8
$\begingroup$

Regarding your last question: in the docs for FindRoot it says that

FindRoot continues until either of the goals specified by AccuracyGoal or PrecisionGoal is achieved.

The same thing is mentioned in the docs for NMinimize.

On the other hand, the docs for NDSolve say

AccuracyGoal effectively specifies the absolute local error allowed at each step in finding a solution, while PrecisionGoal specifies the relative local error.

and also

NDSolve adapts its step size so that the estimated error in the solution is just within the tolerances specified by PrecisionGoal and AccuracyGoal.

So we are reduced to trying to work out whether "and" really means "and" in which case it'll try to satisfy both, or if it behaves like FindRoot.

(this is more of a comment than an answer, but it's too long)

$\endgroup$
3
  • 1
    $\begingroup$ I'll erase this in an hour or so when I know that you have seen it (as I said it's an overlong comment) $\endgroup$
    – acl
    Aug 6, 2012 at 17:30
  • 3
    $\begingroup$ Don't delete it! I found it very educational, even if it does not answer the question explicitly. $\endgroup$
    – Thomas
    Aug 7, 2012 at 10:37
  • 1
    $\begingroup$ Yes this is nice to know, thanks, but still wondering about a lot of things, if anyone out there can say more. $\endgroup$
    – fpghost
    Aug 8, 2012 at 11:08

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.

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