summaryrefslogtreecommitdiff
path: root/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-03-17 23:30:24 +0600
committerTrupti Kini2016-03-17 23:30:24 +0600
commit7d10afb628b5d7d6ca4e773a4b0af7daf8486590 (patch)
tree8ef747e21c838c15775d5fa3f61010902a698a0f /Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb
parentf41fe1567ea73d4876295d3f7b412b4f312cf9f8 (diff)
downloadPython-Textbook-Companions-7d10afb628b5d7d6ca4e773a4b0af7daf8486590.tar.gz
Python-Textbook-Companions-7d10afb628b5d7d6ca4e773a4b0af7daf8486590.tar.bz2
Python-Textbook-Companions-7d10afb628b5d7d6ca4e773a4b0af7daf8486590.zip
Added(A)/Deleted(D) following books
A Basic_Engineering_Thermodynamics_by_Rayner_Joel/README.txt A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter1.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter10.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter11.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter12.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter14.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter2.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter3.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter4.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter5.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter6.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter8.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter9.ipynb A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/screenshots/1.png A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/screenshots/2.png A Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/screenshots/3.png A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter2_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter3_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter4_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter6_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter7_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter8_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/Chapter9_1.ipynb A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/screenshots/chapter2_1.png A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/screenshots/chapter3_1.png A High_Voltage_Engineering_by_V_Kamaraju_,_M_S_Naidu/screenshots/chapter4_1.png A Introduction_to_Electrical_Engineering_by_Er._J.P._Navani_&_Er._Sonal_Sapra/README.txt
Diffstat (limited to 'Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb')
-rw-r--r--Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb721
1 files changed, 721 insertions, 0 deletions
diff --git a/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb b/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb
new file mode 100644
index 00000000..12870058
--- /dev/null
+++ b/Engineering_Physics_by_S.L.Gupta,_Sanjeev_Gupta/Chapter13.ipynb
@@ -0,0 +1,721 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# 13: Fibre Optics"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.1, Page number 375"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.24413\n",
+ "maximum entrance angle is 14.13 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.48; #cladding refractive index\n",
+ "n=1;\n",
+ "\n",
+ "#Calculations\n",
+ "NA=math.sqrt(n1**2-n2**2); #numerical aperture\n",
+ "i0=math.asin(NA/n); #maximum entrance angle(radian)\n",
+ "i0=i0*180/math.pi; #maximum entrance angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,5)\n",
+ "print \"maximum entrance angle is\",round(i0,2),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": true
+ },
+ "source": [
+ "# Example number 13.2, Page number 376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "core refractive index is 1.6025\n",
+ "acceptance angle is 8.6 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "n0=1.33; #water refractive index\n",
+ "n2=1.59; #cladding refractive index\n",
+ "NA=0.2; #numerical aperture\n",
+ "\n",
+ "#Calculations\n",
+ "n1=math.sqrt(NA**2+n2**2); #core refractive index \n",
+ "NA=math.sqrt(n1**2-n2**2)/n0; #numerical aperture\n",
+ "i0=math.asin(NA); #acceptance angle(radian)\n",
+ "i0=i0*180/math.pi; #acceptance angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"core refractive index is\",round(n1,4)\n",
+ "print \"acceptance angle is\",round(i0,1),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.3, Page number 376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.304\n",
+ "acceptance angle is 17.7 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "n1=1.36; #core refractive index\n",
+ "delta=0.025; #relative difference\n",
+ "\n",
+ "#Calculations\n",
+ "NA=n1*math.sqrt(2*delta); #numerical aperture\n",
+ "i0=math.asin(NA); #acceptance angle(radian)\n",
+ "i0=i0*180/math.pi; #acceptance angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,3)\n",
+ "print \"acceptance angle is\",round(i0,1),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.4, Page number 376"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.3873\n",
+ "acceptance angle is 22.79 degrees\n",
+ "critical angle is 75.16 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",
+ "#Calculations\n",
+ "delta=(n1-n2)/n1; #relative difference\n",
+ "NA=n1*math.sqrt(2*delta); #numerical aperture\n",
+ "i0=math.asin(NA); #acceptance angle(radian)\n",
+ "i0=i0*180/math.pi; #acceptance angle(degrees)\n",
+ "theta_c=math.asin(n2/n1); #critical angle(radian)\n",
+ "theta_c=theta_c*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,4)\n",
+ "print \"acceptance angle is\",round(i0,2),\"degrees\"\n",
+ "print \"critical angle is\",round(theta_c,2),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.5, Page number 377"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "core refractive index is 1.42\n",
+ "cladding refractive index is 1.407\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "NA=0.22; #numerical aperture\n",
+ "delta=0.012; #relative difference\n",
+ "\n",
+ "#Calculations\n",
+ "N=1-delta;\n",
+ "n1=math.sqrt(NA**2/(1-N**2)); #core refractive index\n",
+ "n2=N*n1; #cladding refractive index\n",
+ "\n",
+ "#Result\n",
+ "print \"core refractive index is\",round(n1,2)\n",
+ "print \"cladding refractive index is\",round(n2,3)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.6, Page number 377"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "acceptance angle is 23.6 degrees\n",
+ "critical angle is 81.9 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "NA=0.40; #numerical aperture\n",
+ "delta=1/100; #relative difference\n",
+ "\n",
+ "#Calculations\n",
+ "i0=math.asin(NA); #acceptance angle(radians)\n",
+ "i0=i0*180/math.pi; #acceptance angle(degrees)\n",
+ "N=1-delta;\n",
+ "thetac=math.asin(N); #critical angle(radians)\n",
+ "thetac=thetac*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"acceptance angle is\",round(i0,1),\"degrees\"\n",
+ "print \"critical angle is\",round(thetac,1),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.7, Page number 378"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "core refractive index is 1.5\n",
+ "cladding refractive index is 1.3\n",
+ "numerical aperture is 0.75\n",
+ "answer for numerical aperture varies due to rounding off errors\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "vf=3*10**8; #velocity of light in free space(m/s)\n",
+ "vc=2*10**8; #velocity of light in core(m/s)\n",
+ "thetac=60*math.pi/180; #critical angle(radians)\n",
+ "\n",
+ "#Calculations\n",
+ "n1=vf/vc; #core refractive index\n",
+ "n2=n1*math.sin(thetac); #cladding refractive index\n",
+ "NA=math.sqrt(n1**2-n2**2); #numerical aperture\n",
+ "\n",
+ "#Result\n",
+ "print \"core refractive index is\",n1\n",
+ "print \"cladding refractive index is\",round(n2,1)\n",
+ "print \"numerical aperture is\",NA\n",
+ "print \"answer for numerical aperture varies due to rounding off errors\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.8, Page number 378"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.3905\n",
+ "acceptance angle is 23.0 degrees\n",
+ "critical angle is 75.4 degrees\n",
+ "number of reflections per metre is 5206\n",
+ "answer for number of reflections in the textbook is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "n1=1.55; #core refractive index\n",
+ "n2=1.50; #cladding refractive index\n",
+ "d=50*10**-6; #core diameter(micro m)\n",
+ "\n",
+ "#Calculations\n",
+ "NA=math.sqrt(n1**2-n2**2); #numerical aperture\n",
+ "i0=math.asin(NA); #acceptance angle(radians)\n",
+ "i0=i0*180/math.pi; #acceptance angle(degrees)\n",
+ "thetac=math.asin(n2/n1); #critical angle(radians)\n",
+ "theta_c=thetac*180/math.pi; #critical angle(degrees)\n",
+ "x=d*math.tan(thetac);\n",
+ "n=1/x; #number of reflections per metre \n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,4)\n",
+ "print \"acceptance angle is\",round(i0),\"degrees\"\n",
+ "print \"critical angle is\",round(theta_c,1),\"degrees\"\n",
+ "print \"number of reflections per metre is\",int(n)\n",
+ "print \"answer for number of reflections in the textbook is wrong\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.9, Page number 379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "numerical aperture is 0.375\n",
+ "critical angle is 75.93 degrees\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "delta=0.03; #relative difference\n",
+ "i0=22*math.pi/180; #acceptance angle(radians)\n",
+ "\n",
+ "#Calculations\n",
+ "NA=math.sin(i0); #numerical aperture\n",
+ "N=1-delta;\n",
+ "thetac=math.asin(N); #critical angle(radians)\n",
+ "theta_c=thetac*180/math.pi; #critical angle(degrees)\n",
+ "\n",
+ "#Result\n",
+ "print \"numerical aperture is\",round(NA,3)\n",
+ "print \"critical angle is\",round(theta_c,2),\"degrees\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.10, Page number 379"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "velocity of light in fibre core is 2.48 *10**8 m/s\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "delta=0.0045; #relative difference\n",
+ "i0=0.115; #acceptance angle(radians)\n",
+ "v=3*10**8; #velocity of light(m/s)\n",
+ "\n",
+ "#Calculations\n",
+ "NA=math.sin(i0); #numerical aperture\n",
+ "n1=NA/math.sqrt(2*delta); #core refractive index\n",
+ "vcore=v/n1; #velocity of light in fibre core(m/s)\n",
+ "\n",
+ "#Result\n",
+ "print \"velocity of light in fibre core is\",round(vcore/10**8,3),\"*10**8 m/s\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.11, Page number 381"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "diameter of core is 3.79 *10**-6 m\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "V=2.405; #V-number\n",
+ "lamda=8500*10**-10; #wavelength(m)\n",
+ "n1=1.48; #core refractive index\n",
+ "n2=1.47; #cladding refractive index\n",
+ "\n",
+ "#Calculations\n",
+ "d=V*lamda/(math.pi*math.sqrt(n1**2-n2**2)); #diameter of core(m)\n",
+ "\n",
+ "#Result\n",
+ "print \"diameter of core is\",round(d*10**6,2),\"*10**-6 m\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.12, Page number 381"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "maximum radius for fibre is 3.76 micro m\n",
+ "answer varies due to rounding off errors\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "V=2.405; #V-number\n",
+ "lamda=1300*10**-3; #wavelength(micro m)\n",
+ "n1=1.466; #core refractive index\n",
+ "n2=1.46; #cladding refractive index\n",
+ "\n",
+ "#Calculations\n",
+ "r=V*lamda/(2*math.pi*math.sqrt(n1**2-n2**2)); #maximum radius for fibre(micro m)\n",
+ "\n",
+ "#Result\n",
+ "print \"maximum radius for fibre is\",round(r,2),\"micro m\"\n",
+ "print \"answer varies due to rounding off errors\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.13, Page number 381"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "diameter of fibre core is 91.5 micro m\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "lamda=1.3; #wavelength(micro m)\n",
+ "n1=1.5; #core refractive index\n",
+ "Nm=1100; #number of modes\n",
+ "delta=0.01; #refractive index difference\n",
+ "\n",
+ "#Calculations\n",
+ "d=lamda*math.sqrt(Nm/delta)/(math.pi*n1); #diameter of fibre core(micro m)\n",
+ "\n",
+ "#Result\n",
+ "print \"diameter of fibre core is\",round(d,1),\"micro m\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.14, Page number 382"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 40,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "number of guided modes is 459.0\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "lamda=1.1*10**-6; #wavelength(m)\n",
+ "r=60/2*10**-6; #radius(m)\n",
+ "NA=0.25; #numerical aperture\n",
+ "\n",
+ "#Calculations\n",
+ "V=2*math.pi*r*NA/lamda; \n",
+ "Nm=V**2/4; #number of guided modes\n",
+ "\n",
+ "#Result\n",
+ "print \"number of guided modes is\",round(Nm)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.15, Page number 387"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 43,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "fibre loss is 12.0412 dB/km\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "L=500/1000; #length(km)\n",
+ "P0byPi=25/100; #optical power\n",
+ "\n",
+ "#Calculations\n",
+ "dB=-10*math.log10(P0byPi)/L; #fibre loss(dB/km)\n",
+ "\n",
+ "#Result\n",
+ "print \"fibre loss is\",round(dB,4),\"dB/km\""
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Example number 13.16, Page number 387"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 59,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "output power is 2.005 micro W\n",
+ "answer given in the textbook is wrong\n"
+ ]
+ }
+ ],
+ "source": [
+ "#importing modules\n",
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#Variable declaration \n",
+ "L=10; #length(km)\n",
+ "dB=2.3; #fibre loss(dB/km)\n",
+ "Pi=400; #input power(micro W)\n",
+ "\n",
+ "#Calculations\n",
+ "P0=10**(-dB*L/10)*Pi; #output power(micro W)\n",
+ "\n",
+ "#Result\n",
+ "print \"output power is\",round(P0,3),\"micro W\"\n",
+ "print \"answer given in the textbook is wrong\""
+ ]
+ }
+ ],
+ "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.11"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}