Example 2. Use
cubic spline quadrature 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/SplineQuadMod_gr_71.gif]](../Images/SplineQuadMod_gr_71.gif)
![[Graphics:../Images/SplineQuadMod_gr_72.gif]](../Images/SplineQuadMod_gr_72.gif)
2 (b). Construct the cubic spline for 11 nodes and use it for quadrature.
2 (c). Construct the cubic spline for 21 nodes and use it for quadrature.
2 (d). Construct the cubic spline for 41 nodes and use it for quadrature.
2 (e). Construct the cubic spline for 41 nodes and use it for quadrature.
2 (f). Compare the results from parts b-d.
|
m sample points |
|
|
11 |
|
|
21 |
|
|
41 |
|
|
81 |
|
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/SplineQuadMod_gr_105.gif]](../Images/SplineQuadMod_gr_105.gif)
(c) John H. Mathews 2004