Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Homework Assignment 9 Solutions - Numerical Analysis I | MAT 460, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Material Type: Assignment; Professor: Lambers; Class: Numerical Analysis I; Subject: Mathematics; University: University of Southern Mississippi; Term: Fall 2009;

Typology: Assignments

2009/2010
On special offer
30 Points
Discount

Limited-time offer


Uploaded on 02/25/2010

koofers-user-4tj
koofers-user-4tj ๐Ÿ‡บ๐Ÿ‡ธ

4

(1)

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Jim Lambers
MAT 460/560
Fall Semester 2009-10
Homework Assignment 9 Solution
Section 3.3
5. (a) Use the following values and ๏ฌve-digit rounding arithmetic to construct the Hermite
interpolating polynomial to approximate sin 0.34.
๐‘ฅsin ๐‘ฅ ๐ท๐‘ฅsin ๐‘ฅ= cos ๐‘ฅ
0.30 0.29552 0.95534
0.32 0.31457 0.94924
0.35 0.34290 0.93937
Solution We construct a divided-di๏ฌ€erence table, with each of the interpolation points
included twice; that is, ๐‘ฅ0=๐‘ฅ1= 0.30, ๐‘ฅ2=๐‘ฅ3= 0.32, and ๐‘ฅ4=๐‘ฅ5= 0.35. Each of the
divided di๏ฌ€erences ๐‘“[๐‘ฅ๐‘–, ๐‘ฅ๐‘–+1], where ๐‘“(๐‘ฅ) = sin ๐‘ฅand ๐‘ฅ๐‘–=๐‘ฅ๐‘–+1, is set equal to ๐‘“โ€ฒ(๐‘ฅ๐‘–).
We have
๐‘ฅ๐‘–๐‘“[๐‘ฅ๐‘–]๐‘“[๐‘ฅ๐‘–, ๐‘ฅ๐‘–+1]
0.30 0.29552
0.95534
0.30 0.29552 โˆ’0.14200
0.95250 โˆ’1.0500
0.32 0.31457 โˆ’0.16300 20.732
0.94924 โˆ’0.0134 โˆ’431.41
0.32 0.31457 โˆ’0.16367 โˆ’0.83866
0.94433 โˆ’0.055333
0.35 0.34290 โˆ’0.16533
0.93937
0.35 0.34290
It follows that the Hermite interpolating polynomial is
๐ป5(๐‘ฅ)=0.29552 + 0.95534(๐‘ฅโˆ’0.30) โˆ’0.142(๐‘ฅโˆ’0.30)2โˆ’1.05(๐‘ฅโˆ’0.30)2(๐‘ฅโˆ’0.32) +
20.732(๐‘ฅโˆ’0.30)2(๐‘ฅโˆ’0.32)2โˆ’431.41(๐‘ฅโˆ’0.30)2(๐‘ฅโˆ’0.32)2(๐‘ฅโˆ’0.35)
Evaluating this polynomial at ๐‘ฅ= 0.34 using ๏ฌve-digit rounding arithmetic yields
๐ป5(0.34) = 0.33349.
(b) Determine an error bound for the approximation in part (a), and compare it to the
actual error.
1
pf3
pf4
pf5
Discount

On special offer

Partial preview of the text

Download Homework Assignment 9 Solutions - Numerical Analysis I | MAT 460 and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Jim Lambers MAT 460/ Fall Semester 2009- Homework Assignment 9 Solution

Section 3.

  1. (a) Use the following values and five-digit rounding arithmetic to construct the Hermite interpolating polynomial to approximate sin 0.34. ํ‘ฅ sin ํ‘ฅ ํทํ‘ฅ sin ํ‘ฅ = cos ํ‘ฅ 0.30 0.29552 0. 0.32 0.31457 0. 0.35 0.34290 0. Solution We construct a divided-difference table, with each of the interpolation points included twice; that is, ํ‘ฅ 0 = ํ‘ฅ 1 = 0.30, ํ‘ฅ 2 = ํ‘ฅ 3 = 0.32, and ํ‘ฅ 4 = ํ‘ฅ 5 = 0.35. Each of the divided differences ํ‘“ [ํ‘ฅํ‘–, ํ‘ฅํ‘–+1], where ํ‘“ (ํ‘ฅ) = sin ํ‘ฅ and ํ‘ฅํ‘– = ํ‘ฅํ‘–+1, is set equal to ํ‘“ โ€ฒ(ํ‘ฅํ‘–). We have ํ‘ฅํ‘– ํ‘“ [ํ‘ฅํ‘–] ํ‘“ [ํ‘ฅํ‘–, ํ‘ฅํ‘–+1] 0.30 0.

0.30 0.29552 โˆ’ 0. 14200 0.95250 โˆ’ 1. 0500 0.32 0.31457 โˆ’ 0. 16300 20. 0.94924 โˆ’ 0. 0134 โˆ’ 431. 41 0.32 0.31457 โˆ’ 0. 16367 โˆ’ 0. 83866 0.94433 โˆ’ 0. 055333 0.35 0.34290 โˆ’ 0. 16533

