It is possible to estimate numerical errors for each scheme.
Rectangular rule
The rectangular rule is to approximate ∫atf(x)dx by a rectangle with f(t) as the
height and t−a (=h) as the base.
The error is then defined as
ϵ(t) = (t−a) f(t) −
⌠ ⌡
t
a
f(x) dx.
(1)
To see how this function behaves, take the derivative as
ϵ′(t)
=
f(t) + (t−a) f′(t) −f(t)
(2)
=
f′(t) (t−a)
(3)
∼
f′(ξ) (t−a),
(4)
where ξ is some constant value assuming that
f′(t) does not fluctuate much between a and t. By integrating
eq.(4) with respect to t, one obtains
ϵ(t)
∼
f′(ξ)
2
(t−a)2
(5)
=
f′(ξ)
2
h2,
(6)
where h = (t−a).
When adding up eq.(6) over a finite interval of (a,b)
for n times, the total error is
ϵtotal
∼
nh2f′(ξ)
2
(7)
=
(b−a) f′(ξ)
2
h,
(8)
where b−a = nh was used in eq.(8). Equation (8)
implies that when the rectangular rule is used to approximate
⌠ ⌡
b
a
f(x) dx,
the error involved is in the order of
ϵtotal ∼ Ah,
(9)
where A is a constant and h is the step size.
In other words, to get 10−5 accuracy for b−a=1, one would need
n = (b−a)/h ∼ 105 partitions over the interval.
Trapezoidal Rule
The error involved in the trapezoidal rule is given
By adding up eq.(16) over the interval of (a,b), one
obtains
ϵtotal
∼
nh3f"(ξ)
12
(17)
=
(b−a) f"(ξ)
12
h2
(18)
∼
Ah2,
(19)
where A is a constant. This conclusion implies that one needs
√{105} ∼ 220 partitions to obtain 10−5 accuracy.
Simpson's Rule
From the result of error analysis of the trapezoidal rule,
it was found that
I ∼ Tn + Ah2,
(20)
where I is the true value, Tn is the approximation by the
trapezoidal rule, h is the step size and n is the number of
partitions. If one makes the stepsize h one-half, eq.(20)
becomes