Search code examples
wolfram-mathematica

How to find the matrix exponential in Mathematica?


I'm trying to take the matrix exponential of a skew symmetric rotation matrix, S. I expect that the result is Rodrigues' rotation formula I + sin(theta)*S + (1-cos(theta))*S*S. However, Mathematica returns something that doesn't look like that formula and it's result is trying to take the square root of a negative number.

Here's my code:

S = { { 0, -omegaz, omegay }, {omegaz, 0, -omegax}, {-omegay, omegax, 0} };
FullSimplify[MatrixExp[S]]

That results in Mathematica:

results

Am I doing something wrong?


Solution

  • The result are the same.

    In Rodrigues' rotation formula, the skew matrix is made from the unit vector, therefore you have assumption:

    1 == omegax^2 + omegay^2 + omegaz^2
    

    And you need to use:

    MatrixExp[theta S]
    

    And if you run:

    rod = IdentityMatrix[3] + Sin[theta] S + (1 - Cos[theta]) MatrixPower[S, 2]
    rod = FullSimplify[rod, Assumptions -> {omegax^2 + omegay^2 + omegaz^2 == 1}]
    expS = FullSimplify[MatrixExp[theta S], Assumptions -> {omegax^2 + omegay^2 + omegaz^2 == 1}]
    rod == b
    (* True *)
    

    Thus, the Mathematica calculates the rotation matrix correctly.