Chalkboard - v3.0.1
    Preparing search index...

    Function error

    • 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.

      Parameters

      • sol: { t: number[]; y: number[][] }

        Solution

      • ode: ChalkboardODE

        ODE which produced the solution

      • Optionalnorm: "L1" | "L2" | "LInfinity" = "L2"

        Norm type for the residual per sample

      Returns { e: number[]; max: number; mean: number; rmse: number; t: number[] }

      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);