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

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

Evaluates the derivative of f at x0

Examples

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

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