Docsity

Homework Assignment 2 for Numerical Analysis | Math 105, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
Jim Lambers
Math 105A
Summer Session I 2003-04
Homework Assignment 2
This assignment is due in class on Tuesday, July 20. The exercises are from the textbook, Nu-
merical Analysis, 7th Edition, by Burden and Faires. Note: These exercises have been modified to
indicate tasks that must be performed using MATLAB. For other exercises, you may use MATLAB
if you wish.
For all exercises, you must show your work to receive full credit. For exercises involving MAT-
LAB, you must submit your code and your output.
Section 3.1
15. Construct the Lagrange interpolating polynomials for the following functions, and find a
bound for the absolute error on the interval [x0, xn].
(a) f(x) = e2xcos 3x,x0= 0, x1= 0.3, x2= 0.6, n= 2
(b) f(x) = sin(ln x), x0= 2.0, x1= 2.4, x2= 2.6, n= 2
17. Suppose you need to construct eight-decimal-place tables for the common, or base-10, loga-
rithm function from x= 1 to x= 10 in such a way that linear interpolation is accurate to
within 10−6. Determine a bound for the step size for this table. What choice of step size
would you make to ensure that x= 10 is included in the table?
21. Using MATLAB, construct a sequence of interpolating values ynto f(1+√10), where f(x) =
(1+ x2)−1for −5≤x≤5, as follows: For each n= 1,2, . . . , 10, let h= 10/n and yn=Pn(1+
√10), where Pn(x) is the interpolating polynomial for f(x) at the nodes x(n)
0, x(n)
1, . . . , x(n)
nand
x(n)
j=−5+ j h, for each j= 0,1,2, . . . , n. Each interpolating polynomial must be constructed
using the polyfit function, and each polynomial must be evaluated at x= 1 + √10 using
the polyval function. Does the sequence {yn}appear to converge to f(1 + √10)?
Section 3.2
1. Write a MATLAB program that uses Newton’s interpolatory divided-difference formula to
construct interpolating polynomials of degree one, two, and three for the following data.
Approximate the specified value using each of the polynomials. Hint: the Lecture 9 Notes
will be helpful.
(a) f(8.4) if f(8.1) = 16.94410, f(8.3) = 17.56492, f(8.6) = 18.50515, f(8.7) = 18.82091
1
pf3

Partial preview of the text

Download Homework Assignment 2 for Numerical Analysis | Math 105 and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Jim Lambers Math 105A Summer Session I 2003- Homework Assignment 2

This assignment is due in class on Tuesday, July 20. The exercises are from the textbook, Nu- merical Analysis, 7th Edition, by Burden and Faires. Note: These exercises have been modified to indicate tasks that must be performed using MATLAB. For other exercises, you may use MATLAB if you wish. For all exercises, you must show your work to receive full credit. For exercises involving MAT- LAB, you must submit your code and your output.

Section 3.

  1. Construct the Lagrange interpolating polynomials for the following functions, and find a bound for the absolute error on the interval [x 0 , xn].

(a) f (x) = e^2 x^ cos 3x, x 0 = 0, x 1 = 0.3, x 2 = 0.6, n = 2 (b) f (x) = sin(ln x), x 0 = 2.0, x 1 = 2.4, x 2 = 2.6, n = 2

  1. Suppose you need to construct eight-decimal-place tables for the common, or base-10, loga- rithm function from x = 1 to x = 10 in such a way that linear interpolation is accurate to within 10−^6. Determine a bound for the step size for this table. What choice of step size would you make to ensure that x = 10 is included in the table?
  2. Using MATLAB, construct a sequence of interpolating values yn to f (1 +

10), where f (x) = (1 + x^2 )−^1 for − 5 ≤ x ≤ 5, as follows: For each n = 1, 2 ,... , 10, let h = 10/n and yn = Pn(1 + √ 10), where Pn(x) is the interpolating polynomial for f (x) at the nodes x( 0 n ), x( 1 n ),... , x( nn )and x( jn )= −5+jh, for each j = 0, 1 , 2 ,... , n. Each interpolating polynomial must be constructed using the polyfit function, and each polynomial must be evaluated at x = 1 +

10 using the polyval function. Does the sequence {yn} appear to converge to f (1 +

Section 3.

  1. Write a MATLAB program that uses Newton’s interpolatory divided-difference formula to construct interpolating polynomials of degree one, two, and three for the following data. Approximate the specified value using each of the polynomials. Hint: the Lecture 9 Notes will be helpful.

(a) f (8.4) if f (8.1) = 16.94410, f (8.3) = 17.56492, f (8.6) = 18.50515, f (8.7) = 18. 82091

(b) f (0.9) if f (0.6) = − 0 .17694460, f (0.7) = 0.01375227, f (0.8) = 0.22363362, f (1.0) =

  1. 65809197

  2. (a) Approximate f (0.05) using the following data and the Newton forward divided-difference formula: x 0. 0 0. 2 0. 4 0. 6 0. 8 f (x) 1. 00000 1. 22140 1. 49182 1. 82212 2. 22554

(b) Use the Newton backward divided-difference formula to approximate f (0.65).

  1. (a) Show that the Newton forward divided-difference polynomials

P (x) = 3 − 2(x + 1) + 0(x + 1)(x) + (x + 1)x(x − 1)

and Q(x) = −1 + 4(x + 2) − 3(x + 2)(x + 1) + (x + 2)(x + 1)x

both interpolate the data x − 2 − 1 0 1 2 f (x) − 1 3 1 − 1 3

(b) Why does part (a) not violate the uniqueness property of interpolating polynomials?

  1. Given

Pn(x) = f [x 0 ] + f [x 0 , x 1 ](x − x 0 ) + a 2 (x − x 0 )(x − x 1 ) +a 3 (x − x 0 )(x − x 1 )(x − x 2 ) + · · · +an(x − x 0 )(x − x 1 ) · · · (x − xn− 1 ),

use Pn(x 2 ) to show that a 2 = f [x 0 , x 1 , x 2 ].

Section 3.

  1. (a) Use the following values and five-digit rounding arithmetic to construct the Hermite interpolating polynomial to approximate sin 0.34. x sin x Dx sin x = cos x 0.30 0.29552 0. 0.32 0.31457 0. 0.35 0.34290 0.

(b) Determine an error bound for the approximation in part (a), and compare it to the actual error.