npm.nicfv.com
    Preparing search index...

    Class DifferentialEquation

    Represents a one dimensional time-dependent differential equation.

    Index
    • Initialize a new one-dimensional differential equation.

      Parameters

      • dnx: Equation

        Equation for d(n)x/dt(n) as a function of t, x, dx/dt, ..., d(n-1)x/dt(n-1)

      • ...x0: number[]

        Initial conditions ordered by x, dx/dt, ..., d(n-1)x/dt(n-1)

      Returns DifferentialEquation

      // y = e^x can be represented by dx/dt = x, at time t=0, x=1
      const exp = new DifferentialEquation((t, x) => x, 1);
    • Solve this differential equation from t=0 to t=tf with timestep dt.

      Parameters

      • dt: number

        The timestep

      • tf: number

        The final time

      Returns Step[]

      An array containing each timestep and all orders of derivatives

      const data = exp.solve(1e-3, 4);