• Take the derivative of a function.

    Parameters

    • f: (x: number) => number

      Function f(x)

    • x: number

      The x-value where to evaluate the derivative

    • h: number = 1e-3

      Small step value

    Returns number

    f'(x)

    const y = SMath.differentiate(x => 3 * x ** 2, 2); // 12
    
MMNEPVFCICPMFPCPTTAAATR