summaryrefslogtreecommitdiff
path: root/sample_notebooks/SINDHUARROJU
diff options
context:
space:
mode:
authorThomas Stephen Lee2015-08-31 13:48:07 +0530
committerThomas Stephen Lee2015-08-31 13:48:07 +0530
commit9c9779ba21b9bedde88e1e8216f9e3b4f8650b0e (patch)
treee876822272cacbbcc3e9701e050062534c554b15 /sample_notebooks/SINDHUARROJU
parentdb0855dbeb41ecb8a51dde8587d43e5d7e83620f (diff)
downloadPython-Textbook-Companions-9c9779ba21b9bedde88e1e8216f9e3b4f8650b0e.tar.gz
Python-Textbook-Companions-9c9779ba21b9bedde88e1e8216f9e3b4f8650b0e.tar.bz2
Python-Textbook-Companions-9c9779ba21b9bedde88e1e8216f9e3b4f8650b0e.zip
add books
Diffstat (limited to 'sample_notebooks/SINDHUARROJU')
-rw-r--r--sample_notebooks/SINDHUARROJU/Chapter12.ipynb665
1 files changed, 665 insertions, 0 deletions
diff --git a/sample_notebooks/SINDHUARROJU/Chapter12.ipynb b/sample_notebooks/SINDHUARROJU/Chapter12.ipynb
new file mode 100644
index 00000000..09a71a18
--- /dev/null
+++ b/sample_notebooks/SINDHUARROJU/Chapter12.ipynb
@@ -0,0 +1,665 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "#12: Fiber Optics"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.1, Page number 12.24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 52,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "acceptance angle is 20.41 degrees\n",
+ "answer in the book varies due to rounding off errors\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.54; #Core refractive index\n",
+ "n2=1.50; #Cladding refractive index\n",
+ "\n",
+ "#Calculation\n",
+ "NA=math.sqrt(n1**2-n2**2); #numerical aperture\n",
+ "alpha_m=math.asin(NA); #acceptance angle(radian)\n",
+ "alpha_m=alpha_m*180/math.pi; #acceptance angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"acceptance angle is\",round(alpha_m,2),\"degrees\"\n",
+ "print \"answer in the book varies due to rounding off errors\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.2, Page number 12.24"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 53,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.387\n",
+ "acceptance angle is 22.8 degrees\n",
+ "critical angle is 75 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.5; #Core refractive index\n",
+ "n2=1.45; #Cladding refractive index\n",
+ "\n",
+ "#Calculation\n",
+ "delta=(n1-n2)/n1; #fractional index change\n",
+ "NA=n1*math.sqrt(2*delta); #numerical aperture\n",
+ "alpha_m=math.asin(NA); #acceptance angle(radian)\n",
+ "alpha_m=alpha_m*180/math.pi; #acceptance angle(degrees)\n",
+ "thetac=math.asin(n2/n1)*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,3)\n",
+ "print \"acceptance angle is\",round(alpha_m,1),\"degrees\"\n",
+ "print \"critical angle is\",int(thetac),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.3, Page number 12.25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 54,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "critical angle is 77.16 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.53; #Core refractive index\n",
+ "p=2.5; #percentage(%)\n",
+ "\n",
+ "#Calculation\n",
+ "n2=n1*(100-p)/100; #Cladding refractive index\n",
+ "thetac=math.asin(n2/n1)*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"critical angle is\",round(thetac,2),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.4, Page number 12.25"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 55,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.28\n",
+ "acceptance angle is 16.26 degrees\n",
+ "critical angle is 79.1 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "delta=0.018; #fractional difference\n",
+ "n1=1.50; #Core refractive index\n",
+ "\n",
+ "#Calculation\n",
+ "NA=round(n1*math.sqrt(2*delta),2); #numerical aperture\n",
+ "alpha_m=math.asin(NA); #acceptance angle(radian)\n",
+ "alpha_m=alpha_m*180/math.pi; #acceptance angle(degrees)\n",
+ "n2=n1-(delta*n1); #Cladding refractive index\n",
+ "thetac=math.asin(n2/n1)*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",NA\n",
+ "print \"acceptance angle is\",round(alpha_m,2),\"degrees\"\n",
+ "print \"critical angle is\",round(thetac,1),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.5, Page number 12.26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 56,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "total number of guided modes is 490.0\n",
+ "number of modes of graded index fibre is 245.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=50*10**-6; #diameter(m)\n",
+ "lamda=1*10**-6; #wavelength(m)\n",
+ "NA=0.2; #numerical aperture\n",
+ "\n",
+ "#Calculation\n",
+ "NSI=4.9*(d*NA/lamda)**2; #total number of guided modes\n",
+ "NGI=NSI/2; #number of modes of graded index fibre\n",
+ "\n",
+ "#Result\n",
+ "print \"total number of guided modes is\",NSI\n",
+ "print \"number of modes of graded index fibre is\",NGI"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.6, Page number 12.26"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 57,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.47\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "delta=0.05; #fractional difference\n",
+ "n1=1.5; #Core refractive index\n",
+ "\n",
+ "#Calculation\n",
+ "NA=n1*math.sqrt(2*delta); #numerical aperture\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,2)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.7, Page number 12.27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 58,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of modes that can be propagated is 1\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "d=5*10**-6; #diameter(m)\n",
+ "lamda=1*10**-6; #wavelength(m)\n",
+ "NA=0.092; #numerical aperture\n",
+ "\n",
+ "#Calculation\n",
+ "N=4.9*(d*NA/lamda)**2; #number of modes that can be propagated\n",
+ "\n",
+ "#Result\n",
+ "print \"number of modes that can be propagated is\",int(N)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.8, Page number 12.27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 59,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "V number is 94.7\n",
+ "maximum number of modes is 4485.7\n",
+ "answer in the book varies due to rounding off errors\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "n1=1.53; #Core refractive index\n",
+ "n2=1.50; #Cladding refractive index\n",
+ "a=50*10**-6; #radius(m)\n",
+ "lamda=1*10**-6; #wavelength(m)\n",
+ "\n",
+ "#Calculation\n",
+ "NA=math.sqrt(n1**2-n2**2); #numerical aperture\n",
+ "Vn=2*math.pi*a*NA/lamda; #V number\n",
+ "N=Vn**2/2; #maximum number of modes\n",
+ "\n",
+ "#Result\n",
+ "print \"V number is\",round(Vn,1)\n",
+ "print \"maximum number of modes is\",round(N,1)\n",
+ "print \"answer in the book varies due to rounding off errors\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.9, Page number 12.27"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 60,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of propagating modes is 49177\n",
+ "answer in the book is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "a=100*10**-6; #radius(m)\n",
+ "lamda=0.85*10**-6; #wavelength(m)\n",
+ "NA=0.3; #numerical aperture\n",
+ "\n",
+ "#Calculation\n",
+ "N=4*math.pi**2*a**2*NA**2/lamda**2; #number of propagating modes\n",
+ "\n",
+ "#Result\n",
+ "print \"number of propagating modes is\",int(N)\n",
+ "print \"answer in the book is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.10, Page number 12.28"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 61,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Core refractive index is 1.6025\n",
+ "acceptance angle is 8.638 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "NA=0.2; #numerical aperture\n",
+ "n2=1.59; #Cladding refractive index\n",
+ "n0=1.33; #refractive index\n",
+ "\n",
+ "#Calculation\n",
+ "n1=round(math.sqrt(NA**2+n2**2),4); #Core refractive index\n",
+ "NA1=math.sqrt(n1**2-n2**2)/n0; #numerical aperture\n",
+ "alpha_m=math.asin(NA1); #acceptance angle(radian)\n",
+ "alpha_m=alpha_m*180/math.pi; #acceptance angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"Core refractive index is\",n1\n",
+ "print \"acceptance angle is\",round(alpha_m,3),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.11, Page number 12.29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 62,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of photons is 13.675 *10**15\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "c=3*10**8; #velocity of light(m/sec)\n",
+ "h=6.63*10**-34; #plank's constant(Js)\n",
+ "lamda=680*10**-9; #wavelength(m)\n",
+ "P=4*10**-3; #power(W)\n",
+ "\n",
+ "#Calculation\n",
+ "delta_E=c*h/lamda; #energy(J)\n",
+ "N=P/delta_E; #number of photons\n",
+ "\n",
+ "#Result\n",
+ "print \"number of photons is\",round(N/10**15,3),\"*10**15\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.12, Page number 12.29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 64,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Cladding refractive index is 1.49925\n",
+ "numerical aperture is 0.0474\n",
+ "critical angle is 88.2 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "delta=0.0005; #fractional difference\n",
+ "n1=1.5; #Core refractive index\n",
+ "\n",
+ "#Calculation\n",
+ "n2=n1-(delta*n1); #Cladding refractive index\n",
+ "NA=n1*math.sqrt(2*delta); #numerical aperture\n",
+ "thetac=math.asin(n2/n1)*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"Cladding refractive index is\",n2\n",
+ "print \"numerical aperture is\",round(NA,4)\n",
+ "print \"critical angle is\",round(thetac,1),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.13, Page number 12.29"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 65,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "fraction of initial intensity after 2km is 0.363\n",
+ "fraction of initial intensity after 5km is 0.048\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "alpha=2.2; #attenuation coefficient(dB/km)\n",
+ "L1=2; #distance(km)\n",
+ "L2=6; #distance(km)\n",
+ "\n",
+ "#Calculation\n",
+ "x1=-alpha*L1/10; \n",
+ "x2=-alpha*L2/10;\n",
+ "P1=10**x1; #fraction of initial intensity after 2km\n",
+ "P2=10**x2; #fraction of initial intensity after 5km\n",
+ "\n",
+ "#Result\n",
+ "print \"fraction of initial intensity after 2km is\",round(P1,3)\n",
+ "print \"fraction of initial intensity after 5km is\",round(P2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.14, Page number 12.30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 66,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "attenuation coefficient is 1.41 dB/km\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "L=0.5; #distance(km)\n",
+ "Pout=1; #output power(W)\n",
+ "Pin=85/100; #input power(W)\n",
+ "\n",
+ "#Calculation\n",
+ "alpha=10*math.log10(Pout/Pin)/L; #attenuation coefficient(dB/km)\n",
+ "\n",
+ "#Result\n",
+ "print \"attenuation coefficient is\",round(alpha,2),\"dB/km\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "##Example number 12.15, Page number 12.30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 67,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "attenuation coefficient is 1.7 dB/km\n",
+ "overall signal attenuation is 17 dB\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration\n",
+ "L=10; #distance(km)\n",
+ "Pout=2; #output power(W)\n",
+ "Pin=100; #input power(W)\n",
+ "\n",
+ "#Calculation\n",
+ "alpha=10*math.log10(Pin/Pout)/L; #attenuation coefficient(dB/km)\n",
+ "o_alpha=round(alpha,1)*L; #overall signal attenuation\n",
+ "\n",
+ "#Result\n",
+ "print \"attenuation coefficient is\",round(alpha,1),\"dB/km\"\n",
+ "print \"overall signal attenuation is\",int(o_alpha),\"dB\""
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}