# The Jones Calculus: Symbolic Algebra

**Scott Prahl**

**April 2020**


```python
#this must be run first
%matplotlib inline

import matplotlib
import numpy as np
import matplotlib.pyplot as plt

import sympy
import pypolar.sym_jones as sym_jones
sympy.init_printing(use_latex='mathjax')

```

## Background

### Jones Vector for Linearly Polarized Light

A Jones vector is a 2x1 matrix that can represent fully polarized light.  Linearly polarized light is relatively simple
$$
\mbox{horizontal linearly polarized light}=
\left[\begin{array}{c} 
1\\
0\\
\end{array}\right]
$$
and


```python
sym_jones.field_horizontal()
```




$\displaystyle \left[\begin{matrix}1\\0\end{matrix}\right]$



$$
\mbox{vertical linearly polarized light}=
\left[\begin{array}{c} 
0\\
1\\
\end{array}\right]
$$


```python
sym_jones.field_vertical()
```




$\displaystyle \left[\begin{matrix}0\\1\end{matrix}\right]$



$$
\mbox{linearly polarized at $\theta$ from horizontal}=
\left[\begin{array}{c} 
\cos\theta\\
\sin\theta\\
\end{array}\right]
$$
So the vector for linearly polarized light at 45 degrees can be written in python as


```python
theta = sympy.Symbol('theta', real=True)
sym_jones.field_linear(theta)
```




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



### Jones Vectors for Circularly Polarized Light

For circularly polarized light, the direction of polarization rotates through an entire circle every wavelength, and retains a constant magnitude.  

Right circularly polarized light has the direction of polarization rotating clockwise when looking into the beam.  
$$
\mbox{right linearly polarized light}=
{1\over\sqrt{2}}\left[\begin{array}{c} 
j\\
1\\
\end{array}\right]
$$


```python
sym_jones.field_right_circular()
```




$\displaystyle \left[\begin{matrix}\frac{\sqrt{2}}{2}\\- \frac{\sqrt{2} i}{2}\end{matrix}\right]$



$$
\mbox{vertical linearly polarized light}=
{1\over\sqrt{2}}\left[\begin{array}{c} 
1\\
j\\
\end{array}\right]
$$
So the vector for left circularly polarized light can be written in python as


```python
sym_jones.field_left_circular()
```




$\displaystyle \left[\begin{matrix}\frac{\sqrt{2}}{2}\\\frac{\sqrt{2} i}{2}\end{matrix}\right]$



### Elliptically polarized light
In general, the expression for elliptically polarized light is
$$
\mathbf{I}=
\left[\begin{array}{c} 
A\\
Be^{j\delta}\\
\end{array}\right]
$$

### Irradiance
The scalar intensity of the beam is the square of the field $E\cdot E^*$,
$$
\left[\begin{array}{c} 
A\\
Be^{j\delta}\\
\end{array}\right]
\cdot
\left[\begin{array}{c} 
A^* &
B^*e^{-j\delta}\\
\end{array}\right]
$$
or
$$
I= A A^* + B B^*
$$ 
where $A^*$ is the complex conjugate of $A$.

## Jones Matrix for Linear Polarizer

The Jones matrix representing a perfect horizontal polarizer is
$$
\mathbf{H}=\mbox{Horizontal Linear Polarizer}=\left[\begin{array}{cc}
1 & 0\\
0 & 0\\
\end{array}\right]
$$

The matrix representing a rotation through an angle $\theta$ is
$$
\mathbf{R}(\theta)=\mbox{Rotation by $\theta$}=\left[\begin{array}{cc}
\cos\theta & \sin \theta\\
-\sin\theta & \cos\theta\\
\end{array}\right]
$$

The matrix representing a linear polarizer oriented at an angle of $\theta$ to the horizontal axis can by rotating the beam so the axis coincides with the horizontal axis and then unrotating by the same amount
$$
\mbox{Linear Polarizer at $\theta$} = \mathbf{R}(-\theta)\cdot\mathbf{H}\cdot\mathbf{R}(\theta)
$$



```python
## By rotation
theta = sympy.Symbol('theta', real=True)
H = sym_jones.op_linear_polarizer(0)
R = sym_jones.op_rotation(theta)
linear = sym_jones.op_rotation(-theta) * H * sym_jones.op_rotation(theta)
linear
```




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




```python
## Directly
sym_jones.op_linear_polarizer(theta)
```




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



### Retarders and Wave Plates

