Differential Equations & Numerical Methods · BE5B01DEN · Topic 4 of 13
Numerical integration
Week 4. Rectangle, trapezoid and Simpson rules have orders 1, 2 and 4, and the order lets you extrapolate.
Key ideas
Rectangle and trapezoid rules
With h=(b−a)/n and nodes xᵢ=a+ih, the trapezoid rule averages the left and right rectangle sums. Error bounds: left or right rectangles (b−a)M₁h/2, trapezoid (b−a)M₂h²/12.
Simpson’s rule
Simpson’s rule needs an even n and weights 1,4,2,4,…,4,1. Its error bound uses M₄=max|f⁗| and is O(h⁴); it is exact for polynomials up to degree 3.
Extrapolate and choose n
If the error behaves like C·h^p, then (2^p·I₂ₙ−Iₙ)/(2^p−1) is a better approximation, and (I₂ₙ−Iₙ)/(2^p−1) estimates the error of I₂ₙ. To choose n, solve the error bound for n.
In one line: Compute the rule by hand once; after that, the order and the bound do the planning for you.
Formulas
- Rectangle and trapezoid rules
- Simpson’s rule
- Extrapolate and choose n
Practice with worked solutions
Question 1
Use the trapezoid rule with n = 4 for the integral.
Worked solution
Answer: 11/32
With h = 1/4 the rule is h/2·[f₀+2f₁+2f₂+2f₃+f₄].
Question 2
Use Simpson’s rule with n = 2 for the integral.
Worked solution
Answer: 5/24
With h = 1/2 the weights are 1, 4, 1 and the factor is h/3.
Question 3
Find the smallest n for which the trapezoid error bound (b−a)³M₂/(12n²) is at most 0.01.
Worked solution
Answer: 29
Here M₂ = max|6x| = 12 on [0,2], so the bound is 8/n².
More Differential Equations & Numerical Methods practice in Ucenly
Sources
Written by Ucenly. Based on the BE5B01DEN course materials:
- Course card BE5B01DEN (Bílá kniha), p. 1
- Lecture slides: Numerical derivation and integration (edens_n2derInt.pdf), p. 4, 5, 6, 7
- Habala: Ordinary Differential Equations and Numerical Analysis (dnbook.pdf), p. 40
- Homework 3 (edenhw03.pdf), p. 1