[R] A function for raising a matrix to a power?

Alberto Vieira Ferreira Monteiro albmont at centroin.com.br
Tue May 8 02:29:45 CEST 2007

Paul Gilbert wrote:
> I am getting a bit rusty on some of these things, but I seem to recall
> that there is a numerical advantage (speed and/or accuracy?) to
> diagonalizing: (...)
> I think this also works for non-integer, negative, large, and complex
This is diverging into mathematics, maybe this is off-topic, but...

Not all matrices can de diagonalized, but they can be transformed
(by invertible matrices) into a canonical form, called Jordan.

This canonical form has the eigenvalues in the main diagonal (they 
may be complex numbers), 1s or 0s in the diagonal just above
the main diagonal, and 0 everywhere else.

Based on this, it's possible to define f(M) for _any_ function f that has
enough derivatives. f(J), for a matrix in the Jordan canonical form,
has f(x) in the main diagonal (where x are the eigenvalues) and
f'(x) in some values of the diagonal just above that, f''(x)/2! in 
the next, etc.

It's in "Jordan normal form", in the borg of all wisdom, the wikipedia.

Alberto Monteiro

More information about the R-help mailing list