In [22]:
    
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
    
In [23]:
    
def rr(x, d):
    rr = np.abs(np.cos(x) - np.sqrt(d - np.sin(x)**2))**2 / np.abs(np.cos(x) + np.sqrt(d - np.sin(x)**2))**2
    return rr
def rp(x, d):
    rd = np.abs(np.cos(x) - np.sqrt(1/d - (1/d**2) * np.sin(x)**2))**2 / np.abs(np.cos(x) + np.sqrt(1/d - (1/d**2) * np.sin(x)**2))**2
    return rd
    
In [24]:
    
import IPython.html.widgets as widgets
from IPython.html.widgets import interact, interactive, fixed
    
The reflexion coefficient when the electric field is normal to the incidence plane is given by (here x is the incidence angle):
We now plot these two coefficients for different values of the refraction index, d is the cocient of the incidence refraction index and the transmited one. Notice that RR is always smaller than RP, giving always rise to some degree of polarization. For d < 1 there is a total reflexion angle, beyond which the reflexion coefficients become one. There is also, always a total polarization angle at which the electric reflexion coefficient vanishes.
In [25]:
    
@interact(d=(.1, 2))
def interactive_plot(d=2):
    x = np.linspace(0, np.pi/2, 1000)
    y_rr = rr(x, d)
    y_rp = rp(x, d)
    plt.figure(figsize=(10, 8))
    plt.plot(x, y_rr, x, y_rp)
    
    plt.xlim(0, np.pi/2)
    plt.grid()
    
    
The transmision angle as a function of the incidence angle is given by :
In [26]:
    
def xtrans(x, d):
    return np.arcsin(d * np.sin(x))
    
In [27]:
    
@interact(d=(.1, 2))
def interactive_plot(d=1):
    x = np.linspace(0.001, np.pi/2, 1000)
    y_xtrans = xtrans(x, d)
    plt.figure(figsize=(10, 8))
    plt.plot(x, y_xtrans)
    plt.xlim(0, np.pi/2)
    plt.grid()
    
    
In [28]:
    
#style
from IPython.core.display import HTML
css_file = '../style_ipython_notebook.css'
HTML(open(css_file, "r").read())
    
    Out[28]: