Function solveODE #

Numerical Integration of Ordinary Differential Equations

Two variable step methods are provided:

The arguments are expected as follows.

The returned value is an object with {t, y} please note that even though t means time, it can represent any other independant variable like x:

Syntax #

math.solveODE(func, tspan, y0)
math.solveODE(func, tspan, y0, options)

Parameters #

Parameter Type Description
func function The forcing function f(t,y)
tspan Array | Matrix The time span
y0 number | BigNumber | Unit | Array | Matrix The initial value
options Object Optional configuration options

Returns #

Type Description
Object Return an object with t and y values as arrays

Throws #

Type | Description —- | ———–

Examples #

function func(t, y) {return y}
const tspan = [0, 4]
const y0 = 1
math.solveODE(func, tspan, y0)
math.solveODE(func, tspan, [1, 2])
math.solveODE(func, tspan, y0, { method:"RK23", maxStep:0.1 })

See also #

derivative, simplifyCore

Fork me on GitHub