from math import degrees, asin, sqrt
#NA ,angles and pulse broadning
print "part (a)"
n1=1.5##core refrative index
n2=1.48##claddin refractive index
a=100/2##radius in micro meter
na=1##air refrative index
NA=sqrt(n1**2-n2**2)##numerical aperture
print "numerical aperture is %0.3f"%NA
print "part (b)"
am=(asin(NA))##
tm=asin(NA/n1)##
tc=asin(n2/n1)##
print "angle αm = %0.2f degree"%degrees(am)
print "angle Om = %0.2f degree"%degrees(tm)
print "angle Φc = %0.2f degree"%degrees(tc)
print "part (c)"
c=3*10**8##speed of light in m/s
dtl=((n1/n2)*(n1-n2)/c)##pulse broadning per unit length
print "pulse broadning per unit length = %0.2e sm**-1"%dtl
from math import tan,sqrt,asin
#minimum and maximum number of reflections
n1=1.5##core refrative index
n2=1.48##claddin refractive index
a=100/2##radius in micro meter
na=1##air refrative index
NA=sqrt(n1**2-n2**2)##numerical aperture
am=(asin(NA))##
tm=asin(NA/n1)##
tc=asin(n2/n1)##
L=((a*10**-6)/(tan(tm)))##length in meter
x=(1/(2*L))##maximum number of reflections per meter
print "all other rays will suffer reflections between these two extremes of :",(0)," and ",round(x)," m**-1"
#answer is wrong in the textbook
#pulse broadning
h=0.85##WAVELENGTH IN MICRO METER
y=0.035##spectral width
c=0.021##constant
cl=3##speed of light in m/s
dtl=(y/cl)*c##
print "pulse broadning = %0.2f ns km**-1"%(dtl*10**4)
#pulse broadning
print "part (a)"
h=850##WAVELENGTH IN NANO METER
l=80##fiber length in Km
dh=30##in Nano Meter
m1=105.5##material dispersion for h=850nm in ps/nm-Km
m2=2.8##material dispersion for h=1300nm in ps/nm-Km
t=m1*l*dh*10**-3##material dispersion in ns when h=850nm
print "material dispersion = %0.2f ns when h=850nm"%t
print "part (b)"
h=1300##WAVELENGTH IN NANO METER
l=80##fiber length in Km
dh=30##in Nano Meter
m1=105.5##material dispersion for h=850nm in ps/nm-Km
m2=2.8##material dispersion for h=1300nm in ps/nm-Km
t=m2*l*dh*10**-3##material dispersion in ns when h=850nm
print "material dispersion = %0.2f ns when h=1300nm"%t
# pulse broadning
print "part (a)"
h=850##WAVELENGTH IN NANO METER
l=80##fiber length in Km
dh=2##in Nano Meter
m1=105.5##material dispersion for h=850nm in ps/nm-Km
m2=2.8##material dispersion for h=1300nm in ps/nm-Km
t=m1*l*dh*10**-3##material dispersion in ns when h=850nm
print "material dispersion = %0.2f ns when h=850nm"%t
print "part (b)"
h=1300##WAVELENGTH IN NANO METER
l=80##fiber length in Km
dh=2##in Nano Meter
m1=105.5##material dispersion for h=850nm in ps/nm-Km
m2=2.8##material dispersion for h=1300nm in ps/nm-Km
t=m2*l*dh*10**-3##material dispersion in ns when h=850nm
print "material dispersion = %0.3f ns when h=1300nm"%t