The ordinary differential equation to solve.
Optionalatol?: numberAbsolute tolerance.
Optionalh0?: numberInitial step guess.
OptionalhMax?: numberMaximum step size magnitude.
OptionalhMin?: numberMinimum step size magnitude.
OptionalmaxSteps?: numberMaximum accepted+rejected iterations.
OptionalreturnObject?: booleanWhether to return yObj (same as Chalkboard.diff.solve).
Optionalrtol?: numberRelative tolerance.
Optionalt0?: numberInitial time.
Final time.
Initial state (same conventions as Chalkboard.diff.solve).
// Solve first-order ODE with adaptive RK45:
const ode1 = Chalkboard.diff.init((t, y) => -2 * y);
const sol1 = Chalkboard.diff.solveAdaptive(ode1, {
t0: 0, t1: 5,
y0: 1,
h0: 0.1,
hMin: 0.01,
hMax: 0.5
});
// Solve second-order ODE with adaptive RK45:
const ode2 = Chalkboard.diff.init((t, y, dy) => dy - y);
const sol2 = Chalkboard.diff.solveAdaptive(ode2, {
t0: 0, t1: 10,
y0: { y0: 1, dy0: 0 },
h0: 0.1,
hMin: 0.01,
hMax: 0.5,
returnObject: true
});
// Solve system ODE with adaptive RK45:
const odeSys = Chalkboard.diff.init((t, y) => [y[1], -y[0]], 2);
const solSys = Chalkboard.diff.solveAdaptive(odeSys, {
t0: 0, t1: 10,
y0: [1, 0],
h0: 0.1,
hMin: 0.01,
hMax: 0.5
});
Solves an ordinary differential equation using the adaptive Dormand–Prince (or Runge–Kutta–Fehlberg) method. Produces a variable-step solution.