CoCalc Public Filespolarization tensors in detector's frame.ipynbOpen with one click!
Author: Chan Park
Views : 160
Description: Polarization Tensors in Detector's Frame
Compute Environment: Ubuntu 18.04 (Deprecated)
In [1]:
%display latex
In [2]:
theta, phi, psi = var('theta, phi, psi')
In [3]:
R_z = matrix([[cos(x),-sin(x),0],[sin(x),cos(x),0],[0,0,1]])
In [4]:
R_y = matrix([[cos(x),0,sin(x)],[0,1,0],[-sin(x),0,cos(x)]])
In [5]:
R1 = R_z(x=phi); 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 [6]:
R2 = R_y(x=theta); R2
(cos(θ)0sin(θ)010sin(θ)0cos(θ))\left(\begin{array}{rrr} \cos\left(\theta\right) & 0 & \sin\left(\theta\right) \\ 0 & 1 & 0 \\ -\sin\left(\theta\right) & 0 & \cos\left(\theta\right) \end{array}\right)
In [7]:
R3 = R_z(x=psi); R3
(cos(ψ)sin(ψ)0sin(ψ)cos(ψ)0001)\left(\begin{array}{rrr} \cos\left(\psi\right) & -\sin\left(\psi\right) & 0 \\ \sin\left(\psi\right) & \cos\left(\psi\right) & 0 \\ 0 & 0 & 1 \end{array}\right)
In [8]:
Lambda = R1*R2*R3; Lambda
(cos(ϕ)cos(ψ)cos(θ)sin(ϕ)sin(ψ)cos(ϕ)cos(θ)sin(ψ)cos(ψ)sin(ϕ)cos(ϕ)sin(θ)cos(ψ)cos(θ)sin(ϕ)+cos(ϕ)sin(ψ)cos(θ)sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)sin(ϕ)sin(θ)cos(ψ)sin(θ)sin(ψ)sin(θ)cos(θ))\left(\begin{array}{rrr} \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) - \sin\left(\phi\right) \sin\left(\psi\right) & -\cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\psi\right) - \cos\left(\psi\right) \sin\left(\phi\right) & \cos\left(\phi\right) \sin\left(\theta\right) \\ \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + \cos\left(\phi\right) \sin\left(\psi\right) & -\cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) & \sin\left(\phi\right) \sin\left(\theta\right) \\ -\cos\left(\psi\right) \sin\left(\theta\right) & \sin\left(\psi\right) \sin\left(\theta\right) & \cos\left(\theta\right) \end{array}\right)
In [9]:
Lambda_inverse = R3(psi=-psi)*R2(theta=-theta)*R1(phi=-phi); Lambda_inverse.simplify_trig()
(cos(ϕ)cos(ψ)cos(θ)sin(ϕ)sin(ψ)cos(ψ)cos(θ)sin(ϕ)+cos(ϕ)sin(ψ)cos(ψ)sin(θ)cos(ϕ)cos(θ)sin(ψ)cos(ψ)sin(ϕ)cos(θ)sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)sin(ψ)sin(θ)cos(ϕ)sin(θ)sin(ϕ)sin(θ)cos(θ))\left(\begin{array}{rrr} \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) - \sin\left(\phi\right) \sin\left(\psi\right) & \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + \cos\left(\phi\right) \sin\left(\psi\right) & -\cos\left(\psi\right) \sin\left(\theta\right) \\ -\cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\psi\right) - \cos\left(\psi\right) \sin\left(\phi\right) & -\cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) & \sin\left(\psi\right) \sin\left(\theta\right) \\ \cos\left(\phi\right) \sin\left(\theta\right) & \sin\left(\phi\right) \sin\left(\theta\right) & \cos\left(\theta\right) \end{array}\right)
In [10]:
(Lambda*Lambda_inverse).simplify_trig()
(100010001)\left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{array}\right)
In [11]:
e = [ matrix([[1,0,0],[0,-1,0],[0,0,0]]), matrix([[0,1,0],[1,0,0],[0,0,0]]), matrix([[1,0,0],[0,1,0],[0,0,0]]), matrix([[0,0,0],[0,0,0],[0,0,sqrt(2)]]), matrix([[0,0,1],[0,0,0],[1,0,0]]), matrix([[0,0,0],[0,0,1],[0,1,0]]) ]; e
[(100010000),(010100000),(100010000),(000000002),(001000100),(000001010)]\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), \left(\begin{array}{rrr} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 0 \end{array}\right), \left(\begin{array}{rrr} 0 & 0 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & \sqrt{2} \end{array}\right), \left(\begin{array}{rrr} 0 & 0 & 1 \\ 0 & 0 & 0 \\ 1 & 0 & 0 \end{array}\right), \left(\begin{array}{rrr} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 1 & 0 \end{array}\right)\right]
In [12]:
e_bar = [] for i in range(6): e_bar.append(Lambda*e[i]*Lambda_inverse) show(e_bar[i].simplify_trig())
(4cos(ϕ)cos(ψ)cos(θ)sin(ϕ)sin(ψ)2(2sin(ϕ)21)cos(ψ)2+(2(sin(ϕ)21)cos(ψ)2sin(ϕ)2+1)sin(θ)2+2sin(ϕ)214cos(ϕ)cos(ψ)2sin(ϕ)2(2sin(ϕ)21)cos(ψ)cos(θ)sin(ψ)(2cos(ϕ)cos(ψ)2sin(ϕ)cos(ϕ)sin(ϕ))sin(θ)22cos(ϕ)sin(ϕ)(2cos(ψ)sin(ϕ)sin(ψ)(2cos(ϕ)cos(ψ)2cos(ϕ))cos(θ))sin(θ)4cos(ϕ)cos(ψ)2sin(ϕ)2(2sin(ϕ)21)cos(ψ)cos(θ)sin(ψ)(2cos(ϕ)cos(ψ)2sin(ϕ)cos(ϕ)sin(ϕ))sin(θ)22cos(ϕ)sin(ϕ)4cos(ϕ)cos(ψ)cos(θ)sin(ϕ)sin(ψ)+2(2sin(ϕ)21)cos(ψ)2(2cos(ψ)2sin(ϕ)2sin(ϕ)2)sin(θ)22sin(ϕ)2+1(2cos(ϕ)cos(ψ)sin(ψ)+(2cos(ψ)2sin(ϕ)sin(ϕ))cos(θ))sin(θ)(2cos(ψ)sin(ϕ)sin(ψ)(2cos(ϕ)cos(ψ)2cos(ϕ))cos(θ))sin(θ)(2cos(ϕ)cos(ψ)sin(ψ)+(2cos(ψ)2sin(ϕ)sin(ϕ))cos(θ))sin(θ)(2cos(ψ)21)sin(θ)2)\left(\begin{array}{rrr} -4 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) - 2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)^{2} + {\left(2 \, {\left(\sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)^{2} - \sin\left(\phi\right)^{2} + 1\right)} \sin\left(\theta\right)^{2} + 2 \, \sin\left(\phi\right)^{2} - 1 & 4 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} \sin\left(\phi\right) - 2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} \sin\left(\phi\right) - \cos\left(\phi\right) \sin\left(\phi\right)\right)} \sin\left(\theta\right)^{2} - 2 \, \cos\left(\phi\right) \sin\left(\phi\right) & {\left(2 \, \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} - \cos\left(\phi\right)\right)} \cos\left(\theta\right)\right)} \sin\left(\theta\right) \\ 4 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} \sin\left(\phi\right) - 2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} \sin\left(\phi\right) - \cos\left(\phi\right) \sin\left(\phi\right)\right)} \sin\left(\theta\right)^{2} - 2 \, \cos\left(\phi\right) \sin\left(\phi\right) & 4 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + 2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)^{2} - {\left(2 \, \cos\left(\psi\right)^{2} \sin\left(\phi\right)^{2} - \sin\left(\phi\right)^{2}\right)} \sin\left(\theta\right)^{2} - 2 \, \sin\left(\phi\right)^{2} + 1 & -{\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\psi\right) + {\left(2 \, \cos\left(\psi\right)^{2} \sin\left(\phi\right) - \sin\left(\phi\right)\right)} \cos\left(\theta\right)\right)} \sin\left(\theta\right) \\ {\left(2 \, \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} - \cos\left(\phi\right)\right)} \cos\left(\theta\right)\right)} \sin\left(\theta\right) & -{\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\psi\right) + {\left(2 \, \cos\left(\psi\right)^{2} \sin\left(\phi\right) - \sin\left(\phi\right)\right)} \cos\left(\theta\right)\right)} \sin\left(\theta\right) & {\left(2 \, \cos\left(\psi\right)^{2} - 1\right)} \sin\left(\theta\right)^{2} \end{array}\right)
(2(sin(ϕ)21)cos(ψ)sin(ψ)sin(θ)2+2(2sin(ϕ)21)cos(ψ)sin(ψ)+2(2cos(ϕ)sin(ϕ)sin(ψ)2cos(ϕ)sin(ϕ))cos(θ)2cos(ϕ)cos(ψ)sin(ϕ)sin(ψ)sin(θ)24cos(ϕ)cos(ψ)sin(ϕ)sin(ψ)+(2(2sin(ϕ)21)sin(ψ)22sin(ϕ)2+1)cos(θ)(2cos(ϕ)cos(ψ)cos(θ)sin(ψ)2sin(ϕ)sin(ψ)2+sin(ϕ))sin(θ)2cos(ϕ)cos(ψ)sin(ϕ)sin(ψ)sin(θ)24cos(ϕ)cos(ψ)sin(ϕ)sin(ψ)+(2(2sin(ϕ)21)sin(ψ)22sin(ϕ)2+1)cos(θ)2cos(ψ)sin(ϕ)2sin(ψ)sin(θ)22(2sin(ϕ)21)cos(ψ)sin(ψ)2(2cos(ϕ)sin(ϕ)sin(ψ)2cos(ϕ)sin(ϕ))cos(θ)(2cos(ψ)cos(θ)sin(ϕ)sin(ψ)+2cos(ϕ)sin(ψ)2cos(ϕ))sin(θ)(2cos(ϕ)cos(ψ)cos(θ)sin(ψ)2sin(ϕ)sin(ψ)2+sin(ϕ))sin(θ)(2cos(ψ)cos(θ)sin(ϕ)sin(ψ)+2cos(ϕ)sin(ψ)2cos(ϕ))sin(θ)2cos(ψ)sin(ψ)sin(θ)2)\left(\begin{array}{rrr} -2 \, {\left(\sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} + 2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \sin\left(\psi\right) + 2 \, {\left(2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)^{2} - \cos\left(\phi\right) \sin\left(\phi\right)\right)} \cos\left(\theta\right) & 2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} - 4 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) + {\left(2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \sin\left(\psi\right)^{2} - 2 \, \sin\left(\phi\right)^{2} + 1\right)} \cos\left(\theta\right) & {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\psi\right) - 2 \, \sin\left(\phi\right) \sin\left(\psi\right)^{2} + \sin\left(\phi\right)\right)} \sin\left(\theta\right) \\ 2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} - 4 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) + {\left(2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \sin\left(\psi\right)^{2} - 2 \, \sin\left(\phi\right)^{2} + 1\right)} \cos\left(\theta\right) & 2 \, \cos\left(\psi\right) \sin\left(\phi\right)^{2} \sin\left(\psi\right) \sin\left(\theta\right)^{2} - 2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \sin\left(\psi\right) - 2 \, {\left(2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)^{2} - \cos\left(\phi\right) \sin\left(\phi\right)\right)} \cos\left(\theta\right) & {\left(2 \, \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + 2 \, \cos\left(\phi\right) \sin\left(\psi\right)^{2} - \cos\left(\phi\right)\right)} \sin\left(\theta\right) \\ {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\psi\right) - 2 \, \sin\left(\phi\right) \sin\left(\psi\right)^{2} + \sin\left(\phi\right)\right)} \sin\left(\theta\right) & {\left(2 \, \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + 2 \, \cos\left(\phi\right) \sin\left(\psi\right)^{2} - \cos\left(\phi\right)\right)} \sin\left(\theta\right) & -2 \, \cos\left(\psi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} \end{array}\right)
((sin(ϕ)21)sin(θ)2+1cos(ϕ)sin(ϕ)sin(θ)2cos(ϕ)cos(θ)sin(θ)cos(ϕ)sin(ϕ)sin(θ)2sin(ϕ)2sin(θ)2+1cos(θ)sin(ϕ)sin(θ)cos(ϕ)cos(θ)sin(θ)cos(θ)sin(ϕ)sin(θ)sin(θ)2)\left(\begin{array}{rrr} {\left(\sin\left(\phi\right)^{2} - 1\right)} \sin\left(\theta\right)^{2} + 1 & -\cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} & -\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} & -\sin\left(\phi\right)^{2} \sin\left(\theta\right)^{2} + 1 & -\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(ϕ)2sin(θ)22cos(ϕ)sin(ϕ)sin(θ)22cos(ϕ)cos(θ)sin(θ)2cos(ϕ)sin(ϕ)sin(θ)22sin(ϕ)2sin(θ)22cos(θ)sin(ϕ)sin(θ)2cos(ϕ)cos(θ)sin(θ)2cos(θ)sin(ϕ)sin(θ)2cos(θ)2)\left(\begin{array}{rrr} \sqrt{2} \cos\left(\phi\right)^{2} \sin\left(\theta\right)^{2} & \sqrt{2} \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} & \sqrt{2} \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\theta\right) \\ \sqrt{2} \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} & \sqrt{2} \sin\left(\phi\right)^{2} \sin\left(\theta\right)^{2} & \sqrt{2} \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) \\ \sqrt{2} \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\theta\right) & \sqrt{2} \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) & \sqrt{2} \cos\left(\theta\right)^{2} \end{array}\right)
(2(cos(ϕ)2cos(ψ)cos(θ)cos(ϕ)sin(ϕ)sin(ψ))sin(θ)(2cos(ϕ)cos(ψ)cos(θ)sin(ϕ)+(2cos(ϕ)21)sin(ψ))sin(θ)2cos(ϕ)cos(ψ)sin(θ)2cos(θ)sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)(2cos(ϕ)cos(ψ)cos(θ)sin(ϕ)+(2cos(ϕ)21)sin(ψ))sin(θ)2((cos(ϕ)21)cos(ψ)cos(θ)cos(ϕ)sin(ϕ)sin(ψ))sin(θ)2cos(ψ)sin(ϕ)sin(θ)2+cos(ϕ)cos(θ)sin(ψ)+cos(ψ)sin(ϕ)2cos(ϕ)cos(ψ)sin(θ)2cos(θ)sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)2cos(ψ)sin(ϕ)sin(θ)2+cos(ϕ)cos(θ)sin(ψ)+cos(ψ)sin(ϕ)2cos(ψ)cos(θ)sin(θ))\left(\begin{array}{rrr} 2 \, {\left(\cos\left(\phi\right)^{2} \cos\left(\psi\right) \cos\left(\theta\right) - \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)\right)} \sin\left(\theta\right) & {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\psi\right)\right)} \sin\left(\theta\right) & -2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\theta\right)^{2} - \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) \\ {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\psi\right)\right)} \sin\left(\theta\right) & -2 \, {\left({\left(\cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \cos\left(\theta\right) - \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)\right)} \sin\left(\theta\right) & -2 \, \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} + \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\psi\right) + \cos\left(\psi\right) \sin\left(\phi\right) \\ -2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\theta\right)^{2} - \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) & -2 \, \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} + \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\psi\right) + \cos\left(\psi\right) \sin\left(\phi\right) & -2 \, \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\theta\right) \end{array}\right)
(2(cos(ϕ)2cos(θ)sin(ψ)+cos(ϕ)cos(ψ)sin(ϕ))sin(θ)(2cos(ϕ)cos(θ)sin(ϕ)sin(ψ)(2cos(ϕ)21)cos(ψ))sin(θ)2cos(ϕ)cos(θ)2sin(ψ)cos(ψ)cos(θ)sin(ϕ)+cos(ϕ)sin(ψ)(2cos(ϕ)cos(θ)sin(ϕ)sin(ψ)(2cos(ϕ)21)cos(ψ))sin(θ)2(cos(ϕ)cos(ψ)sin(ϕ)+(cos(ϕ)21)cos(θ)sin(ψ))sin(θ)2cos(θ)2sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)cos(θ)+sin(ϕ)sin(ψ)2cos(ϕ)cos(θ)2sin(ψ)cos(ψ)cos(θ)sin(ϕ)+cos(ϕ)sin(ψ)2cos(θ)2sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)cos(θ)+sin(ϕ)sin(ψ)2cos(θ)sin(ψ)sin(θ))\left(\begin{array}{rrr} -2 \, {\left(\cos\left(\phi\right)^{2} \cos\left(\theta\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right)\right)} \sin\left(\theta\right) & -{\left(2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)\right)} \sin\left(\theta\right) & -2 \, \cos\left(\phi\right) \cos\left(\theta\right)^{2} \sin\left(\psi\right) - \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + \cos\left(\phi\right) \sin\left(\psi\right) \\ -{\left(2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)\right)} \sin\left(\theta\right) & 2 \, {\left(\cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) + {\left(\cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) \sin\left(\psi\right)\right)} \sin\left(\theta\right) & -2 \, \cos\left(\theta\right)^{2} \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) + \sin\left(\phi\right) \sin\left(\psi\right) \\ -2 \, \cos\left(\phi\right) \cos\left(\theta\right)^{2} \sin\left(\psi\right) - \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + \cos\left(\phi\right) \sin\left(\psi\right) & -2 \, \cos\left(\theta\right)^{2} \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) + \sin\left(\phi\right) \sin\left(\psi\right) & 2 \, \cos\left(\theta\right) \sin\left(\psi\right) \sin\left(\theta\right) \end{array}\right)
In [13]:
a = matrix(SR, 6,6) for i in range(6): for j in range(6): a[i,j] = sum(sum(e[i].elementwise_product(Lambda*e[j]*Lambda.transpose()/2))).simplify_trig() a
(4cos(ϕ)cos(ψ)cos(θ)sin(ϕ)sin(ψ)+(2cos(ϕ)21)cos(ψ)2+12(2(2cos(ϕ)21)cos(ψ)22cos(ϕ)2+1)cos(θ)2cos(ϕ)2+12(2cos(ϕ)21)cos(ψ)sin(ψ)sin(θ)22(2cos(ϕ)21)cos(ψ)sin(ψ)+2(2cos(ϕ)sin(ϕ)sin(ψ)2cos(ϕ)sin(ϕ))cos(θ)12(2cos(ϕ)21)sin(θ)212(22cos(ϕ)22)sin(θ)2((2cos(ϕ)21)cos(ψ)cos(θ)2cos(ϕ)sin(ϕ)sin(ψ))sin(θ)(2cos(ϕ)cos(ψ)sin(ϕ)+(2cos(ϕ)21)cos(θ)sin(ψ))sin(θ)2(2sin(ϕ)21)cos(ψ)cos(θ)sin(ψ)4cos(ϕ)sin(ϕ)sin(ψ)2+(2cos(ϕ)sin(ϕ)sin(ψ)2cos(ϕ)sin(ϕ))sin(θ)2+2cos(ϕ)sin(ϕ)2cos(ϕ)cos(ψ)sin(ϕ)sin(ψ)sin(θ)24cos(ϕ)cos(ψ)sin(ϕ)sin(ψ)+(2(2cos(ϕ)21)cos(ψ)22cos(ϕ)2+1)cos(θ)cos(ϕ)sin(ϕ)sin(θ)22cos(ϕ)sin(ϕ)sin(θ)2(2cos(ϕ)cos(ψ)cos(θ)sin(ϕ)+(2cos(ϕ)21)sin(ψ))sin(θ)(2cos(ϕ)cos(θ)sin(ϕ)sin(ψ)(2cos(ϕ)21)cos(ψ))sin(θ)12(2cos(ψ)21)sin(θ)2cos(ψ)sin(ψ)sin(θ)212cos(θ)2+12122sin(θ)2cos(ψ)cos(θ)sin(θ)cos(θ)sin(ψ)sin(θ)122(2cos(ψ)21)sin(θ)22cos(ψ)sin(ψ)sin(θ)2122sin(θ)2cos(θ)22cos(ψ)cos(θ)sin(θ)2cos(θ)sin(ψ)sin(θ)(2cos(ψ)sin(ϕ)sin(ψ)(2cos(ϕ)cos(ψ)2cos(ϕ))cos(θ))sin(θ)(2cos(ϕ)cos(ψ)cos(θ)sin(ψ)2sin(ϕ)sin(ψ)2+sin(ϕ))sin(θ)cos(ϕ)cos(θ)sin(θ)2cos(ϕ)cos(θ)sin(θ)2cos(ϕ)cos(ψ)sin(θ)2cos(θ)sin(ϕ)sin(ψ)+cos(ϕ)cos(ψ)2cos(ϕ)sin(ψ)sin(θ)2cos(ψ)cos(θ)sin(ϕ)cos(ϕ)sin(ψ)(2cos(ϕ)cos(ψ)sin(ψ)+(2cos(ψ)2sin(ϕ)sin(ϕ))cos(θ))sin(θ)(2cos(ψ)cos(θ)sin(ϕ)sin(ψ)2cos(ϕ)cos(ψ)2+cos(ϕ))sin(θ)cos(θ)sin(ϕ)sin(θ)2cos(θ)sin(ϕ)sin(θ)2cos(ψ)sin(ϕ)sin(θ)2+cos(ϕ)cos(θ)sin(ψ)+cos(ψ)sin(ϕ)2sin(ϕ)sin(ψ)sin(θ)2+cos(ϕ)cos(ψ)cos(θ)sin(ϕ)sin(ψ))\left(\begin{array}{rrrrrr} -4 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)^{2} + \frac{1}{2} \, {\left(2 \, {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)^{2} - 2 \, \cos\left(\phi\right)^{2} + 1\right)} \cos\left(\theta\right)^{2} - \cos\left(\phi\right)^{2} + \frac{1}{2} & {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} - 2 \, {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \sin\left(\psi\right) + 2 \, {\left(2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)^{2} - \cos\left(\phi\right) \sin\left(\phi\right)\right)} \cos\left(\theta\right) & -\frac{1}{2} \, {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\theta\right)^{2} & \frac{1}{2} \, {\left(2 \, \sqrt{2} \cos\left(\phi\right)^{2} - \sqrt{2}\right)} \sin\left(\theta\right)^{2} & {\left({\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \cos\left(\theta\right) - 2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)\right)} \sin\left(\theta\right) & -{\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) + {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\theta\right) \sin\left(\psi\right)\right)} \sin\left(\theta\right) \\ -2 \, {\left(2 \, \sin\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\psi\right) - 4 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)^{2} + {\left(2 \, \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\psi\right)^{2} - \cos\left(\phi\right) \sin\left(\phi\right)\right)} \sin\left(\theta\right)^{2} + 2 \, \cos\left(\phi\right) \sin\left(\phi\right) & 2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} - 4 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) + {\left(2 \, {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)^{2} - 2 \, \cos\left(\phi\right)^{2} + 1\right)} \cos\left(\theta\right) & -\cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} & \sqrt{2} \cos\left(\phi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} & {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) + {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \sin\left(\psi\right)\right)} \sin\left(\theta\right) & -{\left(2 \, \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right)^{2} - 1\right)} \cos\left(\psi\right)\right)} \sin\left(\theta\right) \\ -\frac{1}{2} \, {\left(2 \, \cos\left(\psi\right)^{2} - 1\right)} \sin\left(\theta\right)^{2} & \cos\left(\psi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} & \frac{1}{2} \, \cos\left(\theta\right)^{2} + \frac{1}{2} & \frac{1}{2} \, \sqrt{2} \sin\left(\theta\right)^{2} & \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\theta\right) & -\cos\left(\theta\right) \sin\left(\psi\right) \sin\left(\theta\right) \\ \frac{1}{2} \, \sqrt{2} {\left(2 \, \cos\left(\psi\right)^{2} - 1\right)} \sin\left(\theta\right)^{2} & -\sqrt{2} \cos\left(\psi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} & \frac{1}{2} \, \sqrt{2} \sin\left(\theta\right)^{2} & \cos\left(\theta\right)^{2} & -\sqrt{2} \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\theta\right) & \sqrt{2} \cos\left(\theta\right) \sin\left(\psi\right) \sin\left(\theta\right) \\ {\left(2 \, \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\psi\right) - {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} - \cos\left(\phi\right)\right)} \cos\left(\theta\right)\right)} \sin\left(\theta\right) & {\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\psi\right) - 2 \, \sin\left(\phi\right) \sin\left(\psi\right)^{2} + \sin\left(\phi\right)\right)} \sin\left(\theta\right) & -\cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\theta\right) & \sqrt{2} \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\theta\right) & -2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\theta\right)^{2} - \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) + \cos\left(\phi\right) \cos\left(\psi\right) & 2 \, \cos\left(\phi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} - \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) - \cos\left(\phi\right) \sin\left(\psi\right) \\ -{\left(2 \, \cos\left(\phi\right) \cos\left(\psi\right) \sin\left(\psi\right) + {\left(2 \, \cos\left(\psi\right)^{2} \sin\left(\phi\right) - \sin\left(\phi\right)\right)} \cos\left(\theta\right)\right)} \sin\left(\theta\right) & {\left(2 \, \cos\left(\psi\right) \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\psi\right) - 2 \, \cos\left(\phi\right) \cos\left(\psi\right)^{2} + \cos\left(\phi\right)\right)} \sin\left(\theta\right) & -\cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) & \sqrt{2} \cos\left(\theta\right) \sin\left(\phi\right) \sin\left(\theta\right) & -2 \, \cos\left(\psi\right) \sin\left(\phi\right) \sin\left(\theta\right)^{2} + \cos\left(\phi\right) \cos\left(\theta\right) \sin\left(\psi\right) + \cos\left(\psi\right) \sin\left(\phi\right) & 2 \, \sin\left(\phi\right) \sin\left(\psi\right) \sin\left(\theta\right)^{2} + \cos\left(\phi\right) \cos\left(\psi\right) \cos\left(\theta\right) - \sin\left(\phi\right) \sin\left(\psi\right) \end{array}\right)
In [14]:
T = Spherical('radius', ['inclination', 'azimuth'])
In [15]:
r = var('r')
In [16]:
T.transform(radius=r, azimuth=phi, inclination=theta)
(rcos(ϕ)sin(θ),rsin(ϕ)sin(θ),rcos(θ))\left(r \cos\left(\phi\right) \sin\left(\theta\right), r \sin\left(\phi\right) \sin\left(\theta\right), r \cos\left(\theta\right)\right)
In [17]:
# cm = colormaps.hsv # def c(x,y): # return float((x+y+x*y)/15) % 1 # pol = ['+', 'cross', 'b', 'l', 'x', 'y'] # for j,k in [(0,0),(1,1),(2,2),(0,1),(1,2),(2,0)]: # for i in range(2): # print('polarization: '+pol[i]+', ('+str(j+1)+','+str(k+1)+') component') # show(plot3d(e_bar[i][j][k], (theta, 0, pi), (phi, 0, 2*pi), transformation=T, color=(c,cm)))
In [ ]: