∫₀¹ x² dx,n = 4 → T = 0.343750(精确值 1/3,误差 0.010417) h = 0.25 时梯形和为 T = 0.25/2·(0 + 2·(0.0625 + 0.25 + 0.5625) + 1) = 0.34375。精确值 1/3 = 0.333333,绝对误差 0.010417——正是预期的 O(h²) 量级。Composite trapezoidal rule
∫ from 0 to 1 of f(x) dx, f(x) = x^2, n = 4 subintervals, h = 0.25
i x_i f(x_i)
0 0.000000 0.000000
1 0.250000 0.062500
…
4 1.000000 1.000000
Trapezoid estimate: T ≈ 0.343750
Exact F(b) - F(a) = 0.333333, |error| ≈ 0.010417
∫₀¹ e^x dx,n = 4 → T ≈ 1.727222(精确值 e − 1) h = 0.25 时梯形法给出 1.727222;精确值为 e − 1 = 1.718282,误差约 0.008940。n 加倍误差约缩小到 1/4——二阶方法的标志性表现。Composite trapezoidal rule
∫ from 0 to 1 of f(x) dx, f(x) = e^x, n = 4 subintervals, h = 0.25
Trapezoid estimate: T ≈ 1.727222
Exact F(b) - F(a) = 1.718282, |error| ≈ 0.008940