Recall the Simpson rule:
∫ a b f ( x ) d x ≈ Δ x 3 ( f ( x 0 ) + 4 f ( x 1 ) + 2 f ( x 2 ) + 4 f ( x 3 ) + 2 f ( x 4 ) + ⋯ + 2 f ( x n − 2 ) + 4 f ( x n − 1 ) + f ( x n ) ) {\displaystyle \int _{a}^{b}f(x)dx\approx {\frac {\Delta x}{3}}(f(x_{0})+4f(x_{1})+2f(x_{2})+4f(x_{3})+2f(x_{4})+\cdots +2f(x_{n-2})+4f(x_{n-1})+f(x_{n}))}
where n {\displaystyle n} is even and Δ x = b − a n {\displaystyle \Delta x={\frac {b-a}{n}}} .