AbsTol, RelTol
212 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Richard
el 2 de Abr. de 2012
Comentada: jin wang
el 11 de En. de 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.
0 comentarios
Respuesta aceptada
Jan
el 2 de Abr. de 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.
3 comentarios
Jan
el 3 de Abr. de 2012
The accuracy can and should, actually *must*, be tested by a variation of the initial conditions and parameters. E.g. if you simulate a pen standing on its tip, using [0,0,0, 0,0,0] as initial position and velocity is meaningless, because [0,0,eps, 0,0,0] and [0,0,-eps, 0,0,0] will lead to totally different final positions. This is called an instable system. Such a variation of the inputs is either done externally by starting the integrator repeatedly under the rough assumption, that the coordinates are independent from each other. Another approach would be to calculate the accumulated Wronski matrix, this means calculating the sensitivity to the inputs in each step of the integration and multiply the matrices. The later is more accurate, because it considers instabilities at intermediate points also. E.g. the simulation of a Galton box http://en.wikipedia.org/wiki/Bean_machine is junk without considering the possible collisions.
Currently Matlab's integrators do not accumulate the Wronski matrix, as far as I know. Although it is easy to modify e.g. ODE45, the mathematical background is not trivial: The width of the variation is critical. For a valid estimation of the optimal width (for each direction!), you need the 3rd derivatives, or in other word an analysis of the variation of the variation. Unfortunately such an analysis is very expensive and the run time explodes with the number of dimensions of the trajectory. Therefore it is recommended to approximate the optimal width only and use it for a certain number of steps. Good approximations and the determination of a sufficient number of steps are subject of ongoing numerical projects.
Therefore I suggest to start with an external variation.
You can ask Google for "internal numerical differentiation".
jin wang
el 11 de En. de 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.
Más respuestas (1)
Tony Castillo
el 18 de En. de 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?
0 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!