archimedes.quadrature.simpson¶

archimedes.quadrature.simpson(
n: int,
a: float,
b: float,
) → QuadratureRule¶

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 n equal-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 * n nodes on \([a, b]\), exact for a cubic on each segment.

Return type:

QuadratureRule

Raises:

ValueError – If n < 1.

See also

gauss_lobatto

Equivalent single-segment quadrature rule.

composite_quad

General 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.