0.35 0. It follows that the Hermite interpolating polynomial is

ํป 5 (ํ‘ฅ) = 0 .29552 + 0.95534(ํ‘ฅ โˆ’ 0 .30) โˆ’ 0 .142(ํ‘ฅ โˆ’ 0 .30)^2 โˆ’ 1 .05(ํ‘ฅ โˆ’ 0 .30)^2 (ํ‘ฅ โˆ’ 0 .32) + 20 .732(ํ‘ฅ โˆ’ 0 .30)^2 (ํ‘ฅ โˆ’ 0 .32)^2 โˆ’ 431 .41(ํ‘ฅ โˆ’ 0 .30)^2 (ํ‘ฅ โˆ’ 0 .32)^2 (ํ‘ฅ โˆ’ 0 .35)

Evaluating this polynomial at ํ‘ฅ = 0 .34 using five-digit rounding arithmetic yields ํป 5 (0.34) = 0. 33349. (b) Determine an error bound for the approximation in part (a), and compare it to the actual error.

Solution The exact value, to 14 digits, is sin 0.34 = 0.33348709214081, so the actual er- ror is โˆฃ 0. 33348709214081 โˆ’ 0. 33349 โˆฃ = 2. 91 ร— 10 โˆ’^6. The bound for the error on [0. 30 , 0 .35] is given by

โˆฃํ‘“ (ํ‘ฅ) โˆ’ ํป 5 (ํ‘ฅ)โˆฃ =

(ํ‘ฅ โˆ’ 0 .30)^2 (ํ‘ฅ โˆ’ 0 .32)^2 (ํ‘ฅ โˆ’ 0 .35)^2

โˆฃโˆฃ^ โˆ’^ sin^ ํœ‰ 720

(ํ‘ฅ โˆ’ 0 .30)^2 (ํ‘ฅ โˆ’ 0 .32)^2 (ํ‘ฅ โˆ’ 0 .35)^2

where ํœ‰ โˆˆ [0. 30 , 0 .35]. Evaluating this error term at ํ‘ฅ = 0.34 yields

โˆฃ sin 0. 34 โˆ’ ํป 5 (0.34)โˆฃ =

โˆ’ sin ํœ‰ 720

(0.04)^2 (0.02)^2 (โˆ’ 0 .01)^2

โˆ’ sin 0. 35 720

โ‰ค 3. 05 ร— 10 โˆ’^14.

This bound is not inconsistent with the actual error, because the approximation was computed using five-digit rounding arithmetic.

(c) Add sin 0.33 = 0.32404 and cos 0.33 = 0.94604 to the data, and redo the calculations. Solution Proceeding as in part (a), we construct the divided-difference table with the new data included. This yields

ํ‘ฅํ‘– ํ‘“ [ํ‘ฅํ‘–] ํ‘“ [ํ‘ฅํ‘–, ํ‘ฅํ‘–+1]

โ‰ค 5. 44 ร— 10 โˆ’^20.

  1. A car traveling along a straight road is clocked at a number of points. The data from the observations are given in the following table, where the time is in seconds, the distance is in feet, and the speed is in feet per second.

Time 0 3 5 8 13 Distance 0 225 383 623 993 Speed 75 77 80 74 72

(a) Use a Hermite polynomial to predict the position of the car and its speed when ํ‘ก = 10 s. Solution The following MATLAB function, which is a modification from the function hw2prob321 presented earlier, computes the coefficients of the Newton form of the Her- mite polynomial. % this function computes the Hermite interpolating polynomial % for a given function f(x) using Newtonโ€™s interpolatory % divided-difference formula. The x vector contains the % interpolation points, the y vector contains the corresponding % values of f(x), and the yp vector contains the corresponding % values of fโ€™(x). At the end of the computation, the vector d % contains the coefficients of the Newton form of the Hermite % polynomial. function d=hw2prob337(x,y,yp)

% n is the degree of the interpolating polynomial n=2*length(y)-1;

% initialize divided-difference table: d=zeros(1,n+1);

% xx stores the x-values, with each value listed twice xx=zeros(n+1,1); xx(1:2:n)=x; xx(2:2:n+1)=x;

% d contains the current divided differences

% initially, contains each y-value twice d(1:2:n)=y; d(2:2:n+1)=y;

for i=1:n, % compute divided differences, overwriting those % we donโ€™t need for j=n+1:-1:i+1, if xx(j)==xx(j-i), % use derivative value d(j)=yp(j/2); else d(j)=(d(j)-d(j-1))/(xx(j)-xx(j-i)); end end end Using this function, we obtain the coefficients Hermite interpolating polynomial for the given data,

