[SciPy-User] Error estimation when using solve_ivp

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] Error estimation when using solve_ivp

lingxz1
Hi, 

I would like to get an error estimate on my results from `scipy.integrate.solve_ivp`. I am using it to solve a few differential equations, and using the its root-finding capabilities to get the coordinates when an event happens. This is all good, but I'm not sure how to put an error estimate on my result. 

I have an idea of how to estimate the global error of a Runge Kutta method with a fixed step size, but it seems `solve_ivp` uses adaptive step sizes. It would be great if someone who has experience with this could point me in the right direction. I don't exactly need a highly rigorous estimation of the error, just a rough upper bound will do. 

Thanks! 
Lingyi

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Error estimation when using solve_ivp

Nicolas Cellier
Usually the Runge kutta method has an error estimate built-in. It may be possible to have access to it, or to build a child class based on the default RK solver used in the ivp_solve that expose that error.
Le 1 avr. 2018, à 22:10, Lingyi Hu <[hidden email]> a écrit:
Hi, 

I would like to get an error estimate on my results from `scipy.integrate.solve_ivp`. I am using it to solve a few differential equations, and using the its root-finding capabilities to get the coordinates when an event happens. This is all good, but I'm not sure how to put an error estimate on my result. 

I have an idea of how to estimate the global error of a Runge Kutta method with a fixed step size, but it seems `solve_ivp` uses adaptive step sizes. It would be great if someone who has experience with this could point me in the right direction. I don't exactly need a highly rigorous estimation of the error, just a rough upper bound will do. 

Thanks! 
Lingyi


SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: Error estimation when using solve_ivp

David Hagen
In reply to this post by lingxz1
The adaptive solvers ensure that the error at each step is less than rtol in relative terms or atol in absolute terms. A conservative estimate of the total error in any states at the end would be these numbers times the number of steps required to solve the system. In my experience, this is a very rough estimate for adaptive solvers; so when I start working on a new problem, I typically run an example of the problem at a crazy strict tolerance (as low as will finish in reasonable time) and then compare these gold standard results to looser and looser tolerances so I have a better idea of how far off a less accurate solution actually is.

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/scipy-user