SOLVE_IVP
Overview
The SOLVE_IVP
function numerically integrates a system of ordinary differential equations (ODEs) given an initial value. It is a wrapper around the scipy.integrate.solve_ivp
method, simplified for use in Excel.
The general form of an initial value problem for a system of ODEs is:
Here, is a 1-D independent variable (time), is an N-D vector-valued function (state), and is an N-D vector-valued function that determines the differential equations. The goal is to find approximately satisfying the differential equations, given an initial value .
This function simplifies the f(t, y)
callable by assuming a linear system of the form , where is a matrix provided as fun_coeffs
. This means the right-hand side function f
does not depend on explicitly and is linear in $y`. Only the most commonly used parameters are exposed.
For more details on the underlying Scipy function, refer to the official SciPy documentation .
This example function is provided as-is without any representation of accuracy.
Usage
To use the function in Excel:
=SOLVE_IVP(fun_coeffs, t_start, t_end, y_zero, t_eval, [method])
fun_coeffs
(2D list, required): A 2D list representing the matrixA
in the ODE systemdy/dt = A @ y
.t_start
(float, required): The initial timet0
for the integration interval.t_end
(float, required): The final timetf
for the integration interval.y_zero
(2D list, required): A 2D list (column vector) representing the initial statey(t0)
.t_eval
(2D list, required): A 2D list (column vector) of times at which to store the computed solution. Must be sorted and lie withint_start
andt_end
.method
(string, optional, default=‘RK45’): The integration method to use. Supported methods are ‘RK45’, ‘RK23’, ‘DOP853’, ‘Radau’, ‘BDF’, ‘LSODA’.
The function returns a 2D list (matrix) where the first column is the time points from t_eval
and subsequent columns are the corresponding values of the solution y
at those time points. Returns an error message (string) if inputs are invalid.
Examples
Example 1: Simple Exponential Decay
This example solves the simple exponential decay ODE with an initial condition . The solution is evaluated at specific time points.
Inputs:
Live Notebook
Edit this function in a live notebook .