Student[NumericalAnalysis] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Education : Student Package : Numerical Analysis : Computation : Student/NumericalAnalysis/MatrixDecomposition

Student[NumericalAnalysis]

  

MatrixDecomposition

  

factor a matrix

 

Calling Sequence

Parameters

Options

Description

Notes

Examples

Calling Sequence

MatrixDecomposition(A, opts)

Parameters

A

-

Matrix; a square nxn matrix

opts

-

(optional) equation(s) of the form keyword=value, where keyword is one of digits, method, output, showsteps; the options for factoring the matrix A

Options

• 

digits = posint

  

The number of digits of precision in which the computations will be performed. By default, digits will be set to the environment variable Digits.

• 

method = LU, PLU, LU[tridiagonal], PLU[scaled], LDU, LDLt, Cholesky

  

The type of decomposition to perform.

– 

method = LU produces a factorization A=L.U, where L and U are lower and upper triangular, respectively. It is also possible to obtain the Gaussian transformation matrices generated by this decomposition.

– 

method = PLU produces a factorization P.A=L.U, where L and U are lower and upper triangular, respectively, and P is the permutation matrix. It is also possible to obtain Gaussian transformation and permutation matrices generated by this decomposition.

– 

method = LU[tridiagonal] produces the factorization A=L.U using the Crout factorization algorithm for tridiagonal matrices, where L and U are lower and upper triangular, respectively. Note that the matrix A must be tridiagonal; an error will be raised otherwise.

– 

method = PLU[scaled] produces a factorization P.A=L.U, where L and U are lower and upper triangular, respectively, and P is the permutation matrix. This method uses scaled partial pivoting. It is also possible to obtain the Gaussian transformation and permutation matrices generated by this decomposition.

– 

method = LDU produces the factorization A=L.D.U, where L is a unit lower-triangular matrix, D is a diagonal matrix, and U is the a unit upper-triangular matrix.

– 

method = LDLt produces, for a symmetric real matrix A (Hermitian complex matrix A) the factorization A=L.D.Lt, where L is a unit lower-triangular matrix, D is a diagonal matrix, and Lt is the transpose (Hermitian, respectively) of L. Note that A must be symmetric (Hermitian, respectively); an error will be raised otherwise.

– 

method = Cholesky produces, for a positive definite matrix A, the factorization A=R.Rt, where R is lower triangular and Rt is the transpose R. Note that A must be positive definite; an error will be raised otherwise.

  

By default, method = PLU. See the output option below for a description of the possible return value(s) for each method.

• 

output = list

  

The return value for the function. L represents the lower-triangular matrix, U represents the upper-triangular matrix and D represents the diagonal matrix.

– 

If method = LU then output can be one or more of L, U, Mmatrices, where output = Mmatrices returns a list of Gaussian transformation matrices. By default, output = [L, U].

– 

If method = PLU then output can be one or more of P, L, U, Mmatrices, Ematrices, where output = Mmatrices returns a list of Gaussian transformation matrices and output = Ematrices returns a list of permutation matrices. By default, output = [P, L, U].

– 

If method = LU[tridiagonal] then output can be one or more of L, U. By default, output = [L, U].

– 

If method = PLU[scaled] then output can be one or more of P, L, U, Mmatrices, Ematrices, where output = Mmatrices returns a list of Gaussian transformation matrices and output = Ematrices returns a list of permutation matrices. By default, output = [P, L, U].

– 

If method = LDU then output can be one or more of L, D, U. By default, output = [L, D, U].

– 

If method = LDLt then output can be one or more of L, D, Lt, where output = Lt returns the unit upper-triangular matrix. By default, output = [L, D, Lt].

– 

If method = Cholesky then output can be one or more of R, Rt, where output = R returns the lower-triangular matrix and output = Rt returns the transpose of the lower-triangular matrix. By default, output = [R, Rt].

• 

showsteps = true or false

  

Whether to print helpful statements into the interface as the command executes. This option is only available when output = LU, PLU or PLU[scaled]. By default, showsteps = false.

Description

• 

Matrix decomposition is used to reduce the general linear system A.x=b to more manageable triangular systems.

• 

The MatrixDecomposition command can perform the following decompositions: LU, PLU, LU Tridiagonal, PLU Scaled, LDU, LDLt and Cholesky.

Notes

• 

Matrix decomposition is also sometimes referred to as matrix factorization. The terms are interchangeable.

• 

When the method is set to either LU or LDU, this procedure operates symbolically; that is, the inputs are not automatically evaluated to floating-point quantities, and computations proceed symbolically and exactly whenever possible. To obtain floating-point results, it is necessary to supply floating-point inputs.

• 

Otherwise, this procedure operates numerically; that is, if the inputs are not already numeric, they are first evaluated to floating-point quantities before computations proceed. The outputs will be numeric as well. Note that exact rationals are considered numeric and are preserved whenever possible throughout the computation; therefore, one must specify floating-point inputs instead of exact rationals to obtain floating-point outputs.

Examples

withStudent:-NumericalAnalysis:

AMatrix1.3,4.5,7.2,4.3,5.6,8.7,7.0,8.4,10.1

A:=1.34.57.24.35.68.77.08.410.1

(1)

Try an LU decomposition

L,UMatrixDecompositionA,method=LU,output=L,U

L,U:=1003.307692308105.3846153851.7050538511,1.34.57.209.2846153915.11538462002.89668601

(2)

MMatrixDecompositionA,method=LU,output=Mmatrices

M:=1003.307692308105.38461538501,10001001.7050538511

(3)

Check that M2.M1.A=U

M2.M1.AU

0.0.0.4.0000003309614810-104.0000003309614810-92.4000001985768910-91.8202150897650410-101.3546847199563710-81.0414957785087610-8

(4)

AMatrix3.32,1.43,2.02,9.93,2.43,1.54,2.54,1.53,6.54,1.21,1.04,8.54,3.44,0.43,2.43,1.99

A:=3.321.432.029.932.431.542.541.536.541.211.048.543.440.432.431.99

(5)

Try a PLU decomposition

P,L,UMatrixDecompositionA,method=PLU

P,L,U:=0010010000011000,10000.37155963301000.52599388380.9780264465100.50764525990.74811044270.13673442321,6.541.211.048.5401.0904128442.1535779821.643119266000.8707774188.0890018650007.929989165

(6)

P

0010010000011000

(7)

L

10000.37155963301000.52599388380.9780264465100.50764525990.74811044270.13673442321

(8)

U

6.541.211.048.5401.0904128442.1535779821.643119266000.8707774188.0890018650007.929989165

(9)

Perform a Cholesky decomposition

AMatrix2,1,0,1,2,1,0,1,2

A:=210121012

(10)

First check that A is positive definite

IsMatrixShapeA,positivedefinite

true

(11)

G,GtMatrixDecompositionA,method=Cholesky

G,Gt:=20012212600136233,21220012613600233

(12)

See Also

Student[LinearAlgebra]

Student[NumericalAnalysis]

Student[NumericalAnalysis][ComputationOverview]

Student[NumericalAnalysis][MatrixDecompositionTutor]

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam