

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


AMSC/CMSC 460 Dr. Wolfe ASSIGNMENT #2 Due June 19, 2009
6 x 1 + 2x 2 + x 3 = − 3
2 x 1 +
x 2 −
x 3 = 4
x 1 + 2x 2 − 3 x 3 = 2
(a) Verify that its solution is
x 1 = 1. 4 x 2 = − 4. 2 x 3 = − 3. 0
(b) Using four digit floating-point decimal arithmetic with rounding, solve the system by Gaussian elimination without pivoting. (c) Repeat part (b) using partial pivoting. In performing the arithmetic operations, remember to round to four significant digits after each operation, just as would be done on a computer. If you are careful you should see a significant difference.
(Hn)i,j =
i + j − 1
, i = 1,... , n, j = 1,... , n.
Hn is nonsingular. However, as n increases, the condition number of Hn increases rapidly. Hn is a library function in MATLAB, hilb(n). Let n = 10, x = ones(10, 1) and b = H 10 x. Now use the backslash operator to solve the system Hnx = b, obtaining x∗. Since we know x exactly, we can compute e = x − x∗, the error, and r = b − H 10 x∗, the residual. Compute these quantities and also cond(Hn) (a MATLAB function). Show that the two basic principles of solving linear systems by G.E./P.P. in floating point arithmetic hold. How many correct digits does x∗^ have? Repeat with n = 11, 12 ,.. .. Stop when some component of x∗^ has no correct digits.
ai,j =
− 1 , i < j 1 , i = j 0 , i > j
(a) Show how to generate An in MATLAB with eye, ones and triu. (b) Find the inverse of An explicitly. Hint: Find the inverse of A 6 by using MATLAB. Then use the result to “guess” the inverse of An in general. In parts (c) and (d) use the ∞-norm. (c) Show cond(An) = n 2 n−^1. For what n is this greater than 1/eps? (d) With b = [−n + 2, −n + 3,... , − 1 , 0 , 1]T^ , the solution of Anx = b is x = [1, 1 ,... , 1]T^. Perturb b to bˆ = b + [0,... , 0 , ǫ]T^. Solve for ˆx in Anˆx = ˆb. Compare the relative error in ˆx to the relative error in bˆ. What do you conclude? Hint ˆx = x + A− n 1 (ˆb − b).
cond(A) 1 − ρ
‖∆b‖ ‖b‖
Consider the linear system Ax = b where
(^) , b =
(a) Solve Ax = b using the backslash operator. (b) Use equation (1) to answer the following question: If each entry in A and b might have an error of ±.00005, how reliable is x? Use the ∞-norm. (c) Let ∆A =. 0001 ∗rand(3)−. 00005 ∗ones(3), ∆b =. 0001 ∗rand(3, 1)−. 00005 ∗ones(3, 1). Solve (A + ∆A)(x + ∆x) = b + ∆b to get x + ∆x. Calculate ‖∆x‖/‖x‖. Is this consistent with (b)? What is the relative change in each xi?
(a) Let A be an n × n matrix and x ∈ Rn. How many flops does it take to form the product Ax? (b) Let A and B be n × n matrices. How many flops does it take to form the product AB? (c) In light of the results of (a) and (b), from the standpoint of efficiency, how should one compute Akx for k a positive integer k > 1?
−
d^2 u dx^2
x^2
u = −
x^3
, u(1) = 1, u(2) =
is u(x) = 1/x. We wish to construct finite difference approximations to u(x) as we did in class. (a) Use Moler’s fast diagonal solver tridisolve to find solutions to the system of finite difference equations for n = 9, 19 , 39. (b) Evaluate the accuracy of your solutions by taking the norm of the difference of the solution vector and the vector of exact solutions values at the nodes.