Evaluate function of a matrix.
F = FUNM(A,'fun') for a matrix argument A evaluates the matrix
function specified by 'fun'. For example, FUNM(A,'sin') is
the matrix sine. For matrix exponentials, logarithms and
square roots, use EXPM (A), LOGM (A) and SQRTM (A) instead.
FUNM uses a potentially unstable algorithm. If A is close to a
matrix with multiple eigenvalues and poorly conditioned eigenvectors,
FUNM may produce inaccurate results. An attempt is made to detect
this situation and print a warning message. The error detector is
sometimes too sensitive and a message is printed even though the
the computed result is accurate.
[F,ESTERR] = FUNM(A,'fun') does not print any message, but returns
a very rough estimate of the relative error in the computed result.
If A is symmetric or Hermitian, then its Schur form is diagonal and
FUNM will be able to produce an accurate result.
S = SQRTM (A) and L = LOGM (A) use FUNM to do their computations,
but they can get more reliable error estimates by comparing S*S
and EXPM (L) with A. E = EXPM (A) uses a completely different
See also EXPM1871LU2, SQRTM , LOGM .