import math
#variable declartion
phi = 0 #lateral coordinate(degree)
Half_power = 10 #half power beam width(degree)
#calculation
teta = Half_power/2
teta_rad = teta/57.3
L = math.log(0.5)/math.log(math.cos(teta_rad)) #power distribution co-efficient
#result
print "Power distribution co-efficient L = " ,round(L)
import math
#variable declartion
rs = 35.0*1e-6 #the source radius (meter)
a = 25.0*1e-6 #the core radius of stepindex fiber (meter)
NA = 0.20 #the numerical aperture value
Bo = 150.0*1e4 #radiance ( W/cm^2 * sr)
#calculation
Ps = ((math.pi**2)*(rs**2))*Bo #power emitted by the source
PLED_step = Ps*(NA**2) #for larger core fiber(W)
PLED_step1 = (((a/rs)**2)*Ps)*(NA**2) #for smaller core fiber at the end face(W)
#result
print "For larger core fiber optical power emitted from the LED light source = " , round(PLED_step*1e3,3),"mW"
print "For smaller core fiber then area optical power coupled to step index fiber on W = " , round(PLED_step1*1e3,3),"mW"
import math
#variable declartion
n1 = 3.6 #refractive index of optical source
n = 1.48 #refractive index of silica fiber
#calculation
R = ((n1-n)/(n1+n))**2 #fresnel reflection
L = -10*(math.log10(1-R)) #power loss(dB)
#result
print"Fresnel reflection = ",round(R,3)," = ",round(R*100,1),"%"
print"Power loss = " , round(L,2),"dB"
import math
#variable declartion
a =1*1e-6 #core radii (meters)
d = 0.3*a #axial offset
#calculation
PT_P = (2/math.pi)*(math.acos(d/(2*a))-(1-(d/(2*a))**2)**0.5*(d/(6*a))*(5-0.5*(d/a)**2))
PT_P_dB = 10*(math.log10(PT_P)) #power coupled between two fibers(dB)
#result
print "Power coupled between two graded index fibers = " , round(PT_P_dB,2),"dB"
import math
#variable declartion
V = 2.4 #normalized frequency
n1 = 1.47 #core refractive index
n2 = 1.465 #cladding refractive index
a = (9.0/2.0)*10**-6 #core radii (meters)
d = 1*10**-6 #lateral offset (meters)
#calculation
W = a*(0.65+1.619*V**(-1.5)+2.879*V**-6) #mode field diameter (um)
Lsm = -10*(math.log10(math.exp(-(d/W)**2))) #Loss between identical fibers(dB)
#result
print "Mode field diameter = " , round(W*1e6,2),"um"
print "Loss between single mode fibers due to lateral misalignment = " , round(Lsm,2),"dB"
import math
#variable declartion
V = 2.4 #normalized frequency
n1 = 1.47 #core refractive index
n2 = 1.465 #cladding refractive index
a = (9.0/2.0)*1e-6 #coreradii in meters
d = 1*1e-6 #lateral offset (m)
teta = 1 #in (degrees)
teta = 1/57.3 #in (radaians)
#calculation
W = a*(0.65+1.619*V**(-1.5)+2.879*V**-6) #mode field diameter
Lam_bda = 1300.0*10**-9 #wavelength (m)
Lsm_ang = -10*(math.log10(math.exp(-(math.pi*n2*W*teta/Lam_bda)**2))) #(dB)
#result
print "Loss between single mode fibers due to angular misalignment = ",round(Lsm_ang,2),"dB"