#To find refractive index of of the glass
import math
# Given data
phi=0.7297; # Critical angle for glass-air interface
n2=1; # Refractive index of air
n1=n2/math.sin(phi); # Refractive index of glass
# Displaying the result in command window
print "\n Refractive index of the glass = ",round(n1,1)
#To calculate a)the speed of light b) The wavelenght in medium c) The wavenumber in medium
import math
#a)The speed of light
c=3*10**8; #Speed of light in free space (m/s)
n=1.45; #Given refractive index of dielectric medium
v=(c/n); #Speed of light in medium (in m/s)
#Displaying the result in command window
print" \nSpeed of light in medium =",round(v*10**-8,3)," X 10^8 m/s',"
#b) The wavelenght in medium
f=190*10**12; #Given operating frequency of laser
lambdam=(v/f); #Wavelenght in medium
#Displaying the result in command window
print" \nWavelenght of laser in medium =",round(lambdam*10**(6),4)," micrometer"
#c) The wavenumber in medium
k=(2*math.pi)/lambdam; #Wavenumber in medium
#Displaying the result in command window
print "\nWavenumber in medium =",round(k*10**-6,2)," X 10^6 m^-1"
# To calculate a)magnitude of the wave vector of the refracted wave b)x-component and z-component of the wave vector
import math
#Given data
n1=1; # Refractive index of air
n2=1.45; # Refractive index of slap
theta1=math.pi/3; # Angle of incidence
lambdam=1.0889*10**(-6); # Wavelength in medium
theta2=math.asin(math.sin(theta1)/n2); # Angle of refraction
# a)To calculate magnitude of the wave vector of the refracted wave
k=((2*math.pi)/lambdam); # Wavenumber
# Displaying the result in command window
print" Magnitude of the wave vector of the refracted wave is same as wave number =",round(k*10**(-6),2)," X 10^6 m^-1"
# b)To calculate x-component and z-component of the wave vector
kx=k*math.sin(theta2); # x-component of the wave vector
kz=k*math.cos(theta2); # z-component of the wave vector
# Displaying the result in command window
print"\n z-component of the wave vector =",round(kz*10**(-6),2)," X 10^6 m**-1"
print"\n x-component of the wave vector = ",round(kx*10**(-6),2)," X 10^6 m**-1"
# The answer is varrying due to round-off error
#To find length of the medium
import math
bandwidth=100*10**9; #Bandwidth of optical signal
w=2*math.pi*bandwidth; #Bandwidth of optical signal in rad/s
T=3.14*10**(-12); #Delay between minimum and maximum frequency component
beta2=10*(10**(-12))**2/10.0**3; #Group velocity dispersion parameter in s^2/km
L=T/(beta2*w); #Length of the medium
# Displaying the result in command window
print" Length of the medium =",round(L)," m"