SO(3), SO(4)の記事1、計算結果の確認にSymPyという代数計算ライブラリを使いました。
インストールをしなくても使用できるシェルが公開されています。
https://www.sympy.org/en/shell.html
数式をTex形式で取得することも可能です。
行列関数の定義
w, x, y, z = symbols('w x y z')
a, b, c, d = symbols('a b c d')
phi1, phi2 = symbols('phi_1 phi_2', cls=Function)
phi1 = Lambda((w,x,y,z), Matrix([[w,-x,-y,-z],[x,w,-z,y],[y,z,w,-x],[z,-y,x,w]]))
phi2 = Lambda((w,x,y,z), Matrix([[w,-x,-y,-z],[x,w,z,-y],[y,-z,w,x],[z,y,-x,w]]))
行列の作成と表示
M1=phi1(w,x,y,z)
M2=phi2(a,b,c,d)
M1,M2
\displaystyle \left( \left[\begin{matrix}w & - x & - y & - z\\x & w & - z & y\\y & z & w & - x\\z & - y & x & w\end{matrix}\right], \ \left[\begin{matrix}a & - b & - c & - d\\b & a & d & - c\\c & - d & a & b\\d & c & - b & a\end{matrix}\right]\right)
可換性を確認する。
\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right]
SO(3)に対応付けられることの確認
R3=phi1(w,x,y,z)*phi2(w,-x,-y,-z)
\displaystyle \left[\begin{matrix}w^{2} + x^{2} + y^{2} + z^{2} & 0 & 0 & 0\\0 & w^{2} + x^{2} - y^{2} - z^{2} & - 2 w z + 2 x y & 2 w y + 2 x z\\0 & 2 w z + 2 x y & w^{2} - x^{2} + y^{2} - z^{2} & - 2 w x + 2 y z\\0 & - 2 w y + 2 x z & 2 w x + 2 y z & w^{2} - x^{2} - y^{2} + z^{2}\end{matrix}\right]
直交性の確認
simplify(R3.transpose()*R3)
\displaystyle \left[\begin{matrix}\left(w^{2} + x^{2} + y^{2} + z^{2}\right)^{2} & 0 & 0 & 0\\0 & 4 \left(w y - x z\right)^{2} + 4 \left(w z + x y\right)^{2} + \left(w^{2} + x^{2} - y^{2} - z^{2}\right)^{2} & 0 & 0\\0 & 0 & 4 \left(w x + y z\right)^{2} + 4 \left(w z - x y\right)^{2} + \left(w^{2} - x^{2} + y^{2} - z^{2}\right)^{2} & 0\\0 & 0 & 0 & 4 \left(w x - y z\right)^{2} + 4 \left(w y + x z\right)^{2} + \left(w^{2} - x^{2} - y^{2} + z^{2}\right)^{2}\end{matrix}\right]
分かりにくいので引き算をして0になるか確認
simplify(R3.transpose()*R3-eye(4)*((w*w+x*x+y*y+z*z)**2))
\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right]
行列式を計算して因数分解する
\displaystyle \left(w^{2} + x^{2} + y^{2} + z^{2}\right)^{4}
行列の指数関数
simplify(exp(phi1(0,x,y,z)))
\displaystyle \left[\begin{matrix}\cosh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)} & - \frac{x \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & - \frac{y \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & - \frac{z \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}}\\\frac{x \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & \cosh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)} & - \frac{z \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & \frac{y \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}}\\\frac{y \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & \frac{z \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & \cosh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)} & - \frac{x \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}}\\\frac{z \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & - \frac{y \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & \frac{x \sinh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}}{\sqrt{- x^{2} - y^{2} - z^{2}}} & \cosh{\left(\sqrt{- x^{2} - y^{2} - z^{2}} \right)}\end{matrix}\right]
\cosh(\sqrt{-1}\theta)を\cos\thetaに変える方法は分かりませんでしたが、ここまで計算してくれるのは素晴らしいですね。
Discussion