Information Technology Reference
In-Depth Information
1.3.1
Approximating the Integral Using One Trapezoid
The general problem motivated by (1.6) above, is to compute numerical approxima-
tions of definite integrals, i.e., approximations of
Z
b
f.x/dx
a
for fairly general choices of functions f . Let us start by considering
f.x/
D
e
x
which we want to integrate from 1 to 2, i.e., we want to compute
Z
2
e
x
dx:
1
In Fig.
1.2
,wehavegraphedf and we note that we want to compute the area
under the curve. We have also graphed the straight line interpolating f
in the
endpoints x
D
1 and x
D
2. This straight line is given by
y.x/
D
eŒ1
C
.e
1/.x
1/ ;
which is verified by noting that
y.1/
D
e
and
y.2/
D
e
2
:
8
7
6
5
4
3
2
Fig. 1.2
The figure
illustrates how the integral of
f.x/
1
e
x
(
lower curve
) can
be approximated by a
trapezoid on a given interval
D
0
0.5
1
1.5
2
2.5