[R] Complex Matrix Exponentials.

Spencer Graves spencer.graves at pdf.com
Tue Jan 31 05:36:05 CET 2006

	  Thank you very much for providing a concrete, simple, reproducible 
example illustrating your question.  Without it, it would be much more 
difficult for me to understand your question and respond appropriately.

	  I know this is generally a very hard problem, and I've seen come 
discussion in the past year about some of the difficulties.  However, I 
just read the documentation, which led me to try the following:

 > MatrixExp(diag(1i,2), method="series")
                      [,1]                 [,2]
[1,] 0.5382509+0.8430744i 0.0000000+0.0000000i
[2,] 0.0000000+0.0000000i 0.5382509+0.8430744i
 > exp(1i)
[1] 0.5403023+0.841471i

	  In general, if A is a diagonal matrix, then exp(A) = 
diag(exp(diag(A))).  More generally, if you can compute the eigenvalues 
and eigenvectors of A, and if there are no repeated roots, then letting 
A = V %*% Lam %*% inv(V), we have exp(A) = V %*% exp(Lam) %*% inv(V). 
However, if A has repeated roots AND Lam is NOT diagonal, then I don't 
know what to do, and I don't know if R has a function that works for 
this case.

	  Clearly, your toy example is covered by my test case.  If this does 
NOT answer the more general question behind this, please let us know.

	  hope this helps.
	  spencer graves

Andrew wrote:

> Hello,
> I was curious if there was a complex valued matrix exponential function 
> available for R?  I have some Laplace transforms  of occupation times 
> for a hidden Markov model.  The matrix exponential function in the msm 
> package does not seem to handle complex values.  For example
>  > MatrixExp(diag(1i,2))
>      [,1] [,2]
> [1,]    1    0
> [2,]    0    1
> Warning message:
> imaginary parts discarded in coercion
> Thanks in advance for your help,
> Andrew Royal
> University of Calgary
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

More information about the R-help mailing list