Processing math: 100%
Skip to main content

Section 8.4 Trapezoidal rule (n=1)

In this case we are using a 2-points interpolation in [a,b]. These two points must be the endpoints x0=a and x1=b. The interpolating polynomial will have degree 1. The Lagrange polynomials are
L0(x)=xx1x0x1,L1(x)=xx0x1x0
and the corresponding weights are
w0=baxabadx=ba2=w1.
Hence the Trapezoidal rule formula gives
Q1(f,[a,b])=f(a)+f(b)2(ba).

Local error. From the Newton-Cotes error formula, we get that
|baf(x)dxQ1(f,[a,b])|(ba)32max[a,b]|f(x)|10s(s1)ds=(ba)312max[a,b]|f(x)|.
As usual, this shows that this approximation can be lousy unless ba1.

Trapezoidal rule formula. We bypass as usual the error problem above by subdiving the interval as shown in the previous two sections. In this case, we get that
Q1,h(f,[a,b])=hn1k=0f(xk)+f(xk+1)2

Trapezoidal rule error. From the error formula above, we get that
|xk+1xkf(x)dxQ1(f,[xk,xk+1])|h312max[a,b]|f(x)|
and therefore
|baf(x)dxQ1,h(f,[a,b])|h2ba12max[a,b]|f(x)|.
Convergence Speed. The formula above shows that the truncation error of the Trapezoidal rule is O(h2), like for the Midpoint rule. Below we visualize this scaling law by evaluating the error in the computation of 20sin(x)dx with h=10j,1j7. As in the Midpoint case, the round-off error effects shows already at h=107 and the error achievable on this integral is about h=1013.