archimedes.quadrature.simpson¶
- archimedes.quadrature.simpson(
- n: int,
- a: float,
- b: float,
Composite Simpson’s rule quadrature.
Simpson’s rule fits a parabola through the two ends and the midpoint of an interval: \(\int_a^b f(x) \, dx \approx \tfrac{h}{3}(f_0 + 4 f_1 + f_2)\)
The quadrature rule tiles
nequal-width segments across the domain \([a, b]\), with each segment using the Simpson quadrature rule.- Parameters:
n (int) – Number of integration segments
a (float) – Bounds of the target interval
b (float) – Bounds of the target interval
- Returns:
rule – Composite Simpson’s rule with
3 * nnodes on \([a, b]\), exact for a cubic on each segment.- Return type:
- Raises:
ValueError – If
n < 1.
See also
gauss_lobattoEquivalent single-segment quadrature rule.
composite_quadGeneral tiling for piecewise quadrature rules.
Notes
Simpson’s rule is equivalent to the 3-point Gauss-Lobatto quadrature rule, which is exact for cubics. The composite Simpson’s rule is exact for piecewise cubics.