pygslodeiv2 package¶
Python binding for odeiv2 in GNU Scientific Library (GSL).
-
pygslodeiv2.
integrate_adaptive
(rhs, jac, y0, x0, xend, atol, rtol, dx0=0.0, dx_min=0.0, dx_max=0.0, method='bsimp', nsteps=500, check_callable=False, check_indexing=False, autorestart=0, return_on_error=False, cb_kwargs=None, \*\*kwargs)[source]¶ Integrates a system of ordinary differential equations (solver chosen output).
- Parameters
- rhscallable
Function with signature f(t, y, fout) which modifies fout inplace.
- jaccallable
Function with signature j(t, y, jmat_out, dfdx_out) which modifies jmat_out and dfdx_out inplace.
- y0array_like
initial values of the dependent variables
- x0float
initial value of the independent variable
- xendfloat
stopping value for the independent variable
- atolfloat
absolute tolerance
- rtolfloat
relative tolerance
- dx0float
initial step-size
- dx_minfloat
minimum step (default: 0.0)
- dx_maxfloat
maximum step (default: 0.0)
- methodstr
- One of: ‘rk2’, ‘rk4’, ‘rkf45’, ‘rkck’, ‘rk8pd’, ‘rk1imp’,
‘rk2imp’, ‘rk4imp’, ‘bsimp’, ‘msadams’, ‘msbdf’
- nstepsint
maximum number of steps (default: 500)
- check_callablebool (default: False)
perform signature sanity checks on
rhs
andjac
- check_indexingbool (default: False)
perform item setting sanity checks on
rhs
andjac
.- autorestartint
Autorestarts on error (requires autonomous system).
- return_on_errorbool
Instead of raising an exception return silently (see info[‘success’]).
- record_rhs_xvalsbool
When True: will return x values for rhs calls in
info['rhs_xvals']
.- record_jac_xvalsbool
When True will return x values for jac calls in
info['jac_xvals']
.- record_orderbool
When True will return used time stepper order in
info['orders']
.- record_fpebool
When True will return observed floating point errors in
info['fpes']
. (seefpes
)- cb_kwargs: dict
Extra keyword arguments passed to
rhs
,jac
and possiblydx0cb
.- dx0cbcallable
Callback for calculating dx0 (make sure to pass dx0==0.0) to enable. Signature:
f(x, y[:]) -> float
.- dx_max_cb: callable
Callback for calculating dx_max. Signature:
f(x, y[:]) -> float
.
- Returns
- (xout, yout, info):
xout: 1-dimensional array of values for the independent variable yout: 2-dimensional array of the dependent variables (axis 1) for
values corresponding to xout (axis 0)
info: dictionary with information about the integration
-
pygslodeiv2.
integrate_predefined
(rhs, jac, y0, xout, atol, rtol, dx0=0.0, dx_min=0.0, dx_max=0.0, method='bsimp', nsteps=500, check_callable=False, check_indexing=False, autorestart=0, return_on_error=False, cb_kwargs=None, \*\*kwargs)[source]¶ Integrates a system of ordinary differential equations (user chosen output).
- Parameters
- rhscallable
Function with signature f(t, y, fout) which modifies fout inplace.
- jaccallable
Function with signature j(t, y, jmat_out, dfdx_out) which modifies jmat_out and dfdx_out inplace.
- y0array_like
initial values of the dependent variables
- xoutarray_like
values of the independent variable
- atolfloat
absolute tolerance
- rtolfloat
relative tolerance
- dx0float
initial step-size
- dx_minfloat
minimum step (default: 0.0)
- dx_maxfloat
maximum step (default: 0.0)
- methodstr
One of: ‘rk2’, ‘rk4’, ‘rkf45’, ‘rkck’, ‘rk8pd’, ‘rk1imp’, ‘rk2imp’, ‘rk4imp’, ‘bsimp’, ‘msadams’, ‘msbdf’.
- nstepsint
maximum number of steps (default: 500).
- check_callablebool
perform signature sanity checks on
rhs
andjac
.- check_indexingbool
perform item setting sanity checks on
rhs
andjac
.- autorestartint
Autorestarts on error (requires autonomous system).
- return_on_errorbool
Instead of raising an exception return silently (see info[‘success’] & info[‘nreached’]).
- record_rhs_xvalsbool
When True: will return x values for rhs calls in
info['rhs_xvals']
.- record_jac_xvalsbool
When True will return x values for jac calls in
info['jac_xvals']
.- record_orderbool
When True will return used time stepper order in
info['orders']
.- record_fpebool
When True will return observed floating point errors in
info['fpes']
. (seefpes
)- cb_kwargsdict
Extra keyword arguments passed to
rhs
andjac
.- dx0cbcallable
Callback for calculating dx0 (make sure to pass dx0==0.0) to enable. Signature:
f(x, y[:]) -> float
.- dx_max_cb: callable
Callback for calculating dx_max. Signature:
f(x, y[:]) -> float
.
- Returns
- (result, info):
- result: 2-dimensional array of the dependent variables (axis 1) for
values corresponding to xout (axis 0)
info: dictionary with information about the integration