MatrixFunction
MatrixFunction[f,m]
gives the matrix generated by the scalar function f at the matrix argument m.
Details and Options

- A matrix function transforms a matrix to another matrix. For convergent power series, MatrixFunction[f,m] effectively evaluates the power series for the function f with ordinary powers replaced by matrix powers.
- The function f should be a unary differentiable or symbolic function.
- MatrixFunction works only on square matrices. It applies the Schur–Parlett method for inexact matrices and Jordan decomposition for exact or symbolic matrices.
- MatrixFunction can be used on SparseArray objects.
- A Method option can be given, with possible explicit settings:
-
"Jordan" Jordan decomposition "Schur" Schur decomposition with block Parlett recursion - The "Schur" method can be specified with method options mopts by Method->{"Schur",mopts}. The following method options can be given:
-
"Balanced" False whether to balance the input matrix before doing the Schur decomposition "BlockSeparationDelta" Automatic maximum separation between adjacent eigenvalues in a single Parlett block
Examples
open allclose allBasic Examples (2)
Scope (8)
Use exact arithmetic to compute the matrix function of a logarithm of a polynomial:
Use 20-digit-precision arithmetic:
Compute the square root of a matrix:
Compute the matrix sine for a complex matrix:
Compute the matrix function using the composition of sine and cosine functions:
Compute the logarithm of an approximate matrix:
Verify that the exponential of the result is the original matrix:
Find the second inverse matrix power applied to a particular vector:
This is a more efficient way of computing :
Compute a matrix function applied to a vector for a sparse matrix:
Generalizations & Extensions (3)
Options (2)
Method (2)
If many eigenvalues are very close, they are put in a diagonal block submatrix, which may become large; computations are then more expensive and convergence may be slow:
A smaller value for "BlockSeparationDelta" reduces the diagonal block size and also speeds convergence:
But the result may be much less accurate:
When an input matrix is poorly balanced (containing terms of very different magnitudes), balancing may improve the result:
Applications (3)
Properties & Relations (6)
Applying ArcSin after Sin gives the original matrix:
Compute the matrix logarithm and then the matrix exponent:
Using the function 1/#& is the same as using Inverse:
Using a function that is a power is equivalent to using MatrixPower:
If is diagonalizable with
and the eigenvectors are well conditioned, then
:
Possible Issues (6)
The scalar function can have symbolic derivatives for exact or symbolic matrices:
MatrixFunction does not work with non-differentiable functions such as Abs:

It will return a matrix function for an exact input matrix, but the result is meaningless because Abs does not have a first or second derivative:
MatrixFunction does not return a result when the scalar function or any of its initial derivatives are not defined at matrix eigenvalues:


The scalar function f has poles (singularities) at 1, 2, and 3:
If a scalar function is not analytic and a matrix eigenvalue is close to a function pole, the resulting matrix is usually incorrect:

The method "Jordan" can work with exact and inexact matrices:
The method "Schur" works only with inexact (machine- and arbitrary-precision) matrices:

Neat Examples (1)
Text
Wolfram Research (2012), MatrixFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixFunction.html.
BibTeX
BibLaTeX
CMS
Wolfram Language. 2012. "MatrixFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MatrixFunction.html.
APA
Wolfram Language. (2012). MatrixFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixFunction.html