Absolute and relative tolerance definitions
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.
Accepted Answer
More Answers (1)
Mike Hosea
on 23 Jan 2012
3 votes
The numerical method works with an error estimate, i.e. it computes an approximation for abs(x-x0), where x is the approximate solution and x0 is the exact solution. Let's call the error estimate E. The code will try to meet E < max(abstol,reltol*abs(x)). When abs(x) is larger than abstol/reltol, then only the relative error tolerance is important, so you are asking that E/abs(x) < reltol. E/abs(x) is an approximation of the relative error abs(x-x0)/abs(x0). So you essentially control the number of significant digits, as you have noted. However, when abs(x) is smaller than abstol/reltol, only the absolute error tolerance is used, so the error test in that case is E < abstol, which is approximately abs(x-x0) < abstol. Since relative error is undefined when the true solution is zero, you have to switch over to something besides relative error control when the solution component gets small. E.g. if x0 = 0, the approximation x = realmin has no correct significant digits, nary a one.
3 Comments
Mike Hosea
on 23 Jan 2012
BTW, what is "small" depends on the scaling of the component. Quite generally, near zero results arise from cancellation, and the absolute tolerance that makes sense depends on the sizes of the numbers before cancellation. If a solution component is scaled small, e.g. around 1e-20, and stays in that range, then presumably you can set abstol(i) for that component to 1e-26 to get about 6 digits of accuracy. However, this will probably be impossible if the small value of this component arises because much larger numbers cancel.
Jan
on 23 Jan 2012
@Mike: Exactly. See my example of the supertanker: If the height is measured from the center of earth, the relative error determines the correct number of digits. If it is measured from the sea-level (cancellation!), the absolute error is required. +1
Julián Francisco
on 24 Jan 2012
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!