({{, (RefLink[MatrixLog, paclet:ref/MatrixLog])[m] 
gives the matrix logarithm of a matrix m.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[MatrixLog, paclet:ref/MatrixLog]) is effectively the functional inverse of (RefLink[MatrixExp, paclet:ref/MatrixExp]), so that (RefLink[MatrixExp, paclet:ref/MatrixExp])[MatrixLog[m]] is m for a nonsingular matrix.

(RefLink[MatrixLog, paclet:ref/MatrixLog]) works only on square nonsingular matrices.

A (RefLink[Method, paclet:ref/Method]) option can be given, with possible explicit settings:

The default setting of (RefLink[Method, paclet:ref/Method])->(RefLink[Automatic, paclet:ref/Automatic]) uses the Schur decomposition for inexact numerical matrices and Jordan decomposition for exact and symbolic matrices.

The "Schur" method can also be specified by (RefLink[Method, paclet:ref/Method])->{"Schur",(RefLink[Tolerance, paclet:ref/Tolerance])->tol}, where eigenvalues with a relative magnitude less than tol are effectively considered as 0 so that the matrix is considered as singular. Use (RefLink[Tolerance, paclet:ref/Tolerance])->0 to allow any nonzero eigenvalue, no matter how small.

(RefLink[MatrixLog, paclet:ref/MatrixLog]) works on (RefLink[SparseArray, paclet:ref/SparseArray]) objects.

OpenersPrimaryExamplesSection(Spacer1)Examples  (13)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Logarithm of a 2×2 matrix:

MatrixLog[{{6.557,1.734},{4.523,7.425}}]

MatrixLog[{{2,1},{1,2}} t]//Simplify

OpenersExampleSection1(Spacer1)Scope  (4)

Use exact arithmetic to compute the matrix logarithm:

m={{1,1/2,1/3,1/4},{0,1,1/3,1/4},{0,0,1,1/4},{0,0,0,1}};

MatrixLog[m]//MatrixForm

Use machine arithmetic:

MatrixLog[N[m]]//MatrixForm

Use 24-digit-precision arithmetic:

MatrixLog[N[m,24]]

Compute a matrix logarithm of a complex matrix:

m=RandomComplex[1+I,{3,3}];

MatrixLog[m]//MatrixForm

A matrix logarithm of a symbolic matrix:

m={{E,0,0},{0,4 E,-4 E},{0,4 E,4 E}};

MatrixLog[m t]//FullSimplify[#,t>0]&//MatrixForm

A matrix logarithm of a sparse 10×10 matrix applied to a vector:

MatrixLog[SparseArray[{Band[{1,1}]->2,Band[{1,2}]->-1},{10,10}]].Range[10]

OpenersExampleSection2(Spacer1)Options  (1)

OpenersExampleSubsection0(Spacer1)Method  (1)

Eigenvalues with relatively very small magnitude are treated as zero:

m={{(10.^10),10.},{0.,2 (10.^(-4))}};
MatrixLog[m]

Use (RefLink[Tolerance, paclet:ref/Tolerance])->0 to include nonzero eigenvalues of any magnitude:

MatrixLog[m,Method->{"Schur",Tolerance->0}]

OpenersExampleSection3(Spacer1)Applications  (1)

Given the vectors (Subscript[z, i])∈(R^n), i∈[0, n] and a number h, compute the matrix A for which (Subscript[z, i+1])==(e^(A h)) (Subscript[z, i]):

n=10;
h=1/10;
z=NestList[RotateLeft,Range[n],n]//N;
TableForm[{z},TableHeadings->{None,Range[0,n]}]

Form the matrices s==(Transpose[{(Subscript[z, 0]),…,(Subscript[z, n-1])}]) and w==(Transpose[{(Subscript[z, 1]),…,(Subscript[z, n])}]) to compute the matrix A such that A==log(w (s^(-1)))/h:

s=Take[z,{1,-2}];
w=Take[z,{2,-1}];
A=MatrixLog[w.Inverse[s]]/h;

Check that applying the matrix (e^(A h)) iteratively starting with (Subscript[z, 0]) generates the rest of the vectors (Subscript[z, i]):

res=NestList[MatrixExp[A h].#&,z[[1]],n]//Chop;
TableForm[{res},TableHeadings->{None,Range[0,n]}]

OpenersExampleSection4(Spacer1)Properties & Relations  (2)

If m is a nonsingular numeric matrix, then (RefLink[MatrixExp, paclet:ref/MatrixExp])[MatrixLog[m]] is effectively equal to m:

m={{0,0,1},{0,2,0},{-1,0,0}};
mm=MatrixExp[MatrixLog[m]];
m==mm

But it is not always true for symbolic matrices:

m={{0,t},{-t,-2 t}};
MatrixExp[MatrixLog[m]]

The identity log((e^A))==A does not hold in general:

m ={{6,0,10},{0,20,0},{-2,0,0}};
mm=MatrixLog[MatrixExp[m]]//Simplify;
m-mm//FullSimplify

If a matrix is positive definite, then the identity log((e^A))==A holds:

m={{2,0,5},{0,1/2,0},{-1,0,7}};
mm=MatrixLog[MatrixExp[m]]//Simplify;
m-mm//FullSimplify

Eigenvalues[m]//N

OpenersExampleSection5(Spacer1)Possible Issues  (3)

(RefLink[MatrixLog, paclet:ref/MatrixLog]) does not work with singular matrices:

MatrixLog[{{0,0,1},{0,0,0},{-1,0,0}}]

MatrixLog[{{0.,0.,1.},{0.,0.,0.},{-1.,0.,0.}}]

The method "Jordan" can work with exact and inexact matrices:

MatrixLog[{{2,1},{3,2}},Method->"Jordan"]//Simplify

MatrixLog[{{2.,1.},{3.,2.}},Method->"Jordan"]//Chop

The method "Schur" works only with inexact matrices:

MatrixLog[{{2,1},{3,2}},Method->"Schur"]

MatrixLog[{{2.,1.},{3.,2.}},Method->"Schur"]//Chop

OpenersExampleSection6(Spacer1)Neat Examples  (1)

m=Reverse@IdentityMatrix[11];

FullSimplify[MatrixLog[m]]//MatrixForm

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[MatrixExp, paclet:ref/MatrixExp])  ▪  (RefLink[MatrixPower, paclet:ref/MatrixPower])  ▪  (RefLink[LinearSolve, paclet:ref/LinearSolve])  ▪  (RefLink[Dot, paclet:ref/Dot])  ▪  (RefLink[SchurDecomposition, paclet:ref/SchurDecomposition])  ▪  (RefLink[JordanDecomposition, paclet:ref/JordanDecomposition])  ▪  (RefLink[Log, paclet:ref/Log])  ▪  (RefLink[MatrixFunction, paclet:ref/MatrixFunction])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Matrix Operations, paclet:guide/MatrixOperations])}})}})