Docsity

AMSC/CMSC 460 Assignment 3: Interpolation and Polynomial Approximation - Prof. Peter Wolfe, Assignments of Computer Science

Toggle sidebar
bg1
AMSC/CMSC 460 Dr. Wolfe ASSIGNMENT #3 Due June 26, 2009
1. The Runge function is
r(x) = 1
1 + 25x2,−1≤x≤1.
(a) For n= 5,10,15, plot pn(x), the polynomial interpolating r(x) at n+ 1 equally
spaced points, along with the graph of r(x). Use the MATLAB functions POLY-
FIT and POLYVAL. Observe what is happening to the graphs. Where is the
polynomial fit getting better ? Where is it getting worse ?
(b) Repeat part (a) but now use the interpolation points
xj= cos (2j−1)π
2n+ 2 , j = 1,...,n+ 1.
What difference do you observe ?
2. Given the data (−1,2),(0,2),(1,2),(2,5), calculate P3(x), the cubic polynomial inter-
polating this data (by hand) in three ways:
(a) Solve the Vandemonde system.
(b) Use Lagrange Polynomials.
(c) Find the Newton form, using the divided difference table.
Show that you get the same polynomial in each case.
3. For f(x) = sinh xwe are given that
f(0) = 0, f′(0) = 1, f(1) = 1.1752, f′(1) = 1.5431.
Calculate an approximation to f(0.5) using cubic Hermite interpolation. Compare
the result with f(0.5) = .5211.
4. Consider the function S(x) defined as
S(x) =
28 + 25x+ 9x2+x3,−3≤x≤ −1,
26 + 19x+ 3x2−x3,−1≤x≤0,
26 + 19x+ 3x2−2x3,0≤x≤3,
−163 + 208x−60x2+ 5x3,3≤x≤4.
Show that S(x) is a natural cubic spline function with the knots {−3,−1,0,3,4}. (A
natural cubic spline is a spline S(x) which satisfies S′′(x1) = S′′(xN) = 0) Be sure to
state explicitly each of the properties of S(x) which are necessary for this to be true.
5. The vapor pressure Pof water (in bars) as a function of temperature T(◦C) is
T 0 10 20 30
P(T) .006107 .012277 .023378 .042433
T 40 50 60 70
P(T) .073774 .12338 .19924 .31166
T 80 90 100 110
P(T) .47364 .70112 1.01325 1.22341
pf2

Partial preview of the text

Download AMSC/CMSC 460 Assignment 3: Interpolation and Polynomial Approximation - Prof. Peter Wolfe and more Assignments Computer Science in PDF only on Docsity!

AMSC/CMSC 460 Dr. Wolfe ASSIGNMENT #3 Due June 26, 2009

  1. The Runge function is r(x) =

1 + 25x^2

, − 1 ≤ x ≤ 1.

(a) For n = 5, 10 , 15, plot pn(x), the polynomial interpolating r(x) at n + 1 equally spaced points, along with the graph of r(x). Use the MATLAB functions POLY- FIT and POLYVAL. Observe what is happening to the graphs. Where is the polynomial fit getting better? Where is it getting worse? (b) Repeat part (a) but now use the interpolation points

xj = cos

(2j − 1)π 2 n + 2

, j = 1,... , n + 1.

What difference do you observe?

  1. Given the data (− 1 , 2), (0, 2), (1, 2), (2, 5), calculate P 3 (x), the cubic polynomial inter- polating this data (by hand) in three ways: (a) Solve the Vandemonde system. (b) Use Lagrange Polynomials. (c) Find the Newton form, using the divided difference table. Show that you get the same polynomial in each case.
  2. For f (x) = sinh x we are given that

f (0) = 0, f ′(0) = 1, f (1) = 1. 1752 , f ′(1) = 1. 5431.

Calculate an approximation to f (0.5) using cubic Hermite interpolation. Compare the result with f (0.5) = .5211.

  1. Consider the function S(x) defined as

S(x) =

28 + 25x + 9x^2 + x^3 , − 3 ≤ x ≤ − 1 , 26 + 19x + 3x^2 − x^3 , − 1 ≤ x ≤ 0 , 26 + 19x + 3x^2 − 2 x^3 , 0 ≤ x ≤ 3 , −163 + 208x − 60 x^2 + 5x^3 , 3 ≤ x ≤ 4.

Show that S(x) is a natural cubic spline function with the knots {− 3 , − 1 , 0 , 3 , 4 }. (A natural cubic spline is a spline S(x) which satisfies S′′(x 1 ) = S′′(xN ) = 0) Be sure to state explicitly each of the properties of S(x) which are necessary for this to be true.

  1. The vapor pressure P of water (in bars) as a function of temperature T (◦C) is

T 0 10 20 30 P(T) .006107 .012277 .023378. T 40 50 60 70 P(T) .073774 .12338 .19924. T 80 90 100 110 P(T) .47364 .70112 1.01325 1.

Interpolate these data with the cubic spline S(x) using the MATLAB function SPLINE and plot the results. It is also known that P (5) =. 008721 , P (45) = 0.095848 and P (95) = 0.84528. How well does S(x) do at these points?

  1. Ex.3.3 p.110, Numerical Computing with MATLAB.
  2. Ex.3.16 p.116, Numerical Computing with MATLAB.
  3. Ex.3.17 p.116, Numerical Computing with MATLAB.
  4. Ex.5.8 p.161, Numerical Computing with MATLAB.
  5. Ex 5.12 p.164, Numerical Computing with MATLAB
  6. For the CENSUSGUI data on p.144 find the cubic polynomial p 3 (s) = β 1 s^3 + β 2 s^2 + β 3 s + β 4 , where s is the translated and scaled time variable, which interpolates the data in the sense of least squares by constucting the 11 × 4 data matrix A and finding the vector (β 1 , β 2 , β 3 , β 4 )T^ in four different ways: (a) By using the backslash operator. (b) By forming and solving the normal equations. Note the condition number of the matrix AT^ A. (c) By using the QR decomposition. (d) By using the Singular-Value Decomposition. All of this is quite easy in MATLAB. Compare with the values given by POLYFIT.