An optical retarder has a fast and a slow axis.  Light polarized parallel to the fast axis  moves through the wave plate faster than light polarized perpendicular to the fast axis.  A phase lag (or retardance) $\phi$ is created between the two polarization states.  The Jones matrix for a retarder with its fast axis oriented at $\theta$ is
$$
\left[\begin{array}{cc}
\cos{\phi\over2} + j\sin{\phi\over2}\cos2\theta & j \sin{\phi\over2}\sin 2\theta\\
j \sin{\phi\over2}\sin 2\theta & \cos{\phi\over2} - j\sin{\phi\over2}\cos2\theta 
\end{array}\right]
$$


```python
## are these the same??
phi = sympy.Symbol('phi', real=True)
sym_jones.op_retarder(theta,phi)
```




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




```python
theta = sympy.Symbol('theta', real=True)

slm = sym_jones.op_retarder(sympy.pi/2,phi)
i0 = sym_jones.field_linear(sympy.pi/4)
anal = sym_jones.op_linear_polarizer(theta)
result = slm * i0
result/result[0]
```




$\displaystyle \left[\begin{matrix}1\\e^{i \phi}\end{matrix}\right]$



HaIf the thickness of the retarder is $d$ and the fast and slow indices of refraction are $n_o$ and $n_e$, then the retardance for a wavelength $\lambda$ is
$$
\phi(\lambda) = {2\pi\over\lambda} d (n_o-n_e)
$$
A half-wave plate has $\phi(\lambda)=\pi$ and a Jones matrix
$$
\mathbf{M}_\mathrm{\lambda/2}=j \left[\begin{array}{cc}
\cos2\theta & \sin 2\theta\\
\sin2\theta & -\cos2\theta
\end{array}\right]
$$


```python
sympy.simplify(sym_jones.op_half_wave_plate(theta))
```




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



A quarter-wave plate has $\phi(\lambda)=\pi/2$ and
$$
\mathbf{M}_\mathrm{\lambda/4}={1\over\sqrt{2}}\left[\begin{array}{cc}
1 + j\cos2\theta & j\sin2\theta\\
j\sin2\theta & 1-j\cos 2\theta
\end{array}\right]
$$


```python
## same??
sym_jones.op_quarter_wave_plate(theta)
```




$\displaystyle \left[\begin{matrix}e^{- \frac{i \pi}{4}} \sin^{2}{\left(\theta \right)} + e^{\frac{i \pi}{4}} \cos^{2}{\left(\theta \right)} & \sqrt{2} i \sin{\left(\theta \right)} \cos{\left(\theta \right)}\\\sqrt{2} i \sin{\left(\theta \right)} \cos{\left(\theta \right)} & e^{\frac{i \pi}{4}} \sin^{2}{\left(\theta \right)} + e^{- \frac{i \pi}{4}} \cos^{2}{\left(\theta \right)}\end{matrix}\right]$



A retarder exhibits different retardances at a different wavelengths.  Because $n_o-n_e$ changes slowly with wavelength, the phase at $\lambda_1$ of a wave plated designed for $\lambda_0$ is
$$
\phi(\lambda_1) = \phi(\lambda_0) {\lambda_0\over\lambda_1}
$$
This is relevant because you will be using phase plates that are created for wavelengths other than 633nm.

### Optical Isolator




Linearly polarized light passes through the polarizer and is converted to right hand circularly polarized light by the quarter wave plate. Upon reflection, this beam will change handedness, and upon passage back through the quarter wave plate it is linear again but orthogonal to the polarizer.


## Malus's Law

Show that the transmission of linearly-polarized light as it passes through a linear analyzer at an angle $\theta$.


```python
incident = sym_jones.field_horizontal()
linear = sym_jones.op_linear_polarizer(theta)
result = linear * incident
intensity = sym_jones.intensity(result)
fraction = sympy.simplify(intensity)
fraction
```




$\displaystyle \cos^{2}{\left(\theta \right)}$




```python
theta = np.linspace(0, 180, 100)
plt.plot(theta, np.cos(np.radians(theta))**2)

plt.title('Malus\'s Law')
plt.xlabel( "Analyzer Angle (degrees)" )
plt.ylabel( "Transmission" )
plt.show()
```

## Crossed polarizers with quarter-wave plate between

Show that the total transmission of horizontally-polarized light that passes through a quarter-wave plate oriented at an angle $\theta$ and then through a vertical analyzer is $2\cos^2\theta\sin^2\theta$ and plot the transmitted light as the polarizer is rotated through 180 degrees. 



