# AbsTol, RelTol

247 views (last 30 days)
Richard on 2 Apr 2012
Commented: jin wang on 11 Jan 2018
In my understanding,
RelTol = abs(X-Y)/min(abs(X), abs(Y))
AbsTol = abs(X-Y)
But what does it mean when applied to ode45? Specifically what does it mean when we say
odeset('RelTol', 1e-3, 'AbsTol', 1e-4)
? Why is it necessary to set both RelTol and AbsTol? How does this influence the solution?I presume the smaller the Rel and Abs Tols the better the solution. But in what sense? In terms of precision or what? Also I presume setting the Rel and Abs Tols as above does not mean that the final solution only has error 1e-4, say? So what are we really doing? Is it right that the final solution's accuracy then depends on the program ode45 too?
Thank you.

Jan on 2 Apr 2012
The absolute tolerance of 1e-3 is meaningless, when the values are very small, e.g. 1.234e-27. Then the relative tolerance is more useful.
The precision of the result is IEEE-64bit double in every case, but the accuracy is influenced by the tolerances. The tolerances are used to limit the local discretization error: If the difference between a high-accuracy and low-accuracy integration is higher than one of the tolerances, the step size is reduced.
If the tolerance is too low, the large number of steps will increase the accumulated rounding errors, while for a to high tolerance the local discretization errors dominate the accuracy of the result.
jin wang on 11 Jan 2018
Let's say the tolerance I am using is for searching the minimum value of a returned value from optimization function.
I have stated the tolerance inside fminsearch function as options argument. How can I know the value I set is relative or absolute tolerance? How can I set a relative tolerance? since I don't know if the auto tolerance setting updates in 2017a onwards has affected fminsearch or not.

### More Answers (1)

Tony Castillo on 18 Jan 2016
Hello how can I b) reducing the ode15s solver RelTol parameter so that the solver takes smaller time steps.???, i have an issue with it. Can you help me?