pub fn trapz_unit(arr: &mut Array) -> Result<Dynamic, Box<EvalAltResult>>
Expand description
Returns the approximate integral of the curve defined by y
using the trapezoidal method.
Assumes that x-values have unit spacing.
let y = [1.0, 1.5, 2.0];
let A = trapz(y);
assert_eq(A, 3.0);
let y = [1, 2, 3];
let A = trapz(y);
assert_eq(A, 4.0);