pymgipsim.ODESolvers.ode_solvers¶
Created on Thu May 11 23:08:31 2023
@author: Andy
Functions
Performs a single step of the Euler method for solving ordinary differential equations. |
|
Performs a single step of the Runge-Kutta 4th order (RK4) method for solving ordinary differential equations. |
- euler_single_step(f, h, initial, time, parameters, inputs)[source]¶
Performs a single step of the Euler method for solving ordinary differential equations.
Parameters: - f: callable
Function representing the ODE system. Should take (state, time, parameters, inputs) as arguments.
- h: float
Step size for the RK4 method.
- initial: np.ndarray
Initial state vector of the system.
- time: float
Current time.
- parameters: tuple or dict
Parameters needed for the ODE system.
- inputs: tuple or dict
External inputs to the ODE system.
Returns: - np.ndarray
Updated state vector after a single Euler step.
- rk4_single_step(f, h, initial, time, parameters, inputs)[source]¶
Performs a single step of the Runge-Kutta 4th order (RK4) method for solving ordinary differential equations.
Parameters: - f: callable
Function representing the ODE system. Should take (state, time, parameters, inputs) as arguments.
- h: float
Step size for the RK4 method.
- initial: np.ndarray
Initial state vector of the system.
- time: float
Current time.
- parameters: tuple or dict
Parameters needed for the ODE system.
- inputs: tuple or dict
External inputs to the ODE system.
Returns: - np.ndarray
Updated state vector after a single RK4 step.