MATLAB Function Reference    
logm

Matrix logarithm

Syntax

Description

Y = logm(X) returns the matrix logarithm: the inverse function of expm(X). Complex results are produced if X has negative eigenvalues. A warning message is printed if the computed expm(Y) is not close to X.

[Y,esterr] = logm(X) does not print any warning message, but returns an estimate of the relative residual, norm(expm(Y)-X)/norm(X).

Remarks

If X is real symmetric or complex Hermitian, then so is logm(X).

Some matrices, like X = [0 1; 0 0], do not have any logarithms, real or complex, and logm cannot be expected to produce one.

Limitations

For most matrices:

These identities may fail for some X. For example, if the computed eigenvalues of X include an exact zero, then logm(X) generates infinity. Or, if the elements of X are too large, expm(X) may overflow.

Examples

Suppose A is the 3-by-3 matrix

and X = expm(A) is

Then A = logm(X) produces the original matrix A.

But log(X) involves taking the logarithm of zero, and so produces

Algorithm

The matrix functions are evaluated using an algorithm due to Parlett, which is described in [1]. The algorithm uses the Schur factorization of the matrix and may give poor results or break down completely when the matrix has repeated eigenvalues. A warning message is printed when the results may be inaccurate.

See Also

expm, funm, sqrtm

References

[1]  Golub, G. H. and C. F. Van Loan, Matrix Computation, Johns Hopkins University Press, 1983, p. 384.

[2]  Moler, C. B. and C. F. Van Loan, "Nineteen Dubious Ways to Compute the Exponential of a Matrix," SIAM Review 20, 1979,pp. 801-836.


  loglog logspace