Search code examples
pythonscipydefaultode

How to find the default atol and rtol for scipy.integrate.ode?


How do I find the default parameters in scipy.integrate.ode? Specifically, atol and rtol in integrator dopri5? Parameters can be set with the set_integrator method, but I can’t see any way to query it find out what it’s been using if I do not set them.


Solution

  • As far as I can tell, the only way to find out is looking into the source. There, starting with lines 966 (as of now), you’ll find:

    class dopri5(IntegratorBase):
    
        […]
    
        def __init__(self,
                     rtol=1e-6, atol=1e-12,
                     nsteps=500,
                     max_step=0.0,
                     […]
                     ):
    

    So, dopri’s default absolute tolerance is 10⁻¹² and its default relative tolerance is 10⁻⁶. (Yes, this should be documented.)