CoCalc Public Filesson's method.ipynbOpen with one click!
Author: Chan Park
Views : 35
Description: SOGRO
In [2]:
%display latex
In [3]:
theta, phi, psi = var('theta, phi, psi')
In [4]:
R1 = matrix([[cos(phi),-sin(phi),0],[sin(phi),cos(phi),0],[0,0,1]]); R1
(cos(ϕ)sin(ϕ)0sin(ϕ)cos(ϕ)0001)\left(\begin{array}{rrr} \cos\left(\phi\right) & -\sin\left(\phi\right) & 0 \\ \sin\left(\phi\right) & \cos\left(\phi\right) & 0 \\ 0 & 0 & 1 \end{array}\right)
In [5]:
R2 = matrix([[1,0,0],[0,cos(theta),-sin(theta)],[0,sin(theta),cos(theta)]]); R2
(1000cos(θ)sin(θ)0sin(θ)cos(θ))\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & \cos\left(\theta\right) & -\sin\left(\theta\right) \\ 0 & \sin\left(\theta\right) & \cos\left(\theta\right) \end{array}\right)
In [8]:
Lambda = R1.apply_map(lambda x: x(phi=phi-pi/2))*R2.apply_map(lambda x: x(theta=-theta)); Lambda.simplify_full()
(sin(ϕ)cos(ϕ)cos(θ)cos(ϕ)sin(θ)cos(ϕ)cos(θ)sin(ϕ)sin(ϕ)sin(θ)0sin(θ)cos(θ))\left(\begin{array}{rrr} \sin\left(\phi\right) & \cos\left(\phi\right) \cos\left(\theta\right) & \cos\left(\phi\right) \sin\left(\theta\right) \\ -\cos\left(\phi\right) & \cos\left(\theta\right) \sin\left(\phi\right) & \sin\left(\phi\right) \sin\left(\theta\right) \\ 0 & -\sin\left(\theta\right) & \cos\left(\theta\right) \end{array}\right)
In [9]:
(Lambda*Lambda.transpose()).simplify_trig()
(100010001)\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right)
In [14]:
e = [matrix([[1,0,0],[0,-1,0],[0,0,0]]), matrix([[0,1,0],[1,0,0],[0,0,0]])]; e
[(100010000),(010100000)]\left[\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & -1 & 0 \\ 0 & 0 & 0 \end{array}\right), \left(\begin{array}{rrr} 0 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0 \end{array}\right)\right]
In [15]:
for i in range(2): show((Lambda.transpose()*e[i]*Lambda).simplify_trig())
(2cos(ϕ)2+12cos(ϕ)cos(θ)sin(ϕ)2cos(ϕ)sin(ϕ)sin(θ)2cos(ϕ)cos(θ)sin(ϕ)(2cos(ϕ)21)cos(θ)2(2cos(ϕ)21)cos(θ)sin(θ)2cos(ϕ)sin(ϕ)sin(θ)(2cos(ϕ)21)cos(θ)sin(θ)(2cos(ϕ)21)sin(θ)2)\left(\begin{array}{rrr} -2 \, \cos\left(\phi\right)^{2} + 1 & 2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) & 2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right) \\ 2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) & {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right)^{2} & {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) \sin\left(\theta\right) \\ 2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right) & {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) \sin\left(\theta\right) & {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\theta\right)^{2} \end{array}\right)
(2cos(ϕ)sin(ϕ)(2cos(ϕ)21)cos(θ)(2cos(ϕ)21)sin(θ)(2cos(ϕ)21)cos(θ)2cos(ϕ)cos(θ)2sin(ϕ)2cos(ϕ)cos(θ)sin(ϕ)sin(θ)(2cos(ϕ)21)sin(θ)2cos(ϕ)cos(θ)sin(ϕ)sin(θ)2cos(ϕ)sin(ϕ)sin(θ)2)\left(\begin{array}{rrr} -2 \, \cos\left(\phi\right) \sin\left(\phi\right) & -{\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) & -{\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\theta\right) \\ -{\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) & 2 \, \cos\left(\phi\right) \cos\left(\theta\right)^{2} \sin\left(\phi\right) & 2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) \\ -{\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\theta\right) & 2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) & 2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} \end{array}\right)
In [16]:
for i in range(2): show((Lambda*e[i]*Lambda.transpose()).simplify_trig())
(cos(ϕ)2sin(θ)2cos(ϕ)2+sin(ϕ)2cos(ϕ)sin(ϕ)sin(θ)22cos(ϕ)sin(ϕ)cos(ϕ)cos(θ)sin(θ)cos(ϕ)sin(ϕ)sin(θ)22cos(ϕ)sin(ϕ)sin(ϕ)2sin(θ)2+cos(ϕ)2sin(ϕ)2cos(θ)sin(ϕ)sin(θ)cos(ϕ)cos(θ)sin(θ)cos(θ)sin(ϕ)sin(θ)sin(θ)2)\left(\begin{array}{rrr} \cos\left(\phi\right)^{2} \sin\left(\theta\right)^{2} - \cos\left(\phi\right)^{2} + \sin\left(\phi\right)^{2} & \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} - 2 \, \cos\left(\phi\right) \sin\left(\phi\right) & \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\theta\right) \\ \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} - 2 \, \cos\left(\phi\right) \sin\left(\phi\right) & \sin\left(\phi\right)^{2} \sin\left(\theta\right)^{2} + \cos\left(\phi\right)^{2} - \sin\left(\phi\right)^{2} & \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) \\ \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\theta\right) & \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) & -\sin\left(\theta\right)^{2} \end{array}\right)
(2cos(ϕ)cos(θ)sin(ϕ)(2cos(ϕ)21)cos(θ)sin(ϕ)sin(θ)(2cos(ϕ)21)cos(θ)2cos(ϕ)cos(θ)sin(ϕ)cos(ϕ)sin(θ)sin(ϕ)sin(θ)cos(ϕ)sin(θ)0)\left(\begin{array}{rrr} 2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) & -{\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) & -\sin\left(\phi\right) \sin\left(\theta\right) \\ -{\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) & -2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) & \cos\left(\phi\right) \sin\left(\theta\right) \\ -\sin\left(\phi\right) \sin\left(\theta\right) & \cos\left(\phi\right) \sin\left(\theta\right) & 0 \end{array}\right)
In [ ]: