#To calculate the numerical aperture, critical angle,acceptance angle
#importing modules
import math
#Variable declaration
n1 = 1.5; #refractive index of core
n2 = 1.47; #refractive index of cladding
n0 = 1; #refractive index of air
a = 180/math.pi; #conversion factor of radian to degree
#Calculation
NA = math.sqrt((n1**2)-(n2**2)); #numerical aperture
NA=math.ceil(NA*10)/10; #rounding off to 1 decimal
alpha_m = math.asin(NA/n0); #acceptance angle(radian)
alpha_m = alpha_m*a; #acceptance angle(degrees)
alpha_m=math.ceil(alpha_m*10**2)/10**2; #rounding off to 2 decimals
phi_m = math.asin(NA/n1); #phase angle(radian)
phi_m = phi_m*a; #phase angle(degrees)
phi_m=math.ceil(phi_m*10**2)/10**2; #rounding off to 2 decimals
theta_c = math.asin(n2/n1); #critical angle(radian)
theta_c = theta_c*a; #critical angle(degrees)
theta_c=math.ceil(theta_c*10**3)/10**3; #rounding off to 3 decimals
#Result
print "numerical aperture is",NA
print "acceptance angle is",alpha_m,"degrees"
print "phase angle is",phi_m,"degrees"
print "critical angle is",theta_c,"degrees"
#To calculate the pulse broadening
#importing modules
import math
#Variable declaration
n1 = 1.5; #refractive index of core
n2 = 1.47; #refractive index of cladding
c = 3*10**8; #velocity of light(m/sec)
#Calculation
deltatbyL = (n1/n2)*((n1-n2)/c);
#Result
print "pulse broadening per unit length is",deltatbyL,"s/m"
#To calculate the minimum and maximum number of total internal reflections
#importing modules
import math
#Variable declaration
phi_m = 11.54; #phase angle(degrees)
a = 0.5*10**-4;
x = math.pi/180; #conversion factor from degrees to radians
#Calculation
phi_m = phi_m*x; #phase angle(radian)
L = a/math.tan(phi_m); #length(m)
n = 1/(2*L); #total number of internal reflections(m-1)
#Result
print "rays travelling with alpha = 0 suffer no reflection. therefore minimum number of reflections per metre is 0."
print "for rays travelling with alpha = alpha_m, the total number of internal reflections for 1m is",int(n),"m-1"