The composite trapezoidal rule splits [a,b] into n equal subintervals of width h=(b-a)/n and sums trapezoids: C = (h/2)(f0 + 2f1 + ... + 2f_{n-1} + fn). Example: f(x)=x², [0,2], n=4, h=1/2 gives C=11/4; true=8/3, error=1/12.

Example

Use a weighted point table to apply the composite trapezoid rule.

highlighted = computed this step

Step 1 — Set up

Set up four composite trapezoid subintervals.

f(x)=x2[0,2]n=4f(x)= x^{2} \quad [ 0 , 2 ]\quad n= 4

Step 2 — Step size

Compute the step size.

h=12h= \hlmath{\frac{1}{2}}

Step 3 — Weighted point table

List nodes, function values, and trapezoid weights.

ixfwwf0001011214212211223329429242414\begin{array}{ccccc}\text{i} & \text{x} & \text{f} & \text{w} & \text{wf} \\ 0 & 0 & 0 & \hlmath{1} & \hlmath{0} \\ 1 & \frac{1}{2} & \frac{1}{4} & \hlmath{2} & \hlmath{\frac{1}{2}} \\ 2 & 1 & 1 & \hlmath{2} & \hlmath{2} \\ 3 & \frac{3}{2} & \frac{9}{4} & \hlmath{2} & \hlmath{\frac{9}{2}} \\ 4 & 2 & 4 & \hlmath{1} & \hlmath{4}\end{array}

Step 4 — Weighted sum

Add the weighted function values.

S=11S= \hl{11}

Step 5 — Composite estimate

Multiply by h over 2 for the composite estimate.

T=1411=114T= \frac{1}{4} \cdot 11 = \hlmath{\frac{11}{4}}
composite-trapezoid With n subintervals of width h=(b-a)/n and nodes x_i=a+i*h: ends = (h/2)(f(x0) + f(xn)) mid = h * (f(x1) + ... + f(x_{n-1})) C = ends + mid