import numpy as np
from echoes import *
import math, random
=8, suppress=True)
np.set_printoptions(precision# to display only 8 significant digits of array components
2 Rotation matrices
Given the Euler angles θ, ϕ, ψ
defined in Section A.3 and more particularly in Fig. A.1, the rotation matrix (A.19) recalled here \[
\small
\mat{R}=
\left(
\begin{array}{ccc}
c_\theta c_\psi c_\phi - s_\psi s_\phi & - c_\theta c_\phi s_\psi - c_\psi s_\phi & c_\phi s_\theta \\
c_\theta c_\psi s_\phi + c_\phi s_\psi & - c_\theta s_\psi s_\phi + c_\psi c_\phi & s_\theta s_\phi \\
- c_\psi s_\theta & s_\theta s_\psi & c_\theta \\
\end{array}
\right)
\]
can be built with rot3(θ, ϕ, ψ)
= math.pi
π = π/3, π/4, π/5
θ, ϕ, ψ = rot3(θ, ϕ, ψ)
R print("R =\n",R)
R =
[[-0.12959624 -0.77987487 0.61237244]
[ 0.70165764 0.36424793 0.61237244]
[-0.70062927 0.50903696 0.5 ]]
The vectors of the spherical basis correspond to the column of the rotation matrix for \(\psi=0\). They can individually be obtained by the function es(i, θ, ϕ)
Python numbering starts at 0 so i
takes the values 0, 1 and 2.
Besides vectors of the spherical basis are ordered as \(\ve{\theta}\), \(\ve{\phi}\), \(\ve{r}\).
= π/8, π/5
θ, ϕ = rot3(θ, ϕ)
R print("R =\n",R)
for i in range(3): print(f"es({i}, θ, ϕ) = ", es(i, θ, ϕ), f" → e̱{['θ','ϕ','r'][i]}")
R =
[[ 0.74743424 -0.58778525 0.3095974 ]
[ 0.54304276 0.80901699 0.22493568]
[-0.38268343 0. 0.92387953]]
es(0, θ, ϕ) = [ 0.74743424 0.54304276 -0.38268343] → e̱θ
es(1, θ, ϕ) = [-0.58778525 0.80901699 0. ] → e̱ϕ
es(2, θ, ϕ) = [0.3095974 0.22493568 0.92387953] → e̱r
As shown in Section A.3 the rotation matrix applying on fourth-order tensors in Kelvin-Mandel notation can be deduced from the \(3×3\) rotation matrix from (A.24) \[ \scriptsize \left( \begin{array}{cccccc} R_{1 1}^{2} & R_{1 2}^{2} & R_{1 3}^{2} & \sqrt{2} R_{1 2} R_{1 3} & \sqrt{2} R_{1 1} R_{1 3} & \sqrt{2} R_{1 1} R_{1 2} \\ R_{2 1}^{2} & R_{2 2}^{2} & R_{2 3}^{2} & \sqrt{2} R_{2 2} R_{2 3} & \sqrt{2} R_{2 1} R_{2 3} & \sqrt{2} R_{2 1} R_{2 2} \\ R_{3 1}^{2} & R_{3 2}^{2} & R_{3 3}^{2} & \sqrt{2} R_{3 2} R_{3 3} & \sqrt{2} R_{3 1} R_{3 3} & \sqrt{2} R_{3 1} R_{3 2} \\ \sqrt{2} R_{2 1} R_{3 1} & \sqrt{2} R_{2 2} R_{3 2} & \sqrt{2} R_{2 3} R_{3 3} & R_{2 2} R_{3 3} + R_{2 3} R_{3 2} & R_{2 1} R_{3 3} + R_{2 3} R_{3 1} & R_{2 1} R_{3 2} + R_{2 2} R_{3 1} \\ \sqrt{2} R_{1 1} R_{3 1} & \sqrt{2} R_{1 2} R_{3 2} & \sqrt{2} R_{1 3} R_{3 3} & R_{1 2} R_{3 3} + R_{1 3} R_{3 2} & R_{1 1} R_{3 3} + R_{1 3} R_{3 1} & R_{1 1} R_{3 2} + R_{1 2} R_{3 1} \\ \sqrt{2} R_{1 1} R_{2 1} & \sqrt{2} R_{1 2} R_{2 2} & \sqrt{2} R_{1 3} R_{2 3} & R_{1 2} R_{2 3} + R_{1 3} R_{2 2} & R_{1 1} R_{2 3} + R_{1 3} R_{2 1} & R_{1 1} R_{2 2} + R_{1 2} R_{2 1} \\ \end{array} \right) \]
It can be directly obtained by rot6(θ, ϕ, ψ)
.
= π/3, π/4, π/5
θ, ϕ, ψ = rot3(θ, ϕ, ψ)
R =lambda a,b:0.5*(np.einsum('ik,jl',a,b)+np.einsum('il,jk',a,b))
sboxtimesprint("R⊠ˢR =\n",KM(sboxtimes(R,R)))
= rot6(θ, ϕ, ψ)
ℝ print("ℝ =\n",ℝ)
R⊠ˢR =
[[ 0.01679518 0.60820482 0.375 -0.67539145 -0.11223363 0.14293294]
[ 0.49232344 0.13267656 0.375 0.31544796 0.60765334 0.36144095]
[ 0.49088137 0.25911863 0.25 0.35994349 -0.49541971 -0.50437388]
[-0.69523004 0.26221734 0.4330127 0.49384417 -0.07821723 0.10196691]
[ 0.12840906 -0.56142176 0.4330127 -0.07821723 -0.49384417 0.48043389]
[-0.12859754 -0.40173255 0.53033009 -0.25451848 0.35031463 -0.59441032]]
ℝ =
[[ 0.01679518 0.60820482 0.375 -0.67539145 -0.11223363 0.14293294]
[ 0.49232344 0.13267656 0.375 0.31544796 0.60765334 0.36144095]
[ 0.49088137 0.25911863 0.25 0.35994349 -0.49541971 -0.50437388]
[-0.69523004 0.26221734 0.4330127 0.49384417 -0.07821723 0.10196691]
[ 0.12840906 -0.56142176 0.4330127 -0.07821723 -0.49384417 0.48043389]
[-0.12859754 -0.40173255 0.53033009 -0.25451848 0.35031463 -0.59441032]]
\(\,\)