

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Numerical Computing S’09 MATH/CSCI 4800- Homework-
Due in class on Monday March 23, 2009
Illegible reports will be returned without grading. Show all work. All Matlab scripts, Matlab output and plots should be printed out and stapled to the report.
(a) Define natural, clamped and not-a-knot cubic splines. (b) Check whether the following function is a natural cubic spline. If it is not, then indicate the reason for the breakdown.
S(x) =
28 + 25x + 9x^2 + x^3 x ∈ [− 3 , −1] 26 + 19x + 3x^2 − x^3 x ∈ [− 1 , 0] 26 + 19x + 3x^2 − 2 x^3 x ∈ [0, 3] −163 + 208x − 60 x^2 + 5x^3 x ∈ [3, 4]
(a) Write down the (x, y) points that will serve as the interpolation nodes for p(x). (b) Write a Matlab script to compute p(x) and plot a graph showing both p and f on the interval [2, 6]. (You may use the Matlab commands polyfit and polyval.) Comment on the eyeball- accuracy of your result. (c) Find, analytically, the upper bound on the interpolation error | ln x − p(x)| that is valid for all x in [2, 6]. (d) Based upon the above estimate, how many digits will be correct when p(4) is used to approximate ln 4? Check your result against the exact answer and comment.
(a) Section 3.1.2 of the Text discusses the use of Newton divided differences to construct polynomial interpolants. Use the Matlab code segments provided in that section to find the coefficients of the Newton interpolant, p(x), for the following data.
x y 0 32 1 4. 0 2 5. 6 3 7. 1 4 8. 4 5 10. 1 6 11. 5 7 13. 1 8 14. 4 9 16. 1 10 17. 5
(b) Construct a cubic spline interpolant, s(x), to the data in part (a) by using the Matlab spline command.
(c) On a single, labelled graph with appropriate legends, display the discrete data points, the piecewise linear interpolant, the polynomial interpolant computed in part (a) and the spline interpolant computed in part (b). List the advantages and disadvantages of each. Which of the three do you prefer and why?
(a) Solve Text Problem 2a, Exercises 4.1, page 204 by hand, using the procedure outlined in Example 4.4 on page 200. (b) (Extra Credit) Solve the above problem by hand by using the QR decomposition. This will require adding an extra column to the 4 × 3 matrix, employing Gram-Schmidt orthogonalization to generate Q and R, and then using the procedure outlined on page 222 to solve the least- squares problem. (c) Solve the problem with Matlab by using the QR decomposition. You may find the code segment given in Example 4.15 on page 223 helpful.