ํป 9 (ํ‘ฅ) = 75 ํ‘ฅ + 0. 222222 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3) โˆ’ 0. 0311111 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3)^2 โˆ’

  1. 00644444 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3)^2 (ํ‘ฅ โˆ’ 5) + 0. 00226389 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3)^2 (ํ‘ฅ โˆ’ 5)^2 โˆ’
  2. 000913194 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3)^2 (ํ‘ฅ โˆ’ 5)^2 (ํ‘ฅ โˆ’ 8) +
  3. 000130527 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3)^2 (ํ‘ฅ โˆ’ 5)^2 (ํ‘ฅ โˆ’ 8)^2 โˆ’
  4. 0000202236 ํ‘ฅ^2 (ํ‘ฅ โˆ’ 3)^2 (ํ‘ฅ โˆ’ 5)^2 (ํ‘ฅ โˆ’ 8)^2 (ํ‘ฅ โˆ’ 13).

Applying the nested multiplication algorithm from the Lecture 9 Notes to this polyno- mial, we obtain the coefficients of the Newton form of a polynomial ํ‘ž(ํ‘ฅ) such that

ํป 9 (ํ‘ฅ) = 742.5 + (ํ‘ฅ โˆ’ 10)ํ‘ž(ํ‘ฅ),

which implies that ํป 9 (10) = 742.5. Furthermore, ํป 9 โ€ฒ(10) = ํ‘ž(10), so by applying nested multiplication to ํ‘ž(ํ‘ฅ), we can compute ํป 9 โ€ฒ(10) = ํ‘ž(10) = 48.38 ft/s.

(b) Use the derivative of the Hermite polynomial to determine whether the car ever exceeds a 55 mi/h speed limit on the road. If so, what is the first time the car exceeds this speed? Solution Using the MATLAB function powerform provided on the Code page of the site, we can convert the Newton form of ํป 9 (ํ‘ฅ) from part (a) into the power form, and use MATLABโ€™s polyder function to obtain the coefficients of ํป 9 โ€ฒ(ํ‘ฅ). Noting that 55 mi/h is equivalent to approximately 80.ยฏ6 ft/s, we can apply MATLABโ€™s roots function

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ [ํ‘ง 0 , ํ‘ง 1 ]

(ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )^2

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )

(ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )^2

= ํ‘“ (ํ‘ฅ 0 ) + ํ‘“ โ€ฒ(ํ‘ฅ 0 )(ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 ) + [ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )

= ํ‘“ (ํ‘ฅ 0 ) + ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )

ํปโ€ฒ(ํ‘ฅ 0 ) = ํ‘“ [ํ‘ง 0 , ํ‘ง 1 ] + 2ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 ](ํ‘ฅ 0 โˆ’ ํ‘ฅ 0 ) + 2ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ](ํ‘ฅ 0 โˆ’ ํ‘ฅ 0 )(ํ‘ฅ 0 โˆ’ ํ‘ฅ 1 ) +

ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ](ํ‘ฅ 0 โˆ’ ํ‘ฅ 0 )^2

= ํ‘“ [ํ‘ง 0 , ํ‘ง 1 ]

ํปโ€ฒ(ํ‘ฅ 1 ) = ํ‘“ [ํ‘ง 0 , ํ‘ง 1 ] + 2ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 ](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 ) + 2ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )(ํ‘ฅ 1 โˆ’ ํ‘ฅ 1 ) +

ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )^2

= ํ‘“ โ€ฒ(ํ‘ฅ 0 ) + 2ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 ](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 ) + ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )^2

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ [ํ‘ง 0 , ํ‘ง 1 ]

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ] โˆ’ ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 ]

(ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )^2

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ] โˆ’ ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 ]

(ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )^2

= ํ‘“ โ€ฒ(ํ‘ฅ 0 ) + 2[ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )] + [ํ‘“ [ํ‘ง 1 , ํ‘ง 2 , ํ‘ง 3 ] โˆ’ ํ‘“ [ํ‘ง 0 , ํ‘ง 1 , ํ‘ง 2 ]](ํ‘ฅ 1 โˆ’ ํ‘ฅ 0 )

= ํ‘“ โ€ฒ(ํ‘ฅ 0 ) + 2[ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )] +

ํ‘“ [ํ‘ง 2 , ํ‘ง 3 ] โˆ’ ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ]

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ [ํ‘ง 0 , ํ‘ง 1 ]

= ํ‘“ โ€ฒ(ํ‘ฅ 0 ) + 2[ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )] +

ํ‘“ โ€ฒ(ํ‘ฅ 1 ) โˆ’ ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ]

ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )

= ํ‘“ โ€ฒ(ํ‘ฅ 0 ) + 2[ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] โˆ’ ํ‘“ โ€ฒ(ํ‘ฅ 0 )] + ํ‘“ โ€ฒ(ํ‘ฅ 1 ) โˆ’ 2 ํ‘“ [ํ‘ง 1 , ํ‘ง 2 ] + ํ‘“ โ€ฒ(ํ‘ฅ 0 )

Since the Hermite polynomial ํป 3 (ํ‘ฅ) is unique, and ํป(ํ‘ฅ) satisfies the requirements of ํป 3 (ํ‘ฅ), we must have ํป 3 (ํ‘ฅ) = ํป(ํ‘ฅ).