This library is inspired by C++ library autodiff crated by Allan Leal.
This example shows how to compute derivative of simple function.
// Import Dual number and derivative macro.
use rad::{Dual, derivative};
fn main() {
// Here f - function which derivative we want to eval.
let f = x: Dual| -> Dual { (x * x).into() };
// Create dual number using From trait.
let x: Dual = 3.0.into();
// Calculate derivative of f w.r.t. x.
let dfdx = derivative!(f(x), x);
// Check derivative value.
assert_eq!(dfdx, 6.0);
}