[][src]Function reikna::derivative::derivative

pub fn derivative(f: &Function) -> Function

Return a function estimating the first derivative of f.

This is a helper function and is equivalent to calling nth_derivative(1, f).

Examples

#[macro_use] extern crate reikna;
use reikna::derivative::*;

let f = func![|x| x * x];

let first_deriv = derivative(&f);

println!("f(5)  = {}", f(5.0));
println!("f'(5) = {}", first_deriv(5.0));

Outputs:

f(5)   = 25
f'(5)  = 10.00000100148668