Skip to Content

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:

dydt=f(t,y)y(t0)=y0\frac{dy}{dt} = f(t, y) y(t_0) = y_0

Here, tt is a 1-D independent variable (time), y(t)y(t) is an N-D vector-valued function (state), and f(t,y)f(t, y) is an N-D vector-valued function that determines the differential equations. The goal is to find y(t)y(t) approximately satisfying the differential equations, given an initial value y(t0)=y0y(t_0)=y_0.

This function simplifies the f(t, y) callable by assuming a linear system of the form dy/dt=Aydy/dt = A \cdot y, where AA is a matrix provided as fun_coeffs. This means the right-hand side function f does not depend on tt 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 matrix A in the ODE system dy/dt = A @ y.
  • t_start (float, required): The initial time t0 for the integration interval.
  • t_end (float, required): The final time tf for the integration interval.
  • y_zero (2D list, required): A 2D list (column vector) representing the initial state y(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 within t_start and t_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 dy/dt=0.5ydy/dt = -0.5y with an initial condition y(0)=2y(0)=2. The solution is evaluated at specific time points.

Inputs:

Live Notebook

Edit this function in a live notebook.

Live Demo

Last updated on