ME581_Assignment02-Sol

ME581_Assignment02-Sol - ME 581 Assignment#2 Solution In...

This preview shows pages 1–2. Sign up to view the full content.

Assignment #2 - Solution In the following questions show the derivations that you used to write your program. 1. Write an LU factorization subroutine with partial pivoting to decompose a matrix into a product of a lower triangular matrix and an upper triangular matrix. The input to your subroutine should be matrix [ A ] and the number of rows/columns of [ A ]. The output to the subroutine should be the lower triangular matrix, the upper triangular matrix and the permutation matrix. Test your program using the following matrix. = 3 2 1 2 5 1 2 1 4 1 1 1 5 1 1 1 4 6 2 1 2 4 2 4 2 ] [ A We can decompose a square matrix [ A ] into a product of a lower triangular matrix and an upper triangular matrix: ] ][ [ ] [ U L A = = n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n u u u u u u u u u u u u u u u l l l l l l l l l l l l l l l a a a a a a a a a a a a a a a a a a a a a a a a a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 , 1 1 , 1 3 1 , 3 33 2 1 , 2 23 22 1 1 , 1 13 12 11 1 , 3 2 1 1 , 1 3 , 1 2 , 1 1 , 1 33 32 31 22 21 11 1 , 3 2 1 , 1 1 , 1 3 , 1 2 , 1 1 , 1 3 1 , 3 33 32 31 2 1 , 2 23 22 21 1 1 , 1 13 12 11 L L M M O M M M L L L L L M M O M M M L L L L L M M O M M M L L L - Assuming the diagonal terms of [ L ] to be 1, we get: = n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n n u u u u u u u u u u u u u u u l l l l l l l l l l a a a a a a a a a a a a a a a a a a a a a a a a a 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 , 1 1 , 1 3 1 , 3 33 2 1 , 2 23 22 1 1 , 1 13 12 11 1 , 3 2 1 3 , 1 2 , 1 1 , 1 32 31 21 1 , 3 2 1 , 1 1 , 1 3 , 1 2 , 1 1 , 1 3 1 , 3 33 32 31 2 1 , 2 23 22 21 1 1 , 1 13 12 11 L L M M O M M M L L L L L M M O M M M L L L L L M M O M M M L L L 11 11 11 a u l = 12 12 11 a u l = 13 13 11 a u l = n n a u l 1 1 11 = 21 11 21 a u l = 22 22 22 12 21 a u l u l = + 23 23 22 13 21 a u l u l = + n n n a u l u l 2 2 22 1 21 = + 31 11 31 a u l = 32 22 32 12 31 a u l u l = + 33 33 33 23 32 13 31 a u l u l u l = + + n n n n a u l u l u l 3 3 33 2 32 1 31 = + + 1 11 1 n n a u l = 2 22 2 12 1 n n n a u l u l = + 3 33 3 23 2 13 1 n n n n a u l u l u l = + + nn nn nn n n n n n n a u l u l u l u l = + + + + ... 3

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/16/2011 for the course MECHANICAL 581 taught by Professor Wasfy during the Fall '11 term at IUPUI.

Page1 / 9

ME581_Assignment02-Sol - ME 581 Assignment#2 Solution In...

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

View Full Document
Ask a homework question - tutors are online