6
$\begingroup$

I have a matrix equation, taken from Wikipedia (Infinitesimale Drehungen), that looks not that complicated (note $a$ is a scalar, actually an angle as input paramter for the rotation matrix):

$$ R(a)=\exp(aJ) $$

In my case I would like to obtain $J$ while $R(a)$ is given: $$ R(a)=\left( \begin{array}{ccc} \cos\left(\sqrt{5}a\right)&-\frac{2\sin\left(\sqrt{5}a\right)}{\sqrt{5}}&\frac{\sin\left(\sqrt{5}a\right)}{\sqrt{5}}\\ \frac{2\sin\left(\sqrt{5}a\right)}{\sqrt{5}} & \frac{1}{5}\left(4\cos\left(\sqrt{5}a\right)+1\right) & -\frac{2}{5}\left(\cos\left(\sqrt{5}a\right)-1\right)\\ -\frac{\sin\left(\sqrt{5}a\right)}{\sqrt{5}} & -\frac{2}{5}\left(\cos\left(\sqrt{5}a\right)-1\right) & \frac{1}{5}\left(\cos\left(\sqrt{5}a\right)+4\right) \\ \end{array} \right) $$

I tried the following J[a_] := MatrixLog[R[a]]/a which does not work. Based on the equation $J=\left.\frac{dR(a)}{da}\right|_{a=0}$ that is also provided on the above-given Wikipedia page, I tried J[a_] := D[R[a], a] as well, which did not worked too.

My full listing looks as follows:

ClearAll["Global`*"];
R[a_] := {{Cos[\[Sqrt]5 a], -((2 Sin[\[Sqrt]5 a])/(\[Sqrt]5)), Sin[\[Sqrt]5 a]/(\[Sqrt]5)},
   {(2 Sin[\[Sqrt]5 a])/(\[Sqrt]5), (1/5) (1 + 4 Cos[\[Sqrt]5 a]), -(2/5) (-1 + Cos[\[Sqrt]5 a])},
   {-(Sin[\[Sqrt]5 a]/(\[Sqrt]5)), -(2/5) (-1 + Cos[\[Sqrt]5 a]), (1/5) (4 + Cos[\[Sqrt]5 a])}};
J[a_] := MatrixLog[R[a]]/a;
J[a_] := D[R[a], a];
FullSimplify[MatrixExp[a*J]]
FullSimplify[Limit[MatrixPower[IdentityMatrix[3] + (a/n) J, n], n -> Infinity]]

The last two Print statements should yield the original matrix $R(a)$. I would be greatful for any help on obtaining the Matrix $J$.

$\endgroup$
6
  • $\begingroup$ Asymptotic[R[a] - MatrixExp[a R'[a]] // Simplify, a -> 0] shows that expression is small O[a^2] $\endgroup$ Aug 22, 2022 at 11:05
  • 1
    $\begingroup$ With a quick look, it seems to me the notation is a bit inconsistent, ie $a$ is in a dot product with $J$ in the 1st equation (hence is a matrix), but then appears as a scalar later on. I think this should be clarified before any attempts at a solution are made ;-) $\endgroup$
    – Hans Olo
    Aug 22, 2022 at 11:10
  • 1
    $\begingroup$ You are right - $a$ is a scalar (an angle actually). And I fixed it in the OP to be treated consistently as a scalar. $\endgroup$ Aug 22, 2022 at 11:14
  • $\begingroup$ Ok, thanks it's then more clear. $\endgroup$
    – Hans Olo
    Aug 22, 2022 at 11:16
  • 1
    $\begingroup$ The use of Print is unnecessary in expressions like Print[FullSimplify[MatrixExp[a*J]]]; Just don't suppress the output with the semi-colon. $\endgroup$
    – Bob Hanlon
    Aug 22, 2022 at 14:21

3 Answers 3

6
$\begingroup$

Generally, Mathematica is strict when using multivalued functions (like Log), and that is why it won't fully "simplify" your expression unless you use some tricky functions (like PowerExpand or ComplexExpand).

The following works:

Clear[R, J];
R[a_] := {{Cos[\[Sqrt]5 a], -((2 Sin[\[Sqrt]5 a])/(\[Sqrt]5)), 
    Sin[\[Sqrt]5 a]/(\[Sqrt]5)}, {(2 Sin[\[Sqrt]5 a])/(\[Sqrt]5), (1/
       5) (1 + 4 Cos[\[Sqrt]5 a]), -(2/5) (-1 + 
       Cos[\[Sqrt]5 a])}, {-(Sin[\[Sqrt]5 a]/(\[Sqrt]5)), -(2/5) (-1 +
        Cos[\[Sqrt]5 a]), (1/5) (4 + Cos[\[Sqrt]5 a])}};

J = PowerExpand[FullSimplify[(MatrixLog[R[a]]/a)]];
J // MatrixForm

result

Check the result:

MatrixExp[a J] == R[a] // Reduce
(* True *)
$\endgroup$
2
  • $\begingroup$ Works brilliantly: Print[FullSimplify[MatrixExp[a*J]]] yields the original matrix. Many thanks! $\endgroup$ Aug 22, 2022 at 11:20
  • $\begingroup$ Just to provide a double-check: the limit-based equation FullSimplify[Limit[MatrixPower[IdentityMatrix[3] + (a/n) J, n], n -> Infinity]] yields the original rotation matrix as well. $\endgroup$ Aug 22, 2022 at 12:37
4
$\begingroup$

The derivative formula you found, $$ \left.\frac{dR}{da}\right|_{a=0} = J, $$ is much easier to use than the MatrixLog functions; you just neglected to set $a$ to zero after you took the derivative. This can be done like so:

J = D[R[a], a] /. a -> 0
(* {{0, -2, 1}, {2, 0, 0}, {-1, 0, 0}} *)

Verifying:

Simplify[MatrixExp[a J] == R[a]] 
(* True *)

Simplify[Limit[MatrixPower[IdentityMatrix[3] + (a/n) J, n], n -> Infinity] == R[a]]
(* True *)

Alternately, the matrix exponential is defined in such a way that $$ \frac{dR}{da} = J R(a) \quad \Rightarrow \quad J = R^{-1} \frac{dR}{da} $$ which can also be done in Mathematica:

J = Simplify[Inverse[R[a]] . D[R[a], a]] 
(* same as above *)
$\endgroup$
1
  • $\begingroup$ This is really a very efficient alternative, which I also just tried and works great. Thank you! $\endgroup$ Aug 22, 2022 at 17:35
4
$\begingroup$

An alternative approach that might be useful in some cases.

You can compute the MatrixLog in the limit of small a

Limit[MatrixLog[Normal[Series[R[a], {a, 0, 1}]]]/a, a -> 0]
(* {{0, -2, 1}, {2, 0, 0}, {-1, 0, 0}} *)
$\endgroup$
2
  • $\begingroup$ Thank you for this interesting approach, which works greatly as well. Do you have a reference (maybe wiki or math book) for this trick? On Wikipedia Page for Matrix Log I could not find it. $\endgroup$ Aug 23, 2022 at 5:44
  • 1
    $\begingroup$ Your relationship is true for all values of a so it must be true in the limiting value of small a. $\endgroup$
    – mikado
    Aug 23, 2022 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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