```python
theta = sympy.Symbol('theta', real=True)
incident = sym_jones.field_horizontal()

plate = sym_jones.op_quarter_wave_plate(theta)
analyzer = sym_jones.op_linear_polarizer(sympy.pi/2)
result = analyzer * plate * incident
fraction = sym_jones.intensity(result)
fraction

```




$\displaystyle 2 \sin^{2}{\left(\theta \right)} \cos^{2}{\left(\theta \right)}$




```python
theta = np.linspace(0, 180, 180)
th = 2*np.radians(theta)
plt.plot(theta, 0.5*np.sin(th)**2)

plt.title('Horizontal -> Quarter Wave Plate -> Vertical Analyzer')
plt.xlabel( "Quarter Waveplate angle (degrees)" )
plt.ylabel( "Transmission" )
plt.show()
```

## Crossed polarizers with half-wave plate between

Show that the total transmission of horizontally-polarized light that passes through a half-wave plate and then through a vertical linear analyzer is $4\sin^2\theta\cos^2\theta = \sin^2 2\theta$ and plot as the analyzer is rotated through 180 degrees. 



```python
theta = sympy.Symbol('theta', real=True)

incident = sym_jones.field_horizontal()
plate = sym_jones.op_half_wave_plate(theta)
analyzer = sym_jones.op_linear_polarizer(sympy.pi/2)

result = analyzer * plate * incident

fraction = sym_jones.intensity(result)
fraction
```




$\displaystyle 4 \sin^{2}{\left(\theta \right)} \cos^{2}{\left(\theta \right)}$




```python
theta = np.linspace(0, 180, 500)

plt.plot(theta, np.sin(np.radians(2*theta))**2 )

plt.title('Horizontal -> Half Wave Plate -> Vertical Analyzer')
plt.xlabel( "Half waveplate Angle (degrees)" )
plt.ylabel( "Transmission" )
plt.show()
```

## Waveplates not at design wavelength

The phase shift in a halfwave plate depends on the wavelength. If the halfwave plates are designed for 532nm light, but we use them for 633nm light then how will the measurements be affected?  (Assume the speeds along the fast and slow axis are independent of wavelength).

Plot the transmitted light for both 633 and 532nm light.


```python
f = sympy.Symbol('f', real=True)
theta = sympy.Symbol('theta', real=True)
lambda_0 = sympy.Symbol('lambda_0', real=True)
lambda_1 = sympy.Symbol('lambda_1', real=True)
f = lambda_0/lambda_1

incident = sym_jones.field_horizontal()
plate_1 = sym_jones.op_retarder(theta,f*sympy.pi)
analyzer = sym_jones.op_linear_polarizer(sympy.pi/2)

result_1 = analyzer * plate_1 * incident

fraction_1 = sym_jones.intensity(result_1)

fraction_1
```




$\displaystyle 4 \sin^{2}{\left(\theta \right)} \sin^{2}{\left(\frac{\pi \lambda_{0}}{2 \lambda_{1}} \right)} \cos^{2}{\left(\theta \right)}$




```python
lambda_0 = 532e-9
lambda_1 = 633e-9
theta = np.linspace(0, 180, 500)
plt.plot(theta, np.sin(np.radians(2*theta))**2 ,label='532nm')
plt.plot(theta, np.sin(lambda_0*np.pi/2/lambda_1)**2*np.sin(np.radians(2*theta))**2, label='633nm' )

plt.title('Horizontal -> Half Wave Plate -> Vertical Analyzer')
plt.xlabel( "Half waveplate Angle (degrees)" )
plt.ylabel( "Transmission" )
plt.legend()
plt.show()
```

e0e82084b337ab52f6e03a2bc2e04bb924028b6c
ipynb
Jupyter Notebook
docs/05a-Symbolic-Jones.ipynb
gyger/pypolar
2c212a4dbf0971003a2872db53d257a614f02ace
MIT
2018-07-26T02:46:23.000Z
2022-03-14T08:40:24.000Z
docs/05a-Symbolic-Jones.ipynb
gyger/pypolar
2c212a4dbf0971003a2872db53d257a614f02ace
MIT
2020-08-04T09:59:51.000Z
2021-06-03T20:02:25.000Z
docs/05a-Symbolic-Jones.ipynb
gyger/pypolar
2c212a4dbf0971003a2872db53d257a614f02ace
MIT
2018-07-26T12:43:29.000Z
2020-10-09T18:56:38.000Z
Qwen/Qwen-72B
1. YES
2. YES