Example 2. Use
Romberg integration to compute a numerical approximation to the
integral
.
Use the tolerances
. Compare
with the analytic or "true value" of the integral.
Solution 2.
2 (a). Plot the function over the interval [0, 2].
![[Graphics:../Images/RombergMod_gr_78.gif]](../Images/RombergMod_gr_78.gif)
![[Graphics:../Images/RombergMod_gr_79.gif]](../Images/RombergMod_gr_79.gif)
2 (b). Construct the Romberg
table using tol = 0.001
What do the entries in the first column mean ?
What do the entries in the second column mean ?
Which entries in the table are used to determine if Romberg
integration is converging ?
2 (c). The last entry in the
table is
. Let's
find it.
(This is possible
because j is a global variable in the
subroutine.)
2 (d). Look at 10 digits
in
.
2 (e). Are all 10 digits
correct ? Why ?
Be sure to support your answer to this question !
NO. The subroutine was called with the
accuracy
.
2 (f). Determine how to call
the Romberg integration subroutine so that it will achieve 10 digits
of accuracy.
You will need to experiment to find the solution. Do it
!
Report the answer with 10 digits of accuracy.
How many function evaluations were required to achieve this answer
?
We suspect the following answer might have 10 digits of accuracy.
Since the last row was row 8, the sequential trapezoidal rule used the following number of function calls.
2 (g). Use Mathematica to find the analytic solution to the integral, i.e. the "true value" of the integral.
2 (h). How close did our last numerical approximation using Romberg integration come to the "true value" of the integral.
![[Graphics:../Images/RombergMod_gr_123.gif]](../Images/RombergMod_gr_123.gif)
(c) John H. Mathews 2004