4
$\begingroup$

The help of Mathematica doesn't say so much about the PrecisionGoal for NDSolve, and I never considered much about it even after I met the warning message

NDSolve::eerr

for several times when I was trying to solve a set of PDEs these days: every time I met it I would simply considered it as a proof for the defect of my assumption for the initial or boundary condition, and my resolution strategy for it is to modify the conditions or sometimes I will also lower the value of the PrecisionGoal as the help says.

However, this time I can't ignore it anymore, for I accidentally found that for one of my assumptions, the suitable PrecisionGoal for it is a negative integer…

The thing named "Precision" in my mind was always a positive integer, but this time it is negative! Why?…… What's the exact effect of "PrecisionGoal" option for NDSolve?

$\endgroup$

1 Answer 1

9
$\begingroup$

If you look at the documentation for Precision, it says that if x is the value and dx the "absolute uncertainty", Precision[x] is -Log[10,dx/x]. This, whenever the estimated error is larger than the value, Mathematica will give a negative precision.

Thus, for an estimated error $dx$ and a value $x$ such that $dx/x<1$ here is how the precision as defined above looks like:

Mathematica graphics

You see that it is really the number of digits in the ratio of the error to the value. If the error $dx>x$ then the log is negative:

Mathematica graphics

Accuracy is probably closer to what you have in mind: it's basically to the number of effective digits in the number, as it is -Log[10,dx]. If $dx>1$, it can be negative, indicating that a number of digits to the left of the decimal point is incorrect (and of course, it can be non-integer just like the precision). If you really want the number of digits, take the integer part (or round it).

About the last bit of the question, ie, "what does PrecisionGoal option for NDSolve do?", I think the above plus the explanation in the docs covers it: it specifies the precision (as defined above) to be sought in the solution.

$\endgroup$
6
  • $\begingroup$ Hey, it's you! So, is this site the "best place" you mentioned there? Then, thank you for your answer! Well, I really don't expect that Precision and Accuracy in Mathematica are defined with logarithm. (By the way, are you sure this is explicitly mentioned in the help? ) Huh…so, I still have a lot to do to modify my equation…maybe I will post another related question later… $\endgroup$
    – xzczd
    Aug 2, 2012 at 12:50
  • $\begingroup$ It's mentioned under More Information (click on the yellow box to open it). About the log, if you look at the plots, you'll notice that it reduces to exactly what you'd expect if I fix eg dx/x to be exactly 0.01 (ie, it's 2 then). About the "best place" thing, I meant that this is really a general question about putting things in dimensionless form; I talked a little about this here. But in general I guess some sort of math site would be better for that (it's not a Mathematica question really) $\endgroup$
    – acl
    Aug 2, 2012 at 13:00
  • $\begingroup$ Hehe…I've read the link carefully and now I'm sure that my understanding for dimensionless variable has nothing wrong and my question there has nothing to do with it. As I mentioned there, all the numbers and variables are in terms of SI units, i.e. they're already equal to dimensionless, and, what puzzled me in that question is the slight but unreasonable fluctuation of temperature when compared with the initial value which is correctly presented in the same graph. $\endgroup$
    – xzczd
    Aug 2, 2012 at 13:57
  • 1
    $\begingroup$ No, if they are in SI units they're not dimensionless. $\endgroup$
    – acl
    Aug 2, 2012 at 14:07
  • $\begingroup$ No, they're certainly dimensionless as every formula has the same unit, it's then equivalent to dimensionless, for example, Solve[(s == 2 v) /. s -> 6, {v}],now I know that s has the unit m, 2 has the unit s and v has the unit m/s , so after I set s as 6 and solve the equation, though I only get v->3 I will still know the unit of 3 is m/s. $\endgroup$
    – xzczd
    Aug 2, 2012 at 14:22

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.