Information Technology Reference
In-Depth Information
By (1.11), using c D .1 C 1:5/=2 D 1:25,wehave
Z 1:5
1
4
1
sin.x/ dx
2 Œsin.1/ C 2 sin.1:25/ C sin.1:5/ 0:4671:
1
The relative error of this approximation is
0:4696 0:4671
0:4696
100% 0:53%;
which, as we expected, is significantly smaller than the error obtained by using only
one trapezoid.
n
1.3.3
Approximating the Integral Using
Trapezoids
It is not hard to realize that we can proceed further and split the interval into n parts,
where n 1 is an integer. Let
b a
n
h D
and define
x i
D a C ih
for i D 0;1;:::n. These points
a D x 0 <x 1 < <x n1 <x n D b
divide the interval from a to b into n subintervals, see Fig. 1.4 .
Due to the additive property of the integral, we have
Z b
f.x/dx D Z x 1
x 0
f.x/dx C Z x 2
x 1
f.x/dx CC Z x n
x n1
f.x/dx
a
Z x i C1
D n X
i D0
f.x/dx:
(1.13)
x i
Let us consider one of these intervals and use the approximation derived above. If
we use x i
and x i C1 as the two end-points in (1.10), we get
h
x
D
D
a
x 0
x 1
x 2
x 3
x n
b
Fig. 1.4
The interval from x
D
a to x
D
b is divided into sub-intervals of length x i C 1
x i
D
h
Search WWH ::




Custom Search