2019年1月16日 星期三

LU分解法 (LU Decomposition)



令 A 為一個 n\times n 階矩陣。LU 分解是指將 A 表示為兩個 n\times n 階三角矩陣的乘積
A=LU
其中 L 是下三角矩陣,U 是上三角矩陣,如下例,
\left[\!\!\begin{array}{rrc}  3&-1&2\\  6&-1&5\\  -9&7&3  \end{array}\!\!\right]=\left[\!\!\begin{array}{rcc}    1&0&0\\  2&1&0\\  -3&4&1  \end{array}\!\!\right]\left[\!\!\begin{array}{crc}  3&-1&2\\  0&1&1\\  0&0&5  \end{array}\!\!\right]
LU 分解的本質是高斯消去法的一種表達形式,矩陣 L 記錄消去法化簡 A 的過程,而矩陣 U則儲存化簡結果 (見“高斯消去法”)。LU 分解的外表看似平淡無奇,但它可以用來解線性方程,逆矩陣和計算行列式,堪稱是最具實用價值的矩陣分解式之一。
源自於 http://www.gregthatcher.com/Mathematics/LU_Factorization.aspx

This Calculator will Factorize a Square Matrix into the form A=LU where L is a lower triangular matrix, and U is an upper triangular matrix.

Step 2: Enter the values for your matrix, and press the "Solve" button.
  


Add (2/3 * row1) to row2
(the elementary matrix, hilighted in yellow, performs this operation for us.)
100
2/310
001
*
-6142
449
-3213
=
-6142
040/331/3
-3213

Add (-1/2 * row1) to row3
(the elementary matrix, hilighted in yellow, performs this operation for us.)
100
010
-1/201
*
100
2/310
001
*
-6142
449
-3213
=
-6142
040/331/3
0-512

Add (3/8 * row2) to row3
(the elementary matrix, hilighted in yellow, performs this operation for us.)
100
010
03/81
*
100
010
-1/201
*
100
2/310
001
*
-6142
449
-3213
=
-6142
040/331/3
00127/8

The inverse of

100
010
03/81
 is 

100
010
0-3/81

Let's multiply both sides of the equation by this inverse.

100
010
0-3/81
*
100
010
03/81
*
100
010
-1/201
*
100
2/310
001
*
-6142
449
-3213
=
100
010
0-3/81
*
-6142
040/331/3
00127/8

We can simplify this to: 

100
010
-1/201
*
100
2/310
001
*
-6142
449
-3213
=
100
010
0-3/81
*
-6142
040/331/3
00127/8
The inverse of

100
010
-1/201
 is 

100
010
1/201

Let's multiply both sides of the equation by this inverse.

100
010
1/201
*
100
010
-1/201
*
100
2/310
001
*
-6142
449
-3213
=
100
010
1/201
*
100
010
0-3/81
*
-6142
040/331/3
00127/8

We can simplify this to: 

100
2/310
001
*
-6142
449
-3213
=
100
010
1/2-3/81
*
-6142
040/331/3
00127/8
The inverse of

100
2/310
001
 is 

100
-2/310
001

Let's multiply both sides of the equation by this inverse.

100
-2/310
001
*
100
2/310
001
*
-6142
449
-3213
=
100
-2/310
001
*
100
010
1/2-3/81
*
-6142
040/331/3
00127/8

We can simplify this to: 

-6142
449
-3213
=
100
-2/310
1/2-3/81
*
-6142
040/331/3
00127/8

and we have now factored the matrix into the form A=LU.
Note that the 'L' matrix shows us the operations we performed to reduce the matrix (with signs changed).

沒有留言:

張貼留言

Messaging API作為替代方案

  LINE超好用功能要沒了!LINE Notify明年3月底終止服務,有什麼替代方案? LINE Notify將於2025年3月31日結束服務,官方建議改用Messaging API作為替代方案。 //CHANNEL_ACCESS_TOKEN = 'Messaging ...