Practice Problems for Final - Numerical Analysis I | MATH 464, Exams of Mathematical Methods for Numerical Analysis and Optimization

Prof. Greenbau Material Type: Exam; Class: NUMERICAL ANLYS I; Subject: Mathematics; University: University of Washington - Seattle; Term: Autumn 2006;

Typology: Exams

Pre 2010

Uploaded on 03/10/2009

koofers-user-jud
koofers-user-jud 🇺🇸

4

(1)

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Math 464, Autumn 2006
Practice Problems for Final (Wed., Dec. 13, 8:30–10:20).
Final will cover chapters 1 through 6.4, with special emphasis on material since the midterm
(i.e., chs. 5 and sections 1 through 4 of chapter 6). This sheet contains practice problems
only for chs. 5 and 6 (except the first problem, which is a followup from the midterm). Refer
to earlier practice sheet for problems from chs. 1–4.
1. (a) On the midterm we considered the problem of evaluating f(x) = 1 1x
and showed that while the problem was well-conditioned for xnear 0, one would
get an inaccurate result by applying this formula in a straightforward way. For
example, if |x|<1016, then 1 xwould be rounded to 1, taking 1 would give
1, and then subtracting this from 1 would give an answer of 0, which does not
have high relative accuracy. Write down an algorithm that will give high relative
accuracy. [Hint: One possible approach: You can evaluate 1 + 1xto high
relative accuracy. We have the product formula (1 1x)(1 + 1x) = x.]
(b) Suppose we wish to solve the quadratic equation
x2+bx +c= 0
for x, where b > 0 and |c|<< b2. The formulas for the two roots are
x+=b+b24c
2, x=bb24c
2
Write down an algorithm that can be used to evaluate both x+and xto high
relative accuracy.
2. The following fragment of MATLAB code does Gaussian elimination without pivoting
on an nby nmatrix A:
for k=1:n-1, % Use row k to eliminate entries in column k
% of rows k+1 through n.
%
% Here you should build in partial pivoting
%
for i=k+1:n,
mult = A(i,k)/A(k,k); % Subtract mult times row k from row i
for j=k:n, % in order to zero out A(i,k)
A(i,j) = A(i,j) - mult*A(k,j);
end;
end;
end;
1
pf3

Partial preview of the text

Download Practice Problems for Final - Numerical Analysis I | MATH 464 and more Exams Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

Math 464, Autumn 2006

Practice Problems for Final (Wed., Dec. 13, 8:30–10:20).

Final will cover chapters 1 through 6.4, with special emphasis on material since the midterm (i.e., chs. 5 and sections 1 through 4 of chapter 6). This sheet contains practice problems only for chs. 5 and 6 (except the first problem, which is a followup from the midterm). Refer to earlier practice sheet for problems from chs. 1–4.

  1. (a) On the midterm we considered the problem of evaluating f (x) = 1 −

1 − x and showed that while the problem was well-conditioned for x near 0, one would get an inaccurate result by applying this formula in a straightforward way. For example, if |x| < 10 −^16 , then 1 − x would be rounded to 1, taking

1 would give 1, and then subtracting this from 1 would give an answer of 0, which does not have high relative accuracy. Write down an algorithm that will give high relative accuracy. [Hint: One possible approach: You can evaluate 1 +

1 − x to high relative accuracy. We have the product formula (1 −

1 − x)(1 +

1 − x) = x.] (b) Suppose we wish to solve the quadratic equation

x^2 + bx + c = 0

for x, where b > 0 and |c| << b^2. The formulas for the two roots are

x+ =

−b +

b^2 − 4 c 2

, x− =

−b −

b^2 − 4 c 2 Write down an algorithm that can be used to evaluate both x+ and x− to high relative accuracy.

  1. The following fragment of MATLAB code does Gaussian elimination without pivoting on an n by n matrix A:

for k=1:n-1, % Use row k to eliminate entries in column k % of rows k+1 through n. % % Here you should build in partial pivoting % for i=k+1:n, mult = A(i,k)/A(k,k); % Subtract mult times row k from row i for j=k:n, % in order to zero out A(i,k) A(i,j) = A(i,j) - mult*A(k,j); end; end; end;

(a) Write down the code you would insert to implement partial pivoting. (If you are not sure about the MATLAB commands, you may write your code in C or in some pseudo-MATLAB form, as long as it is clear exactly what you are doing.) (b) Suppose A is tridiagonal and pivoting is not required. Show how you could mod- ify the above code to solve this problem efficiently, and count the number of operations performed in your modified code.

  1. (a) Compute the 2-norm and the ∞-norm of the vector: ( 1 − 2

) .

(b) What is the ∞-norm (max‖v‖∞ =1 ‖Av‖∞) of the matrix

A =

( 1 2 3 6. 1

) ?

(c) Determine the condition number of A in the ∞-norm?

  1. (a) Let x be the exact solution to the linear system Ax = b, and let ˆx be the exact solution to the linear system Axˆ = ˆb, where A is a nonsingular matrix. Derive a bound on the relative error, ‖xˆ − x‖/‖x‖, in terms of the relative change in b, ‖ˆb − b‖/‖b‖. (b) What does it mean for an algorithm to be backward stable? If a backward stable algorithm is used to solve a linear system Ax = b on a machine with unit roundoff , approximately how large will the relative error, ‖xˆ − x‖/‖x‖, be?
  2. Factor the following matrix in the form QR, where Q is a 3 by 2 matrix with orthonor- mal columns and R is a 2 by 2 upper triangular matrix:

A =

 

 .

Use your QR factorization to solve the least squares problem Ax ≈ b, where

b =

 

 .

  1. Consider the following set of data:

x y 1 1 2 2 3 4