```python
from sympy import *

var('alpha phi theta A B M N Z G R')

#A=Matrix([[Mul(cos(alpha),cos(phi)),Mul(sin(alpha),cos(phi)),-sin(phi)],[-sin(alpha),cos(alpha),0],[Mul(cos(alpha),sin(phi)),Mul(sin(alpha),sin(phi)),cos(phi)]])
Z=Matrix([[cos(alpha)*cos(phi),sin(alpha)*cos(phi),-sin(phi)],[-sin(alpha),cos(alpha),0],[cos(alpha)*sin(phi),sin(alpha)*sin(phi),cos(phi)]])


G=Matrix([[cos(theta),-sin(theta),0],[sin(theta),cos(theta),0],[0,0,1]])


R=(Z.T).multiply(G.multiply(Z))
#print_latex(N)
print_latex(R.applyfunc(simplify))
R.applyfunc(simplify)

```

    \left[\begin{matrix}\sin^{2}{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} \cos{\left(\theta \right)} & - \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} - \sin{\left(\theta \right)} \cos{\left(\phi \right)} & \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} - \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)}\\- \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} + \sin{\left(\theta \right)} \cos{\left(\phi \right)} & - \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \cos{\left(\theta \right)} & \left(- \sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \cos{\left(\phi \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)}\\\left(- \sin{\left(\alpha \right)} \sin{\left(\theta \right)} - \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} & \left(- \sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} & \sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\end{matrix}\right]





$\displaystyle \left[\begin{matrix}\sin^{2}{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} \cos{\left(\theta \right)} & - \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} - \sin{\left(\theta \right)} \cos{\left(\phi \right)} & \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} - \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)}\\- \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)} + \sin{\left(\theta \right)} \cos{\left(\phi \right)} & - \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \cos{\left(\theta \right)} & \left(- \sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \cos{\left(\phi \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)}\\\left(- \sin{\left(\alpha \right)} \sin{\left(\theta \right)} - \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} & \left(- \sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} & \sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\end{matrix}\right]$




```python
((R[1,0]-R[0,1])/(2*sin(theta))).simplify()
```




$\displaystyle \cos{\left(\phi \right)}$




```python
((R[2,1]-R[1,2])/(2*sin(theta))).simplify()
```




$\displaystyle \sin{\left(\phi \right)} \cos{\left(\alpha \right)}$




```python
Z.inv()
```




$\displaystyle \left[\begin{matrix}\frac{\cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & - \frac{\sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & \frac{\sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}}\\\frac{\sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & \frac{\cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & \frac{\sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}}\\- \frac{\sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} & 0 & \frac{\cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\end{matrix}\right]$




```python
Z.T.inv()
```




$\displaystyle \left[\begin{matrix}\frac{\cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & \frac{\sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & - \frac{\sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\\- \frac{\sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & \frac{\cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & 0\\\frac{\sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & \frac{\sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & \frac{\cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\end{matrix}\right]$




```python
(Z.T.inv()*R*Z.inv()).applyfunc(simplify)
```




$\displaystyle \left[\begin{matrix}\cos{\left(\theta \right)} & - \sin{\left(\theta \right)} & 0\\\sin{\left(\theta \right)} & \cos{\left(\theta \right)} & 0\\0 & 0 & 1\end{matrix}\right]$




```python
(Z.inv()*R*Z.T.inv())
```




$\displaystyle \left[\begin{matrix}\frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(- \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} - \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(- \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} - \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & - \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(- \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} - \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\\\frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} - \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} - \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} & - \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)} + \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\alpha \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(- \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)} - \sin{\left(\phi \right)} \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\\\frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} - \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \sin{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \sin{\left(\phi \right)} \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \sin{\left(\alpha \right)} \cos{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin{\left(\phi \right)} \cos{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} \cos{\left(\phi \right)} + \cos{\left(\alpha \right)} \cos{\left(\theta \right)}\right) \sin{\left(\alpha \right)} + \left(\sin{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} - \sin{\left(\theta \right)} \cos{\left(\alpha \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} + \sin{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} \cos{\left(\alpha \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \cos{\left(\alpha \right)}}{\sin^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \sin{\left(\alpha \right)} \sin{\left(\phi \right)}}{\sin^{2}{\left(\alpha \right)} \sin^{2}{\left(\phi \right)} + \sin^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)} + \cos^{2}{\left(\alpha \right)} \cos^{2}{\left(\phi \right)}} & - \frac{\left(\frac{\left(- \left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \sin{\left(\phi \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(\left(\sin{\left(\alpha \right)} \sin{\left(\theta \right)} + \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)}\right) \cos{\left(\alpha \right)} \cos{\left(\phi \right)} - \left(- \sin{\left(\alpha \right)} \cos{\left(\theta \right)} + \sin{\left(\theta \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\alpha \right)} + \sin^{2}{\left(\phi \right)} \cos^{2}{\left(\alpha \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} + \frac{\left(\frac{\left(\sin^{2}{\left(\phi \right)} \cos{\left(\theta \right)} + \cos^{2}{\left(\phi \right)}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}} - \frac{\left(\sin{\left(\alpha \right)} \sin{\left(\phi \right)} \sin{\left(\theta \right)} - \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)} \cos{\left(\theta \right)} + \sin{\left(\phi \right)} \cos{\left(\alpha \right)} \cos{\left(\phi \right)}\right) \sin{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\right) \cos{\left(\phi \right)}}{\sin^{2}{\left(\phi \right)} + \cos^{2}{\left(\phi \right)}}\end{matrix}\right]$



b725b261869afffe183712a009a48c108a32a67d
ipynb
Jupyter Notebook
grain_boundary/matrix_cal.ipynb
lamdalamda/lamdalamda.github.io
5789975d4a8e28cfc78288b3624801f868d79dc6
MIT
grain_boundary/matrix_cal.ipynb
lamdalamda/lamdalamda.github.io
5789975d4a8e28cfc78288b3624801f868d79dc6
MIT
grain_boundary/matrix_cal.ipynb
lamdalamda/lamdalamda.github.io
5789975d4a8e28cfc78288b3624801f868d79dc6
MIT
Qwen/Qwen-72B
1. YES
2. YES