Qu

simpson

Builtin index · Signal processing

simpson(y), simpson(x, y)

Input: y · Output: no output

What it is

Composite Simpson's rule on sampled data, with the same x/matrix conventions as trapz. Intervals are taken in pairs with the three-point formula for an uneven grid (exact for cubics when the number of intervals is even). With an odd number of intervals the last one is integrated with the quadratic through the last three points, so the result is exact for quadratics but not cubics. Two samples fall back to the trapezoid. Repeated x values are an error. Error order O(h^4) for smooth data.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
simpson(y), simpson(x, y)
y matrix or numbernot documented yet
not documented yetComposite Simpson's rule on sampled data, with the same x/matrix conventions as trapz. Intervals are taken in pairs with the three-point formula for an uneven grid (exact for cubics when the number of intervals is even). With an odd number of intervals the last one is integrated with the quadratic through the last three points, so the result is exact for quadratics but not cubics. Two samples fall back to the trapezoid. Repeated x values are an error. Error order O(h^4) for smooth data.

Examples

No documentation example calls this form yet. The Signal processing chapter is where one belongs.

How it works

and general minimization. Only a user-defined function (by name, the same convention pmap/spawn use) can be the target of any of these — not a builtin. fzero(f, a, b, [tol=1e-10], [max_iter=100]) — Brent's method: robust root finding (guaranteed convergence given a bracket [a,b] where f changes sign), no derivative needed. The "something better than plain bisection" choice.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.