Graphics Programs Reference
In-Depth Information
Recursive Trapezoidal Rule
Let I k be the integralevaluatedwith the composite trapezoidal rule using 2 k 1 panels.
Note that if k is increasedbyone, the number of panels is doubled. Using the notation
H
=
b
a
=
,
weobtain fromEq. (6.5) the following results for k
1
2 and 3.
k
=
1 (1 panel):
f ( b )] H
2
I 1
=
[ f ( a )
+
(6.8)
k
=
2 (2 panels):
f ( a )
2 f a
f ( b ) H
4
f a
H
2
H
2
1
2 I 1 +
H
2
I 2 =
+
+
+
=
+
k
=
3 (4 panels):
f ( a )
2 f a
2 f a
2 f a
f ( b ) H
8
H
4
H
2
3 H
4
I 3 =
+
+
+
+
+
+
+
f a
f a
H
4
1
2 I 2 +
H
4
3 H
4
=
+
+
+
Wecan now see thatfor arbitrary k
>
1wehave
f a
, k
2 k 2
1
2 I k 1 +
H
2 k 1
(2 i
1) H
2 k 1
I k =
+
=
2
,
3
,...
(6.9a)
i
=
1
which is the recursive trapezoidal rule . Observethat the summation containsonly
the newnodes that werecreatedwhen the number of panels was doubled. Therefore,
the computation of the sequence I 1 ,
I k fromEqs. (6.8) and (6.9) involves the
same amountofalgebra as the calculation of I k directly fromEq. (6.5). The advantage
of using the recursivetrapezoidal rule isthat it allows ustomonitor convergence and
terminate the process when the difference between I k 1 and I k becomes sufficiently
small.Aform of Eq. (6.9a)that iseasier to rememberis
I 2 ,
I 3 ,...,
h f ( x new )
1
2 I (2 h )
I ( h )
=
+
(6.9b)
where h
=
H
/
( n
1) is the width of each panel.
trapezoid
The function trapezoid computes I ( h ), given I (2 h )fromEqs. (6.8) and (6.9).We
can compute a
=
,
,...
f ( x ) dx by calling trapezoid repeatedlywith k
1
2
until the
desiredprecisionis attained.
Search WWH ::




Custom Search