ad2

Function ad2 

Source
pub fn ad2(x: f64, dx: f64, ddx: f64) -> Jet<2>
Expand description

Create a Jet<2> with value, first derivative, and second derivative. ddx is the raw second derivative $f’‘(a)$; stored internally as deriv[1] $= f’’(a) / 2!$.

§Arguments

  • x - function value $f(a)$
  • dx - first derivative $f’(a)$
  • ddx - second derivative $f’’(a)$

§Examples

use peroxide::fuga::*;

// Represent x^2 at x=2: f=4, f'=4, f''=2
let j = ad2(4.0, 4.0, 2.0);
assert_eq!(j.value(), 4.0);
assert_eq!(j.dx(), 4.0);
assert_eq!(j.ddx(), 2.0);