UcenlyOpen in the app

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.

Open the interactive lesson

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

Practice with worked solutions

Question 1

Use the trapezoid rule with n = 4 for the integral.

∫01x2 dx\int_0^1x^2\,dx
Worked solution

Answer: 11/32

  1. h=14:  f=0, 116, 14, 916, 1h=\tfrac14:\ \ f=0,\ \tfrac1{16},\ \tfrac14,\ \tfrac9{16},\ 1
  2. T(4)=18[0+216+24+1816+1]=1132T(4)=\frac18\Bigl[0+\tfrac2{16}+\tfrac24+\tfrac{18}{16}+1\Bigr]=\frac{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.

∫01x4 dx\int_0^1x^4\,dx
Worked solution

Answer: 5/24

  1. S(2)=1/23[0+4⋅116+1]=16⋅54=524S(2)=\frac{1/2}3\Bigl[0+4\cdot\tfrac1{16}+1\Bigr]=\frac16\cdot\frac54=\frac5{24}
  2. exact value 15\text{exact value }\tfrac15

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.

∫02x3 dx\int_0^2x^3\,dx
Worked solution

Answer: 29

  1. 23⋅1212n2=8n2≤0.01 ⇒ n≥800≈28.28\frac{2^3\cdot12}{12n^2}=\frac8{n^2}\le0.01\ \Rightarrow\ n\ge\sqrt{800}\approx28.28
  2. n=29n=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: