Docsity

6 Questions for Problem Set 3 - Computational Methods | CMSC 460, Assignments of Computer Science

Toggle sidebar
bg1
AMSC/CMSC 460 Problem set 3
1. Using pencil and paper, find the unique polynomial of degree ≤3 that
interpolates the data
x011.5 2
y−1 3 2 4 .
(a) First find the form that uses the Lagrange basis functions.
(b) Next use the Newton form with divided differences.
(c) Finally, find the interpolating polynomial using the Vandermonde
matrix. You can use MATLAB to solve the 4 ×4 linear system. Verify that
all three methods yield the same cubic polynomial.
2. (a) Let f(x) = 1/(1+x2) be the Runge example. Use the Mfile polyinterp
to interpolate fon [−5,5] with equally spaced points −5 = x0< x1< . . . <
xn= 5. Use n= 5,10,20. Then plot the polynomials together with the
graph of f.
(b). Look at the plots and comment on what happens as nincreases.
Where does the polynomial fit well, and where does it fit poorly?
(c) Repeat the questions of part (b) with f(x) = |x|on [−5,5].
3. Problem 3.18 of Moler, page 116.
4. Problem 3.3, page 110 of Moler. Use the Mfiles piecelin and polyinterp
from the NCM collection, and spline and pchip that are part of MATLAB.
5. Problem 3.4, page 111 of Moler.
6. Let x= (0,1,...,8). Let y= (1,1,1, d, 1,1,1,1,1) where dis to be
varied.
(a) Use the mfile polyinterp to find the polynomial of degree 8 which
interpolates these points for values of dclose to 1, say, d= 1.5,2. Plot the
curves. Note how the whole curve is affected by a small perturbation at one
point.
(b) Use the MATLAB spline routine to find the cubic spline which fits the
same data. Compare the graphs of the spline with that of the interpolating
polynomial. Which is less sensitive to the perturbation at a single data point?
Which would be better to interpolate experimental data?
1

Partial preview of the text

Download 6 Questions for Problem Set 3 - Computational Methods | CMSC 460 and more Assignments Computer Science in PDF only on Docsity!

AMSC/CMSC 460 Problem set 3

  1. Using pencil and paper, find the unique polynomial of degree ≤ 3 that interpolates the data x 0 1 1. 5 2 y − 1 3 2 4

(a) First find the form that uses the Lagrange basis functions. (b) Next use the Newton form with divided differences. (c) Finally, find the interpolating polynomial using the Vandermonde matrix. You can use MATLAB to solve the 4 × 4 linear system. Verify that all three methods yield the same cubic polynomial.

  1. (a) Let f (x) = 1/(1+x^2 ) be the Runge example. Use the Mfile polyinterp to interpolate f on [− 5 , 5] with equally spaced points −5 = x 0 < x 1 <... < xn = 5. Use n = 5, 10 , 20. Then plot the polynomials together with the graph of f. (b). Look at the plots and comment on what happens as n increases. Where does the polynomial fit well, and where does it fit poorly? (c) Repeat the questions of part (b) with f (x) = |x| on [− 5 , 5].
  2. Problem 3.18 of Moler, page 116.
  3. Problem 3.3, page 110 of Moler. Use the Mfiles piecelin and polyinterp from the NCM collection, and spline and pchip that are part of MATLAB.
  4. Problem 3.4, page 111 of Moler.
  5. Let x = (0, 1 ,... , 8). Let y = (1, 1 , 1 , d, 1 , 1 , 1 , 1 , 1) where d is to be varied. (a) Use the mfile polyinterp to find the polynomial of degree 8 which interpolates these points for values of d close to 1, say, d = 1. 5 , 2. Plot the curves. Note how the whole curve is affected by a small perturbation at one point. (b) Use the MATLAB spline routine to find the cubic spline which fits the same data. Compare the graphs of the spline with that of the interpolating polynomial. Which is less sensitive to the perturbation at a single data point? Which would be better to interpolate experimental data?