hw4sol - MIT 18.335, Fall 2007: Homework 4, Solutions 1....

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MIT 18.335, Fall 2007: Homework 4, Solutions 1. (Trefethen/Bau 20.3a) With block matrix multiplication, the four blocks become IA 11 + 0 A 21 = A 11 IA 12 + 0 A 22 = A 12- A 21 A- 1 11 A 11 + IA 21 = 0- A 21 A- 1 11 A 12 + IA 22 = A 22- A 21 A- 1 11 A 12 (Trefethen/Bau 20.3b) After n steps of Gaussian elimination, A has been factorized as parenleftbigg L 11 L 21 I parenrightbiggparenleftbigg U 11 U 12 tildewide U 22 parenrightbigg = parenleftbigg A 11 A 12 A 21 A 22 parenrightbigg or, in expanded form, L 11 U 11 = A 11 L 11 U 12 = A 12 L 21 U 11 = A 21 L 21 U 12 + tildewide U 22 = A 22 Solving for tildewide U 22 gives tildewide U 22 = A 22- L 21 U 12 = A 22- A 21 U- 1 11 L- 1 11 A 12 = A 22- A 21 A- 1 11 A 12 2. (Trefethen/Bau 21.4a) First, the matrix is factorized as A = LU with Gaussian elimination, which requires about 2 m 3 / 3 flops. To compute the inverse, the following system is solved for A- 1 : AA- 1 = LUA- 1 = I This is done with m back-substitutions with right hand sides e i . Each back-substitution requires about m summationdisplay k =1 2 k = m 2 flops and the total number of flops is mm 2 + mm 2 + 2 3 m 3 = 8 3 m 3 1 (Trefethen/Bau 21.4b) When doing the back-substitution for the right hand side e i , the first i- 1 elements will be zero. The number of flops can then be reduced to m summationdisplay i =1 m summationdisplay k = i 2( m- k ) m 3 / 3 The second back-substitution still requires m 2 flops for each right hand side, and the total number of flops is 1 3 m 3 + m 3 + 2 3 m 3 = 2 m 3 (Trefethen/Bau 21.4c) 1. According to the previous part, each right hand side requires 2 m 2 flops, so the total operation count is 2 m 3 / 3 + 2 nm 2 . 2. Producing the inverse requires 2 m 3 flops, and each right hand side requires 2 m 2 flops, so the total operation count is 2 m 3 + 2 nm 2 . 3. (Trefethen/Bau 22.2) The following Matlab code creates the matrix, computes the LU factorization and the norm of error. m=60; A=tril(-ones(m),-1)+diag(ones(m,1)); A(:,m)=1; [L,U,P]=lu(A); max(abs(U(:))) norm(L*U-P*A,inf) The maximum element in U is 2 59 , as expected, but the error in A is zero, since there are never and calculations resulting in cancellation. However, if the last row of A has all elements equal to 1: A(m,:)=1; the norm will be 2, or more exactly, the element A mm is- 1 instead of 1, due to the rounding...
View Full Document

Page1 / 7

hw4sol - MIT 18.335, Fall 2007: Homework 4, Solutions 1....

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online