qiskit_dynamics.solvers.solve_ode#
- solve_ode(rhs, t_span, y0, method='DOP853', t_eval=None, **kwargs)[source]#
General interface for solving Ordinary Differential Equations (ODEs).
ODEs are differential equations of the form
\[\dot{y}(t) = f(t, y(t)),\]where \(f\) is a callable function and the state \(y(t)\) is an arbitrarily-shaped complex
Array.The
methodargument exposes a variety of underlying ODE solvers. Optional arguments for any of the solver routines can be passed viakwargs. Available methods are:scipy.integrate.solve_ivp- supports methods['RK45', 'RK23', 'BDF', 'DOP853', 'Radau', 'LSODA']or by passing a validscipyOdeSolverinstance.'RK4': A fixed-step 4th order Runge-Kutta solver. Requires additional kwargmax_dt, indicating the maximum step size to take. This solver will break integration periods into even sub-intervals no larger thanmax_dt, and step over each sub-interval using the standard 4th order Runge-Kutta integration rule.'jax_RK4': JAX backend implementation of'RK4'method.'jax_odeint': Callsjax.experimental.ode.odeintvariable step solver.diffrax.diffeqsolve- a JAX solver function, called by passingmethodas a validdiffrax.solver.AbstractSolverinstance. Requires thediffraxlibrary.
Results are returned as a
OdeResultobject.- Parameters:
rhs (
Union[Callable,BaseGeneratorModel]) – RHS function \(f(t, y)\).t_span (
Array) –Tupleorlistof initial and final time.y0 (
Array) – State at initial time.method (
Union[str,OdeSolver,TypeVar(AbstractSolver),None]) – Solving method to use.t_eval (
Union[List,Tuple,Array,None]) – Times at which to return the solution. Must lie withint_span. If unspecified, the solution will be returned at the points int_span.**kwargs – Additional arguments to pass to the solver.
- Returns:
Results object.
- Return type:
OdeResult
- Raises:
QiskitError – If specified method does not exist.