[][src]Function autodiff::forward_autodiff::diff

pub fn diff<G>(f: G, x0: f64) -> f64 where
    G: FnOnce(F) -> F

Evaluates the derivative of f at x0

Examples

    // Define a function `f(x) = e^{-0.5*x^2}`
    let f = |x: F| (-x * x / F::cst(2.0)).exp();

    // Differentiate `f` at zero.
    println!("{}", diff(f, 0.0)); // prints `0`