Reputation: 493
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.
Upvotes: 2
Views: 2050
Reputation: 2471
Looking at the source for ode() it looks like the integrator of an ode that you have instantiated can be inspected by doing the following for example:
r = ode(f)
print('atol:', r._integrator.atol)
print('rtol:', r._integrator.rtol)
Upvotes: 4
Reputation: 4415
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.)
Upvotes: 4