688 views (last 30 days)

Show older comments

I am trying to understand the following Matlab definitions for RelTol and AbsTol parameters:

RelTol — This tolerance is a measure of the error relative to the size of each solution component. Roughly, it controls the number of correct digits in all solution components, except those smaller than thresholds AbsTol(i).

The default, 1e-3, corresponds to 0.1% accuracy.

AbsTol — AbsTol(i) is a threshold below which the value of the ith solution component is unimportant. The absolute error tolerances determine the accuracy when the solution approaches zero.

I do not understand why AbsTol determines the accuracy when the solution approaches zero (indeed, if the solution of my problem is a circular orbit of 7000 km radius this does not meet) and why RelTol controls the number of correct digits in all solution components, except those smaller than thresholds AbsTol(i). I would like to have simpler and understandable definitions.

Jan
on 22 Jan 2012

The relative tolerance between two values X and Y is:

abs(X - Y) / min(abs(X), abs(Y))

But if X or Y becomes (near to) zero, the tolerance grows until infinity. Then the absolute tolerance is a better limit:

abs(X - Y)

[EDITED] The relative error "abs(X - Y) / min(abs(X), abs(Y))" determines the number of "equal digits" between X and Y, if X and Y are >> 1. Just try it:

abs(7000 - 6000) / min(abs(7000), abs(6000)) < 0.1 % FALSE

abs(7000 - 6900) / min(abs(7000), abs(6900)) < 0.1 % TRUE

abs(7000 - 6900) / min(abs(7000), abs(6900)) < 0.01 % FALSE

The term "equal digits" is not meant very strict here. This is more a rule of thumb.

But if you get near to zero, this measurement fails, because the division by a small number let explode distances. Then the absolute distance is applied as limit, because it is more likely to match the needs of the user.

Sometimes this method is applied to match large and small numbers:

abs(X - Y) / (1 + min(abs(X), abs(Y)))

[/EDITED]

But for real problems, neither the relative nor the absolute error are accurate in general:

There is no unique mathematically meaningful definition of "near to eachother" for two values. E.g. 1000001 and 1000000 can be assumed to be near to eachother using a relative tolerance. But 0.000001 and 1.000001 have the same distance and deciding if they are near or far apart depends on the physical definition of the value. If it is the temperature of water, the different values mean a totally different behaviour. If the values are the height of a measurement point relative to the sea level, measured in millimeter from a satellite, both values are almost equal.

In real scientific projects the metric used for the measurement of the local discretization error is very important. The integrator adjustes the step size to keep the local error under, but near to the specified tolerance. This sounds trivial, but imagine the simulation of the re-entrance of a spaceship and the trajectory is this vector:

y = [position; velocity; temperature inside; temperature surface]

While the temperature are relevant for the application, they do not influence the spacial motion of the body. In consequence the local error should not be controlled neither by relative or absolute tolerances of the temperatures! In addition it should not matter, if the position is measured in AU or meter, or relative to the sea level or to the center of the earth.

Conclusion: For an accurate integration the definition of the local error must consider the physical meaning of the components of the trajectory. Using AbsTol, RelTol and NormControl (see help odeset) is not powerful enough for an accurate integration. A better method is either a user-defined function to calculate a norm, or local scaling, which let all relevant values live near to 1.0.

Mike Hosea
on 23 Jan 2012

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!