Information Technology Reference
In-Depth Information
Tabl e 1. 1
The table shows
the number of intervals, n,the
length of the intervals, h,the
error, E
h
, and finally E
h
=h
2
.
The latter term seems to
converge toward a constant
E
h
=h
2
n
h
E
h
1
1:0000
0:5000
0:5000
2
0:5000
0:1274
0:5096
4
0:2500
0:0320
0:5121
8
0:1250
0:0080
0:5127
16
0:0625
0:0020
0:5129
32
0:0313
0:0005
0:5129
64
0:0156
0:0001
0:5129
E
h
0:5129h
2
;
(1.20)
which means that we can get as accurate an approximation as we want just by choos-
ing h sufficiently small which is done by increasing the number of intervals n.Say,
we want
10
5
:
E
h
6
(1.21)
Then it follows from (1.20)thath must satisfy
0:5129h
2
6
10
5
;
or
h
6
0:0044:
Using (1.19), we have
n
D
1= h
>
226:47:
Since n has to be an integer, we conclude that any n
>
227 willyieldanerrorless
than 10
5
.
We have seen that the trapezoidal method gives good results for the sine-function
and for the function given by (1.18). Let us now challenge the method by applying
it
to
a few other functions. In Fig.
1.6
we have plotted the functions x
4
, x
20
,and
p
x, and in Table
1.2
we have given numerical results obtained by applying the
trapezoidal method to these functions. We observe from Table
1.2
that for x
4
and for
x
20
, the error is about 0:33h
2
and 1:67h
2
, respectively. So for these functions, the
trapezoidal method gives an error of basically the same form as we observed above.
We note that the error is about five times larger for x
20
compared to that of x
4
.If
you consider the plot above and recall the derivation of the trapezoidal method, it
is not hard to realize that the lower curve is more difficult, since the second-order
derivative is much larger. Compare this with Fig.
1.2
where it is apparent that large
second-o
rd
er derivatives may cause large errors. Now, this observation also applies
to the
p
x function. In this case the second derivative is infinite as x approaches
zero, and we see from Table
1.2
that E
h
=h
2
does not converge toward any constant.
These issues will be given further consideration in Project
1.7.1
below.