import math
#Variable declaration
n1 = 1.54 #refractive index of core
NA = 0.5 #numerical aperture
#Calculation
n2 = math.sqrt(n1**2-NA**2)
#Result
print "Refractive index of cladding is",round(n2,2)
import math
#Variable declaration
n2 = 1.59 #refractive index of cladding
NA = 0.2 #numerical aperture
n0 = 1.33
#Calculation
n1 = (math.sqrt(n2**2-NA**2))
theta_o = (math.asin((math.sqrt(n2**2-n1**2)/n0)))*180/math.pi
#Result
print "Refractive index of core is",n2
print "Acceptance angle =",round(theta_o,2),"degrees"
import math
#Variable declaration
n1 = 1.49 #refractive index of core
n2 = 1.44 #refractive index of cladding
#Calculation
NA = math.sqrt(n1**2-n2**2)
theta_o = math.degrees(math.asin(NA))
#Result
print "Numerical Aperture =",round(NA,5)
print "Acceptance angle =",round(theta_o,2),"degrees"
import math
#Variable declaration
n1 = 1.6 #refractive index of core
n2 = 1.3 #refractive index of cladding
#Calculation
theta_c = math.degrees(math.asin(n2/n1))
theta_o = math.degrees(math.asin(math.sqrt(n1**2-n2**2)))
AC = 2*theta_o
#Result
print "Critical angle =",round(theta_c,2),"degrees"
print "Value of angle of acceptance cone =",round(AC,3),"degrees"
import math
#Variable declaration
n1 = 1.4 #refractive index of core
theta_o = 30 #acceptance angle(degrees)
#Calculation
n2 = math.sqrt(n1**2-math.sin(math.radians(theta_o))**2)
#Result
print "Refractive index of cladding is",round(n2,4)
#Variable declaration
n1 = 1.563 #refractive index of core
n2 = 1.498 #refractive index of cladding
#Calculation
delta = (n1-n2)/n1
#Result
print "Fractional index change =",round(delta,4)
#Variable declaration
n1 = 1.50 #refractive index of cladding
theta_c = 90-5 #critical angle(degrees)
#Calculation
n2 = math.sin(theta_c*math.pi/180)*n1
#Result
print "The maximum index of refraction allowed for cladding is",round(n2,4)
#Variable declaration
n1 = 1.33 #refractive index
theta_o = 30 #acceptance angle in air
#Calculations
theta_0 = math.degrees(math.asin(math.sin(theta_o*math.pi/180)/n1))
#Result
print "Acceptance angle =",round(theta_0,2),"degrees"
import math
#Variable declaration
n1 = 1.52 #refractive index of core
n2 = 1.5189 #refractive index of cladding
d = 29*10**-6 #core diameter(m)
lamda = 1.3*10**-6 #wavelength(m)
#Calculation
V = (math.pi*d*math.sqrt(n1**2-n2**2))/lamda
N = V**2/2
#Results
print "Normalized frequency =",round(V,3)
print "Number of modes =",round(N)
import math
#Variable declaration
n1 = 1.47 #refractive index of core
n2 = 1.46 #refractive index of cladding
lamda = 1300*10**-9 #wavelength(nm)
V = 2.405 #for single mode fibre
#Calculation
d = (V*lamda)/(math.pi*math.sqrt(n1**2-n2**2))
r = d/2
#Result
print "Radius =",round(r/1e-6,3),"um"
import math
#Variable declaration
n1 = 1.48 #refractive index of core
delta = 0.055 #relative RI
lamda = 1 #wavelength(um)
r = 50 #core radius(um)
#Calculations
n2 = -((delta*n1)-n1)
NA = math.sqrt(n1**2-n2**2)
theta_o = math.degrees(math.asin(NA))
V = (math.pi*2*r*NA)/lamda
N = V**2/2
#Results
print "Refractive index of cladding =",n2
print "NA =",round(NA,3)
print "Acceptance angle =",round(theta_o,2),"degrees"
print "Normalized frequency =",round(V,3)
print "Number of modes =",round(N) #Answer differs due to rounding off in 'V'
import math
#Variable declaration
n1 = 1.45 #refractive index of core
n2 = 1.448 #refractive index of cladding
lamda = 1*10**-6 #wavelength(m)
d = 6*10**-6 #core diameter(m)
#Calculations
#Case i
theta_c = math.degrees(math.asin(n2/n1))
#Case ii
theta_o = math.degrees(math.asin(math.sqrt(n1**2-n2**2)))
#Case iii
NA = math.sqrt(n1**2-n2**2)
N = (math.pi**2*d**2*NA**2)/(2*lamda**2)
#Results
print "Critical angle =",round(theta_c),"degrees"
print "Acceptance angle =",round(theta_o,3),"degrees"
print "Number of modes =",round(N)
import math
#Variable declaration
n1 = 1.50 #refractive index of core
n2 = 1.48 #refractive index of cladding
lamda = 1*10**-6 #wavelength(m)
d = 2*50*10**-6 #core diameter(m)
#Calculations
NA = math.sqrt(n1**2-n2**2)
N = (math.pi**2*d**2*NA**2)/(2*lamda**2)
#Result
print "Number of modes =",round(N)
import math
#Variable declaration
n1 = 1.55 #refractive index of core
n2 = 1.50 #refractive index of cladding
lamda = 1400*10**-9 #wavelength(m)
d = 40*10**-6 #core diameter(m)
#Calculations
NA = math.sqrt(n1**2-n2**2)
delta = (n1-n2)/n1
V = (math.pi*d*NA)/lamda
#Results
print "NA =",round(NA,4)
print "Fractional index change =",round(delta,5)
print "V-number =",round(V,2)
import math
#Variable declaration
Pout = 0.3 #output power(mW)
Pin = 1 #input power(mW)
L = 0.1 #fibre length(km)
#Calculation
a = (-10/L)*math.log10(Pout/Pin)
#Result
print "Attenuation =",round(a,2),"dB/km"
import math
#Variable declaration
Pin = 9 #input power(mW)
L = 3 #fibre length(km)
a = 1.5 #loss(dB/km)
#Calculation
Pl = a*L
Pout = Pin*10**(-Pl/10)
#Result
print "Output power =",round(Pout,3),"uW"
#Variable declaration
a = 2.2 #attenuation(dB/km)
l1 = 2 #km
l2 = 6 #km
from sympy import *
Pin = symbols('Pin')
#Calculations
#For 2km,
Pl1 = a*l1
Po1 = Pin*round(10**(-Pl1/10),3)
#For 6km,
Pl2 = a*l2
Po2 = Pin*round(10**(-Pl2/10),3)
#Results
print "After 2 km, Pout =",Po1
print "After 6 km, Pout =",Po2
#Variable declaration
Pout = 7.5 #output power(mW)
Pin = 8.6 #input power(mW)
L = 0.5 #fibre length(km)
#Calculation
Pl = -10*math.log10(Pout/Pin)
a = Pl/L
#Result
print "Loss specification =",round(a,4),"dB/km"