CoCalc Public Filesson's method.ipynb
Author: Chan Park
Views : 79
Description: SOGRO
Compute Environment: Ubuntu 18.04 (Deprecated)
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

$\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

$\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()

$\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()

$\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

$\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())

$\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)$
$\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())

$\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)$
$\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 [ ]: