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

pub fn concavity_at(f: &Function, x: f64) -> f64

Estimate the value of the second derivative of f at x

This function works by applying the limit definition of the derivative twice, once to estimate the first derivative of f() at two points, then once again to estimate the concavity.

The calculation is equivalent to:

                    f(x + h) - 2f(x) * 2 + f(x - h)
f''(x) = lim        -------------------------------
         h -> 0                    h^2 

Examples

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

let f = func![|x| (x + 4.0) * (x + 4.0)];
println!("f''(-4.0) = {}", concavity_at(&f, -4.0));

Outputs:

f''(-4.0) = 2.0000000005591114