2
$\begingroup$

What are some computationally efficient ways to solve matrix exponentials, i.e. functions of the form : f(X)=$e^{X}$, where X is a square matrix ?

So far I have been able to diagonalise some matrices, and find the exponent of individual diagonal elements, but not all matrices I'm dealing with will be diagonalisable.

I am using Python with SciPy/NumPy, so solutions that can be implemented here will be most useful. If not, general solutions/solutions from other platforms are welcome too.

EDIT: (1) I need the exponential itself, not a solution using it. (2) The matrix X is dense, typically small (3x3 or 4x4), need not be symmetric or Hermitian.

$\endgroup$
  • 1
    $\begingroup$ Do you actually need to compute the exponential of a matrix, or are you trying to solve some equation f(X)a = b? Is your matrix X hermitian? $\endgroup$ – KobeGote Jan 17 at 14:12
  • 3
    $\begingroup$ For an overview of numerical methods, check out the "19 dubious ways..." paper: cs.cornell.edu/cv/ResearchPDF/19ways+.pdf $\endgroup$ – carlosvalderrama Jan 17 at 15:55
  • 3
    $\begingroup$ Do I understand your question correctly by saying: You have matrix $X$ and now you want to compute $e^{X}$ right? Have you looked at scipy.linalg.expm? It should pretty efficient I believe. What is the size of $X$? Is it dense or sparse? Is it symmetric/Hermitian/etc.? $\endgroup$ – Alone Programmer Jan 17 at 15:55
  • 2
    $\begingroup$ Do you need to actually compute the matrix exponential or do you only need matrix-vector products with it? If you only need the latter, then there are some efficient Krylov method for doing this that can also exploit sparsity epubs.siam.org/doi/abs/10.1137/… $\endgroup$ – whpowell96 Jan 17 at 16:06
  • 2
    $\begingroup$ @VoB- The matrices here represent deformation gradients of a deforming crystal. The change in distance between sets of parallel planes due to deformation is given by the individual elements of the inverted matrix exponential. Further information is obtained from more element-wise operations. I think for accessing the elements as well as inverting the matrix, we need the entire matrix. $\endgroup$ – ScientificPythonNovice Jan 17 at 20:14
2
$\begingroup$

As I mentioned in my comment, due to that you are searching for a method based on Python and ideally available in NumPy or SciPy, my suggestion is to use scipy.linalg.expm. It's really easy to use basically you have the $X$ matrix and you just pass it to the scipy.linalg.expm class and it would give you the exponential of $X$ (i.e. $e^{X}$).

Due to that you did not specify any specific feature of $X$, such as its sparsity or its symmetry, etc., it's really difficult to say when scipy.linalg.expm will fail to return the correct exponential of $X$. But as far as I know the the time complexity of algorithm used in scipy.linalg.expm is $O(n^{3})$, so, I expect if you have a really big dense matrix, it would be impractical to calculate its exponential and as other people are trying to say it would be better idea if you really want it to multiply this exponential to a vector and use other methods, which might be more efficient.

$\endgroup$
  • $\begingroup$ Thanks! The matrix in question is not large (mostly 3x3), and is dense, so time-wise it shouldn't be a problem. My concern was whether the approximation used in this function would fail for certain (3x3) matrices, i.e. does it require them to be symmetric etc. The documentation doesn't indicate such a limitation, so I think it is best to try it out on the matrices I have and see if there are any exceptions. $\endgroup$ – ScientificPythonNovice Jan 17 at 20:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.