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