In [1]:

```
from math import sqrt
#Variable declaration
NA = 0.24;#Numerical Aperture
delta = 0.014;
#Calculations & Results
n1 = (NA)/sqrt(2*delta);#Refractive index of first medium
print 'Refractive index of first medium is ',round(n1,4)
n2 = n1 - (delta*n1);#Refractive index of secong material
print 'Refractive index of secong material is ',round(n2,4)
```

In [2]:

```
from math import sqrt,asin,degrees
#Variable declaration
n1 = 1.49; # Refractive index of first medium
n2 = 1.44; # Refractive index of second medium
#Calculations & Results
def deg_to_dms(deg):
d = int(deg)
md = abs(deg - d) * 60
m = int(md)
sd = (md - m) * 60
sd=round(sd,2)
return [d, m, sd]
delta = (n1-n2)/n1; # Index difference
NA = n1* sqrt(2*delta);
print 'Numerical Aperture of fiber is',round(NA,3)
theta = degrees(asin(NA));
print 'Acceptance angle is ',deg_to_dms(theta),'degrees'
```

In [3]:

```
from math import sqrt,asin,degrees
#Variable declaration
NA = 0.15 ; # Numerical Aperture of fiber
n2 = 1.55; # Refractive index of cladding
n0w = 1.33; # Refractive index of water
n0a = 1; # Refractive index of air
#Calculations
def deg_to_dms(deg):
d = int(deg)
md = abs(deg - d) * 60
m = int(md)
sd = (md - m) * 60
sd=round(sd,2)
return [d, m, sd]
n1 = sqrt(NA**2 + n2**2);
NAW = (sqrt(n1**2 -n2**2))/n0w;
theta = degrees(asin(NAW));#Acceptance angle in water
#Result
print 'Acceptance angle in water is ',deg_to_dms(theta),'degrees'
```

In [4]:

```
from math import log10
#Variable declaration
l = 16; # Length of optical fiber in Km
Pi = 240e-6; # Mean optical length launched in optical fiber in Watts
Po = 6e-6; # Mean optical power at the output in watts
#Calculations&Results
alpha = 10*log10(Pi/Po);#Signal attenuation in fiber
print 'Signal attenuation in fiber',round(alpha),'dB'
alpha1 = alpha/l;#Signal attenuation per km of the fiber
print 'Signal attenuation per km of the fiber',round(alpha1),'dB/km'
```

In [5]:

```
from math import pi,exp
#Variable declaration
Tf = 1400; # Fictive temperature of silicon in Kelvin
betai = 7e-11; # Isothermal compressibility square meter per newton
n = 1.46; # Refractive index of silicon
p = 0.286; # Photoelastic constant of silicon
lamda = 0.63e-6 # Wavelength in micrometer
kb = 1.38e-23 # Boltzmann constant in joule per kelvin
L = 1e3;
#Calculations
alphas = (8 * pi**3 * n**8 * p**2 * kb * Tf * betai)/(3 * lamda**4);#Rayleigh scattering coefficient
alphars = exp(-alphas * L);#Loss factor
#Results
print 'Rayleigh scattering coefficient is ',round(alphas/1e-3,2),'*10^-3 /m'
print 'Loss factor is',round(alphars,3) #Answer varies due to rounding-off values
```

In [6]:

```
#Variable declaration
alpha = 0.5; # Attenuation of single mode optical fibre in dB per km
lamda = 1.4; # Operating wavelength of optical fiber in micrometer
d = 8 # Diameter of fiber in micrometer
y = 0.6; # Laser source frequency width
#Calculations
pb = 4.4e-3 * d**2 * lamda**2 * alpha * y;#Threshold optical power in SBS
prs = 5.9e-2 * d**2 * lamda * alpha;#Threshold optical power in SRS
#Results
print 'Threshold optical power in SBS',pb/1e-3,'mW'
print 'Threshold optical power in SRS',prs,'W'
```

In [7]:

```
from math import sqrt, pi
#Variable declaration
n1 = 1.50; # Refreactive index of forst medium
delta = 0.003; # Index difference
lamda = 1.6*1e-6; # Operating wavelength of fober in meter
#Calculations&Results
n2 = sqrt(n1**2-(2*delta*n1**2));#refractive index of cladding
#Substituting n2^2 = n1^2 - 2*delta*n1^2 in euation of Rc,
rc = (3*n1**2*lamda)/(4*pi*((2*delta*n1**2)**(3./2)));#The critical radius of curvature for which bending losses occur
print 'The critical radius of curvature for which bending losses occur is ',round(rc/1e-6,2),'um'
#Incorrect answer in the textbook
```