Calculates a simple residual error diagnostic for a solution: | |y'(t) - f(t,y) ||. Note that y'(t) is estimated from the discrete solution grid (finite differences) and f(t,y) is the ODE right-hand side in canonical first-order system form.
Solution
ODE which produced the solution
Optional
Norm type for the residual per sample
const ode = Chalkboard.diff.init((t, y) => -2 * y);const sol = Chalkboard.diff.solveAdaptive(ode, { t0: 0, t1: 5, y0: 1, h0: 0.1, hMin: 0.01, hMax: 0.5});const err = Chalkboard.diff.error(sol, ode, "LInfinity");console.log(err.max); Copy
const ode = Chalkboard.diff.init((t, y) => -2 * y);const sol = Chalkboard.diff.solveAdaptive(ode, { t0: 0, t1: 5, y0: 1, h0: 0.1, hMin: 0.01, hMax: 0.5});const err = Chalkboard.diff.error(sol, ode, "LInfinity");console.log(err.max);
Calculates a simple residual error diagnostic for a solution: | |y'(t) - f(t,y) ||. Note that y'(t) is estimated from the discrete solution grid (finite differences) and f(t,y) is the ODE right-hand side in canonical first-order system form.