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

Evaluates the derivative of f at x0

Examples

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

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