{
 "metadata": {
  "name": "",
  "signature": "sha256:7b1c137849cf93f7c696bb48d79752abb9cdb5dcbbc9af1acedb41baab1b64d4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4: Transmission Characteristics of Optical Fibers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1: PgNo-138"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Pi=100*math.pow(10,-6) # mean optical power in watt\n",
      "Po=2*math.pow(10,-6) # output mean power in watt\n",
      "L=6 # length in km\n",
      "L1=8 # length in km\n",
      "asp=10*math.log(Pi/Po)/math.log(10) # signal attenuation in dB\n",
      "as1=asp/L # signal attenuation per km\n",
      "Li=as1*L1 # Loss incurred along 8 km\n",
      "Ls=7 # Loss due to splice in dB\n",
      "as2=Li+Ls #overall signal attenuation in dB\n",
      "As2=29.4 #aprox. overall signal attenuation in dB\n",
      "Pio=math.pow(10,(As2/10)) #i/p o/p power ratio\n",
      "\n",
      "#Results\n",
      "print ('%s %.2f %s' %(\" The signal attenuation = \",asp,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n The signal attenuation per km = \",as1,\"dB/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The trgth = \",Li,\"km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The overall signal attenuation = \",as2,\"dB\"))\n",
      "print ('%s %.2f' %(\"\\n The i/p o/p power ratio = \", Pio))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The signal attenuation =  16.99 dB\n",
        "\n",
        " The signal attenuation per km =  2.83 dB/km\n",
        "\n",
        " The trgth =  22.65 km\n",
        "\n",
        " The overall signal attenuation =  29.65 dB\n",
        "\n",
        " The i/p o/p power ratio =  870.96\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2: PgNo-142"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Pi=1.5*math.pow(10,-3) # mean optical power in watt\n",
      "Po=2*math.pow(10,-6) # output mean power in watt\n",
      "a=0.5 # dB/km\n",
      "L=(10*math.log(Pi/Po)/math.log(10))/a # max possible link Length in km\n",
      "\n",
      "print ('%s %.3f %s' %(\" The max possible link Length = \",L,\"km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max possible link Length =  57.501 km\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3: PgNo-147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable Declaration\n",
      "n=1.46 # core refractive index\n",
      "p=0.286 # photoelastic coeff\n",
      "b=7*math.pow(10,-11) # isothermal compressibility\n",
      "k=1.381*math.pow(10,-23) # boltzmann's constant\n",
      "tf=1400 # fictive temperature in k\n",
      "y1=0.85*math.pow(10,-6) # wavelength in m\n",
      "\n",
      "# Calculations\n",
      "yr=((8*math.pow(math.pi,3)*math.pow(n,8)*math.pow(p,2)*(b*k*tf)))/(3*math.pow(y1,4))\n",
      "akm=pow(math.e,(-yr*math.pow(10,3)))\n",
      "at=10*math.log(1/akm)/math.log(10)# attenuation at y=0.85 um\n",
      "y2=1.55*math.pow(10,-6) # wavelength in m\n",
      "yr1=((8*math.pow(math.pi,3)*math.pow(n,8)*math.pow(p,2)*(b*k*tf)))/(3*math.pow(y2,4))\n",
      "akm1=math.pow(math.e,(-yr1*math.pow(10,3)))\n",
      "at1=10*math.log(1/akm1)/math.log(10)# attenuation at y=1.55 um\n",
      "y3=1.30*math.pow(10,-6) # wavelength in m\n",
      "yr2=((8*math.pow(math.pi,3)*math.pow(n,8)*math.pow(p,2)*(b*k*tf)))/(3*math.pow(y3,4))\n",
      "akm2=math.pow(math.e,(-yr2*math.pow(10,3)))\n",
      "at2=10*math.log(1/akm2)/math.log(10)# attenuation at y=1.30 um\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The Loss of an optical fiber = \",at,\"dB/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The Loss of an optical fiber = \",at1,\"dB/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The Loss of an optical fiber = \",at2,\"dB/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The Loss of an optical fiber =  1.57 dB/km\n",
        "\n",
        " The Loss of an optical fiber =  0.14 dB/km\n",
        "\n",
        " The Loss of an optical fiber =  0.29 dB/km\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4: PgNo-149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "d=6 # core diameter in m\n",
      "y=1.55 # wavelength in m\n",
      "a=0.5 # attenuation in dB/km\n",
      "v=0.4\n",
      "Pb=4.4*math.pow(10,-3)*math.pow(d,2)*math.pow(y,2)*a*v # threshold power for SBS\n",
      "Pr=5.9*math.pow(10,-2)*math.pow(d,2)*y*a # threshold power for SRS\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The threshold power for SBS = \",Pb*pow(10,3),\"mw\"))\n",
      "print ('%s %.2f %s' %(\"\\n The threshold power for SRS = \",Pr,\"W\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The threshold power for SBS =  76.11 mw\n",
        "\n",
        " The threshold power for SRS =  1.65 W\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5: PgNo-153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.46     # core refractive index\n",
      "dl=0.03     # relative refractive index difference\n",
      "y=0.85*math.pow(10,-6) #operating wavelength in m\n",
      "a=4*math.pow(10,-6) # core radous in m\n",
      "\n",
      "# Calculations\n",
      "n2=math.sqrt(math.pow(n1,2)-2*dl*math.pow(n1,2)) #cladding refractive index\n",
      "Rc=(3*math.pow(n1,2)*y)/(4*math.pi*math.pow((math.pow(n1,2)-math.pow(n2,2)),1.5)) # critical radius of curvature for multimode fiber\n",
      "Dl=0.003    # relative refractive index difference\n",
      "N2=math.sqrt(math.pow(n1,2)-2*Dl*math.pow(n1,2))\n",
      "yc=math.pow(2*math.pi*a*n1*(2*Dl),0.5)/2.405 # cut off wavelength in m\n",
      "y1=1.55*math.pow(10,-6) # operating wavelength in m\n",
      "Rcs=(20*y1*math.pow((2.748-0.996*(y1/yc)),-3))/math.pow((0.005),1.5) # critical radius of curvature for a single mode fiber\n",
      "\n",
      "# Results\n",
      "print '%s %.4f %s' %(\" The critical radius of curvature for multimode fiber = \",Rc*math.pow(10,6),\"um\")\n",
      "print '%s %.4f %s' %(\"\\n The critical radius of curvature for a single mode fiber = \",Rcs*math.pow(10,3),\"um\")\n",
      "print \"\\nThe answer is wrong in the textbook for single mode fiber\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The critical radius of curvature for multimode fiber =  9.4569 um\n",
        "\n",
        " The critical radius of curvature for a single mode fiber =  4.2620 um\n",
        "\n",
        "The answer is wrong in the textbook for single mode fiber\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6: PgNo-157"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable declaration\n",
      "x=2.0 # index profile\n",
      "dl=0.0126 #index difference\n",
      "a=(85.0/2.0)*math.pow(10,-6) # core radius\n",
      "R=2.0*math.pow(10,-3) # curve of radius\n",
      "n1=1.45 # core refractive index\n",
      "k=6.28\n",
      "\n",
      "# Calculations\n",
      "y=850.0*math.pow(10,-9) # wavelength in m\n",
      "A=(x+2)/(2*x*dl)\n",
      "B=(2*a/R)\n",
      "C=math.pow((3*y/(2*k*R*n1)),(2.0/3.0))\n",
      "D=B+C\n",
      "E=A*D\n",
      "F=1-E\n",
      "Lm=-10*math.log(-F)/math.log(10) # macrobend loss in dB\n",
      "print ('%s %.2f %s' %(\" The macrobend loss = \",Lm,\"dB\"))\n",
      "print (\"\\n The answer is wrong in the textbook \")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The macrobend loss =  -3.99 dB\n",
        "\n",
        " The answer is wrong in the textbook \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7: PgNO-160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Pi=15 # optical power in uw\n",
      "Po=7  # ouput power in uw\n",
      "L=0.15 # length in km\n",
      "Ls=(10*math.log(Pi/Po)/math.log(10))/L # Loss of an optical fiber in dB\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The Loss of an optical fiber = \",Ls,\"dB\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The Loss of an optical fiber =  20.07 dB\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8: PgNo-163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Pi=200*math.pow(10,-6) # average optical power in watt\n",
      "Po=5*math.pow(10,-6) # average output power in watt\n",
      "L=20   # in km\n",
      "L1=12  # in km\n",
      "ns=5   # number of attenuation\n",
      "a=0.9  # attenuation in dB\n",
      "\n",
      "# Calculations\n",
      "sa=10*math.log(Pi/Po)/math.log(10) # signal attenuation\n",
      "sp=sa/L # signal attenuation per km\n",
      "sn=sp*L1 # signal attenuation for 12 km\n",
      "sn1=ns*a # attenuation in dB\n",
      "sn2=sn+sn1 # overall signal attenuation in dB\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The signal attenuation per km = \",sp,\"dB/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The overall signal attenuation= \",sn2,\"dB \"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The signal attenuation per km =  0.80 dB/km\n",
        "\n",
        " The overall signal attenuation=  14.11 dB \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9: PgNo-166"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Pi=100*math.pow(10,-6) # average optical power in watt\n",
      "Po=4*math.pow(10,-6) # average output power in watt\n",
      "L=6 # in km\n",
      "L1=10 # in km\n",
      "\n",
      "# Calculations\n",
      "sa=10*math.log(Pi/Po)/math.log(10) # signal attenuation\n",
      "sp=sa/L # signal attenuation per km\n",
      "sn=sp*L1 # signal attenuation for 12 km\n",
      "sn1=sn+9 # overall signal attenuation in dB\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The signal attenuation= \",sa,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n The signal attenuation per km = \",sp,\"dB/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The overall signal attenuation= \",sn1,\"dB\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The signal attenuation=  13.98 dB\n",
        "\n",
        " The signal attenuation per km =  2.33 dB/km\n",
        "\n",
        " The overall signal attenuation=  32.30 dB\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10: PgNo-167"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "Pi=20*math.pow(10,-6) #average optical power in watt\n",
      "Po=7.5*math.pow(10,-6) # average output power in watt\n",
      "sl=10*math.log(Pi/Po)/math.log(10) # signal Loss in dB\n",
      "L=15 #in km\n",
      "L1=30 # in km\n",
      "ns=29 # number of attenuation\n",
      "sp=sl/L # signal Loss per km\n",
      "sn=sp*L1 # signal attenuation for 30 km\n",
      "sn1=sn+ns # overall signal attenuation in dB\n",
      "i_o=math.pow(10,(sn1/20)) # input output power ratio\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The signal Loss = \",sl,\"dB\"))\n",
      "print ('%s %.2f %s' %(\"\\n The signal Loss per km= \",sp,\"dB/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The overall signal attenuation= \",sn1,\"dB\"))\n",
      "print ('%s %.2f' %(\"\\n The input output power ratio= \",i_o))\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The signal Loss =  4.26 dB\n",
        "\n",
        " The signal Loss per km=  0.28 dB/km\n",
        "\n",
        " The overall signal attenuation=  37.52 dB\n",
        "\n",
        " The input output power ratio=  75.16\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11: PgNo-171"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "Tf=1400 # temperature in k\n",
      "Bc=7*math.pow(10,-11) # in m^2/N\n",
      "n=1.38\n",
      "P=0.29 # Photoelastic coefficient\n",
      "y=0.9*math.pow(10,-6) # wavelength in m\n",
      "K=1.38*math.pow(10,-23) # boltzman's constant\n",
      "\n",
      "# Calculations\n",
      "Rrs=((8*math.pow(math.pi,3)*math.pow(n,8)*math.pow(P,2)*(Bc*Tf*K))/(3*math.pow(y,4)))\n",
      "Rrs1=Rrs/math.pow(10,-3) # per km\n",
      "Lkm=math.pow(math.e,(-Rrs1)) # transmission loss facter\n",
      "At=10*math.log(1/Lkm)/math.log(10) # Attenuation in dB/km\n",
      "\n",
      "# results\n",
      "print ('%s %.2f %s' %(\" The Attenuation= \",At,\"dB/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The Attenuation=  0.82 dB/km\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12: PgNo-172"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "y=1.35 # wavelength in um\n",
      "d=5 # core diamater in um\n",
      "a=0.75 # attenuation in dB/km\n",
      "v=0.45 # bandwidth in GHz\n",
      "\n",
      "# calculations\n",
      "Pb=4.4*math.pow(10,-3)*math.pow(d,2)*math.pow(y,2)*(a*v) #threshold optical power for sbs\n",
      "Pr=5.9*math.pow(10,-2)*math.pow(d,2)*(y)*(a) #threshold optical power for sbr\n",
      "Pbr=Pb/Pr # the ratio of threshold power level\n",
      "print ('%s %.2f %s' %(\" The ratio of threshold power level= \",Pbr*100,\"%\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The ratio of threshold power level=  4.53 %\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13: PgNo-175"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.5 #core refractive index\n",
      "y=0.85*math.pow(10,-6) # wavelength in m\n",
      "dl=0.024 # relative refractive index difference\n",
      "N2=math.sqrt(math.pow(n1,2)-2*dl*math.pow(n1,2)) # cladding refractive index\n",
      "n2=1.46\n",
      "Rcs=(3*math.pow(n1,2)*y)/((4*math.pi)*math.pow((math.pow(n1,2)-math.pow(n2,2)),1.5)) # critical radius of curvature for multimode fiber\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The critical radius of curvature = \",Rcs*pow(10,6),\"um\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The critical radius of curvature =  11.207 um\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14: PgNo-177"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.45 # core refractive index\n",
      "y=1.5*math.pow(10,-6) # wavelength in m\n",
      "dl=0.03 # relative refractive index difference\n",
      "a=5.0*math.pow(10,-6) # core radius\n",
      "n2=math.sqrt(math.pow(n1,2)-2*dl*math.pow(n1,2)) # cladding refractive index\n",
      "yc=(2*math.pi*a*n1*math.sqrt(2*dl))/(2.405)\n",
      "Rcs=(20.0*y*(2.748-0.996*math.pow((y/yc),-3)))/math.pow((math.pow(n1,2)-math.pow(n2,2)),1.5)#critical radius of curvature for single mode fiber\n",
      "Rcs1=(3*math.pow(n1,2)*y)/((4*math.pi)*math.pow(math.pow(n1,2)-math.pow(n2,2),1.5)) # critical radius of curvature for multimode fiber\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The critical radius of curvature for single mode fiber = \",Rcs*pow(10,6),\"um\"))\n",
      "print (\"\\n The answer is wrong in the textbook \")\n",
      "print ('%s %.2f %s' %(\"\\n The critical radius of curvature for multimode fiber = \",Rcs1*pow(10,6),\"um\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The critical radius of curvature for single mode fiber =  -17893.87 um\n",
        "\n",
        " The answer is wrong in the textbook \n",
        "\n",
        " The critical radius of curvature for multimode fiber =  16.80 um\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15: PgNo-179"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable declaration\n",
      "L=500.0/1000.0 # distance in km\n",
      "Pio=(1/(1-0.75))\n",
      "Ls=10*math.log(Pio)/math.log(10)/L # Loss in dB/km\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The Loss = \",Ls,\"dB/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The Loss =  12.041 dB/km\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16: PgNo-181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "L=5 # length in km\n",
      "a=0.5 # attenuaion loss in dB/km\n",
      "# Calculations\n",
      "Po=math.pow(10,-3)*math.pow(10,(-(a*L)/10)) # power level in mW\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The power level = \",Po*pow(10,3),\"mW\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The power level =  0.562 mW\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17: PgNo-186"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "L=1 #distance in km\n",
      "Pio=(1/(1-0.40))\n",
      "# Calculations\n",
      "Ls=10*math.log(Pio)/math.log(10)/L # Loss in dB/km\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The Loss = \",Ls,\"dB/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The Loss =  2.218 dB/km\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18: PgNo-188"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "Pi=1*math.pow(10,-3) # input power in watt\n",
      "Po=0.75*math.pow(10,-3) # output power in watt\n",
      "a=0.5 #in dB/km\n",
      "L=(10*math.log(Pi/Po)/math.log(10))/a # transmission length in km\n",
      "\n",
      "print ('%s %.1f %s'%(\" The transmission length = \",L,\"km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The transmission length =  2.5 km\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19: PgNo-189"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "y=1300.0*math.pow(10,-9) # wavelemgth in m\n",
      "yc=1200.0*math.pow(10,-9) # cut off wavelength in m\n",
      "rc=5.0*math.pow(10,-6) #core diameter in m\n",
      "n=1.5 #refractive index\n",
      "R=1.2/100.0 # curve of radius in m\n",
      "\n",
      "# Calculations\n",
      "dmf=2*rc*((0.65)+0.434*math.pow((y/yc),1.5)+0.0149*math.pow((y/yc),6)) # mode field diameter\n",
      "K=(2.0*math.pi)/y\n",
      "Lm=-10*math.log(-1*(1-math.pow(K,4)*math.pow(n,4)*math.pow(((3.95*math.pow(10,-6))/(8*math.pow(R,2))),6)))/math.log(10) # macrobend loss\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The mode field diameter = \",dmf*pow(10,6),\"um\"))\n",
      "print ('%s %.2f %s' %(\"\\n The macrobend loss = \",Lm,\"dB\"))\n",
      "print (\"\\n The answer is wrong in the textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The mode field diameter =  11.63 um\n",
        "\n",
        " The macrobend loss =  -126.52 dB\n",
        "\n",
        " The answer is wrong in the textbook\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20: PgNO-191"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable initialisation\n",
      "Pi=10*math.pow(10,-3) # input power in watt\n",
      "Po=8*math.pow(10,-3)  # output power in watt\n",
      "L=0.150     # length in km\n",
      "Ls=(10*math.log(Po/Pi)/math.log(10))/L\n",
      "\n",
      "print ('%s %.2f %s' %(\" The transmission length = \",Ls,\"km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The transmission length =  -6.46 km\n"
       ]
      }
     ],
     "prompt_number": 20
    }
   ],
   "metadata": {}
  }
 ]
}