Initialize a new system of differential equations.
The number of equations in this system
Set a differential equation for a specific dimension. All differential equations must be set before solving.
The 0-indexed dimension number to set the equation for
The differential equation for this dimension must accept a global state vector ordered by dimension and derivative order
x, dx/dt, ..., d(i-1)x/dt(i-1),
y, dy/dt, ..., d(j-1)y/dt(j-1),
z, dz/dt, ..., d(k-1)z/dt(k-1),
... (higher dimensions)
Where i is the highest order of x (dimension 0), j is the highest order of y (dimension 1) and k is the highest order of z (dimension 2)
Initial conditions for this dimension, ordered x, dx/dt, ..., d(n-1)x/dt(n-1)
const sigma = 1;
const rho = 1;
const beta = 8 / 3;
const dx = (t, x, y, z) => sigma * (y - x);
const dy = (t, x, y, z) => x * (rho - z) - y;
const dz = (t, x, y, z) => x * y - beta * z;
system.setEquationFor(0, dx, 10); // x0 = 10
system.setEquationFor(1, dy, 10); // y0 = 10
system.setEquationFor(2, dz, 10); // z0 = 10
Solve this system of differential equations from t=0 to t=tf with timestep dt.
The timestep
The final time
Square array with the first index being the 0-indexed dimension and second index being the time index, each entry contains the timestamp and all orders of derivatives
Represents a system of differential equations.