14
ESCUELA DE INGENIERÍA DE PETROLEOS

LU Decomposition Fula 2010

Embed Size (px)

Citation preview

Page 1: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

Page 2: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

The LU decomposition is a matrix decomposition which writes a matrix as the product of a lower triangular matrix and an upper triangular matrix. The product sometimes includes a permutation matrix as well. This decomposition is used in numerical analysis to solve systems of linear equations or calculate the determinant.

Page 3: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

1. Get the lower triangular matrix L and upper triangular matrix U.

2.  Solve Ly = b (to find y).

3.  The result of the previous step is saved in a new array of name y.

4. Make Ux = y (to find x).

5. The result of the previous step is stored in a new array called x, which provides the values for the unknowns of the equation.

Page 4: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

Let A be a square matrix. An LU decomposition is a decomposition of the form

where D is a diagonal matrix and L and U are unit triangular matrices, meaning that all the entries on the diagonals of L and U are one.An LUP decomposition (also called a LU decomposition with partial pivoting) is a decomposition of the form

where L and U are again lower and upper triangular matrices and P is a permutation matrix, i.e., a matrix of zeros and ones that has exactly one entry 1 in each row and column.

Page 5: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

An LU decomposition with full pivoting (Trefethen and Bau) takes the form

Above we required that A be a square matrix, but these decompositions can all be generalized to rectangular matrices as well. In that case, L and P are square matrices which each have the same number of rows as A, while U is exactly the same shape as A. Upper triangular should be interpreted as having only zero entries below the main diagonal, which starts at the upper left corner.

Page 6: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

1.Make zero all values below the pivot without turning this into a.

2.To achieve the above is required to obtain a factor which is necessary to make clear the values below the pivot.

3.This factor is equal to the number you want to make the number zero pivot.

4.This factor multiplied by -1 is then multiplied by the pivot and this result is added value that is in the position to change (the value in the position to become zero).

Page 7: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

1.Build an array of the same order that the original matrix with ones on the main diagonal and zeros for the items that match j> i.

2.As the elements below the main diagonal are located on multiple Gauss decomposition used to achieve the "zero" in the corresponding position.

Page 8: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

1. Find the values of x1, x2 and x3 for the following system of equations:

4X1 -2X2 -X3 = 9

5X1 +X2 -X3 = 7

X1 +2X2 -X3 = 12

4 -2 -1 9

A = 5 1 -1 b = 7

1 2 -1 12

Page 9: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

SOLUTION

1. Se halla “U”:

4 -2 -1

5 1 -1 R2 R2 – (5/4)*R1

1 2 -1 R3 R3 – (1/4)*R1

4 -2 -1

0 7/2 ¼

0 5/2 -3/4 R3 R3 – (5/2)/(7/2)*R2

Page 10: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

1. Se halla “U”:

4 -2 -1

U = 0 7/2 ¼

0 0 -13/14

2. Se halla “L”:

1 0 0 1 0 0

L = ? 1 0 L = 5/4 1 0

? ? 1 ¼ 5/7 1

Page 11: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

3. Is verified L*U = A

1 0 0 4 -2 -1

5/4 1 0 x 0 7/2 ¼ =

¼ 5/7 1 0 0 -13/14

4+0+0 -2+0+0 -1+0+0 4 -2 -1

5+0+0 -5/2+7/2+0 -5/4+1/4+0 = 5 1 -1

1+0+0 -1/2 +5/2+0 -1/4+5/28-13/14 1 2 -1

Page 12: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

4. Now is clear “Y” of L*Y = b

1 0 0 Y1 9

5/4 1 0 * Y2 = 7

¼ 5/7 1 Y3 12

Y1 = 9 Y1 = 9

5/4Y1 + Y2 = 7 Y2 = -17/4

1/4Y1 + 5/7Y2 +Y3 = 12 Y3 = 179/14

Page 13: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

5. Se despeja “X” de U*X = Y

4 -2 -1 X1 9

0 14/4 ¼ * X2 = -17/4

0 0 -13/14 X3 179/14

4X1 -2X2 -X3 = 9 X1 = -17/13

14/4X2 +1/4X3 = -17/4 X2 = -3/13 RTA

-13/14X3 = 179/14 X3 = -179/13

Page 14: LU Decomposition Fula 2010

ESCUELA DE INGENIERÍA DE PETROLEOS

http://www.unizar.es/aragon_tres/unidad6/Matrices/u6matte20.pdf

http://en.wikipedia.org/wiki/LU_decomposition

http://www.ditutor.com/matrices/matriz_simetrica.html

http://www.cramster.com/reference/wiki.aspx?wiki_name=Band_matrix

Eduardo Carrillo, Class en Presentation Ppt Methods Numeric's. Universidad Industrial de Santander 2010.