#importing modules
import math
from __future__ import division
#Variable declaration
n1 = 1.55 #refractive index of core
n2 = 1.50 #refractive index of cladding
#Calculation
NA = math.sqrt(n1**2 - n2**2)
NA = math.ceil(NA*10**3)/10**3; #rounding off to 3 decimals
#Result
print "numerical aperture is",NA
#importing modules
import math
from __future__ import division
#Variable declaration
n1 = 1.563 #refractive index of core
n2 = 1.498; #refractive index of cladding
#Calculation
NA = math.sqrt(n1**2 - n2**2) #numerical aperture
NA = math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals
alpha_i = math.asin(NA) #angle of acceptance(radians)
alpha_i = alpha_i*180/math.pi #angle(degrees)
deg = int(alpha_i)
t = 60*(alpha_i-deg)
mint = int(t) #angle(minutes)
#Result
print "the angle of acceptance is",deg,"degrees and",mint,"minutes"
print "answer given in the book differs due to rounding off errors"
#importing modules
import math
from __future__ import division
#Variable declaration
delta = 0.05 #difference in refractive indices of core and cladding
NA = 0.39 #numerical aperture
#Calculation
n1 = NA/math.sqrt(2*delta) #refractive index of core
n1 = math.ceil(n1*10**4)/10**4; #rounding off to 4 decimals
#Result
print "refractive index of the core is",n1
#importing modules
import math
from __future__ import division
#Variable declaration
n1 = 1.563 #refractive index of core
n2 = 1.498 #refractive index of cladding
#Calculation
delta = (n1-n2)/n1 #fractional index change
delta = math.ceil(delta*10**4)/10**4; #rounding off to 4 decimals
#Result
print "fractional index change is",delta
#importing modules
import math
from __future__ import division
#Variable declaration
n1 = 1.48 #refractive index of core
n2 = 1.45 #refractive index of cladding
#Calculation
NA = math.sqrt(n1**2 - n2**2) #numerical aperture
NA = math.ceil(NA*10**4)/10**4; #rounding off to 4 decimals
alpha_i = math.asin(NA) #angle of acceptance(radian)
alpha_i = alpha_i*180/math.pi #angle(degrees)
deg = int(alpha_i)
t = 60*(alpha_i-deg)
mint = round(t) #angle(minutes)
#Result
print "numerical aperture is",NA
print "the angle of acceptance is",deg,"degrees and",mint,"minutes"
#importing modules
import math
from __future__ import division
#Variable declaration
Pin = 100 #power of signal(mW)
Pout = 40 #outcoming signal power(mW)
#Calculation
l = -10*math.log10(Pout/Pin) #attenuation loss(dB)
l = math.ceil(l*10**2)/10**2; #rounding off to 2 decimals
#Result
print "the attenuation loss is",l,"dB"