Function derivative

Source
pub fn derivative<N: ComplexField + FromPrimitive + Copy>(
    f: impl Fn(N::RealField) -> N,
    x: N::RealField,
    h: N::RealField,
) -> N
Expand description

Numerically find the derivative of a function at a point.

Given a function of a real field to a complex field, an input point x, and a step size h, calculate the derivative of f at x using the five-point method.

Making h too small will lead to round-off error.