LUDecomposition
Usage
• LUDecomposition[m] 产生一个矩阵 m的 LU 分解表示。
Notes
• LUDecomposition 返回三个元素的一个列表。第一个元素是上三角和下三角矩阵的组合,第二个元素是一个指定用于绕轴旋转的行向量,对近似数值矩阵  ,第三个元素是  的  条件数的一个估计。
• 由 LUDecomposition产生的数据是为了在 LUBackSubstitution中使用。
Further Examples
We start with the decomposition of a simple matrix.
In[1]:=
|
Out[1]=
|
We solve the system m.v = {5,8}.
In[2]:=
|
Out[2]=
|
This checks the result.
In[3]:=
|
Out[3]=
|
In[4]:=
|
Recovering the lower and upper triangular matrices from the LUDecomposition LUDecomposition satisfies the following relation: Given a matrix M, determine a unit lower triangular matrix L, an upper triangular matrix U and a permutation vector P such that Part[M, P] L. U . Part[M, P] rearranges the rows of M.
The permutation ensures numerical stability during the decomposition phase; after that, L and U are determined using Gaussian elimination. Solving the system M.x b is equivalent to solving the system L.U.x b but it is easier because it amounts to solving two triangular systems in a row. For reasons of efficiency, the matrices L and U are returned as a single matrix, where the ones on the main diagonal of L are left out. The functions Lower and Upper recover the matrices by multiplying pairwise (not dot multiplying!) with appropriate matrices of zeros and ones.
In[5]:=
|
In[6]:=
|
Consider this inexact matrix.
In[7]:=
|
This decomposes the matrix into lower and upper diagonal matrices, gives a permutation vector and an estimate of the condition number.
In[8]:=
|
Out[8]=
|
This is the lower triangular matrix L.
In[9]:=
|
Out[9]//MatrixForm=
|
This is the upper triangular matrix U.
In[10]:=
|
Out[10]//MatrixForm=
|
This checks the result.
In[11]:=
|
Out[11]//MatrixForm=
|
Further Examples
We start with the decomposition of a simple matrix.
In[1]:=
|
Out[1]=
|
We solve the system m.v = {5,8}.
In[2]:=
|
Out[2]=
|
This checks the result.
In[3]:=
|
Out[3]=
|
In[4]:=
|
Recovering the lower and upper triangular matrices from the LUDecomposition LUDecomposition satisfies the following relation: Given a matrix M, determine a unit lower triangular matrix L, an upper triangular matrix U and a permutation vector P such that Part[M, P] L. U . Part[M, P] rearranges the rows of M.
The permutation ensures numerical stability during the decomposition phase; after that, L and U are determined using Gaussian elimination. Solving the system M.x b is equivalent to solving the system L.U.x b but it is easier because it amounts to solving two triangular systems in a row. For reasons of efficiency, the matrices L and U are returned as a single matrix, where the ones on the main diagonal of L are left out. The functions Lower and Upper recover the matrices by multiplying pairwise (not dot multiplying!) with appropriate matrices of zeros and ones.
In[5]:=
|
In[6]:=
|
Consider this inexact matrix.
In[7]:=
|
This decomposes the matrix into lower and upper diagonal matrices, gives a permutation vector and an estimate of the condition number.
In[8]:=
|
Out[8]=
|
This is the lower triangular matrix L.
In[9]:=
|
Out[9]//MatrixForm=
|
This is the upper triangular matrix U.
In[10]:=
|
Out[10]//MatrixForm=
|
This checks the result.
In[11]:=
|
Out[11]//MatrixForm=
|
|