{
 "metadata": {
  "name": "",
  "signature": "sha256:9df1a39eaf45bb37d3874de747aedcb050a5a7704427c92544b1342299e9f172"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : Optical Sources Laser"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1: PgNo-193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable declaration\n",
      "t=0.1*math.pow(10,-6) # pulse broading in sec\n",
      "d=12 # disance in km\n",
      "B=1/(2*t) # max bandwidth MHz\n",
      "\n",
      "# Calculations\n",
      "ds=t/d #dispersion in ns/km\n",
      "bl=B*d # bandwidth length product\n",
      "\n",
      "# Results\n",
      "print ('%s %.1f %s' %(\" The max bandwidth = \",B/pow(10,6),\"MHz\"))\n",
      "print ('%s %.3f %s' %(\"\\n The dispersion = \",ds*pow(10,9),\"ns/km\"))\n",
      "print ('%s %.1f %s' %(\"\\n bandwidth length product = \",bl/pow(10,6),\"MHz km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max bandwidth =  5.0 MHz\n",
        "\n",
        " The dispersion =  8.333 ns/km\n",
        "\n",
        " bandwidth length product =  60.0 MHz km\n"
       ]
      }
     ],
     "prompt_number": 65
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2: PgNo-194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variable initialisation\n",
      "t=0.1*math.pow(10,-6) # pulse broadening in sec\n",
      "d=15 # disance in km\n",
      "B=1/(2*t) # max bandwidth MHz\n",
      "ds=t/d # dispersion in ns/km\n",
      "bl=B*d # bandwidth length product\n",
      "\n",
      "# Results\n",
      "print ('%s %.1f %s' %(\" The max bandwidth = \",B/pow(10,6),\"MHz\"))\n",
      "print ('%s %.3f %s' %(\"\\n The dispersion = \",ds*pow(10,9),\"ns/km\"))\n",
      "print ('%s %.1f %s' %(\"\\n bandwidth length product = \",bl/pow(10,6),\"MHz km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max bandwidth =  5.0 MHz\n",
        "\n",
        " The dispersion =  6.667 ns/km\n",
        "\n",
        " bandwidth length product =  75.0 MHz km\n"
       ]
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3: PgNo-197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.465 # core refractive index\n",
      "n2=1.45 #cladding refractive index\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "NA=math.sqrt(math.pow(n1,2)-math.pow(n2,2)) # numerical aperture\n",
      "Mp=math.pow(NA,2)/(2*n1*c) # multipath pulse broadening in ns/km\n",
      "bl=(1/math.pow(NA,2))*(2*n1*c) # bandwidth length product in GHz km\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" The numerical aperture = \", NA))\n",
      "print ('%s %.2f %s' %(\"\\n The multipath pulse broadening = \",Mp*pow(10,9),\"ns/km\"))\n",
      "print ('%s %.1f %s' %(\"\\n The bandwidth length product = \",bl/pow(10,9),\"GHz km\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The numerical aperture =  0.21\n",
        "\n",
        " The multipath pulse broadening =  0.05 ns/km\n",
        "\n",
        " The bandwidth length product =  20.1 GHz km\n"
       ]
      }
     ],
     "prompt_number": 67
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4: PgNo-199"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "ds=0.020 # material dispersion\n",
      "c=3*math.pow(10,8) # the speed of light m/s\n",
      "y=1.3  #wavelength in um\n",
      "M=ds/(c*y) # material dispersion parameter in ps/nm/km\n",
      "w=6 # spectral width in nm\n",
      "l=1 # length in km\n",
      "rm=w*l*M # rms pulse broadening in ns/km\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The material dispersion parameter = \",M*math.pow(10,12),\"ps/nm/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The rms pulse broadening = \",rm*math.pow(10,9),\"ns/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The material dispersion parameter =  51.28 ps/nm/km\n",
        "\n",
        " The rms pulse broadening =  0.31 ns/km\n"
       ]
      }
     ],
     "prompt_number": 68
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5: PgNo-201"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "wr=0.0014   # relative spectral width in nm\n",
      "y=1.3*math.pow(10,-6)    # wavelength in m\n",
      "w=wr*y      # spectral width in nm\n",
      "ds=0.020    # material dispersion\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "M=ds/(c*y)  # material dispersion parameter in ps/nm/km\n",
      "l=1         # length in km\n",
      "rm=w*l*M    # rms pulse broadening in ns/km\n",
      "\n",
      "print ('%s %.3f %s' %(\" The rms pulse broadening = \",rm*pow(10,9)*pow(10,3),\"ns/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The rms pulse broadening =  0.093 ns/km\n"
       ]
      }
     ],
     "prompt_number": 69
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6: PgNo-205"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "n1=1.46 # core refractive index\n",
      "dl=0.01 # relative index difference\n",
      "L=10*math.pow(10,3) # optical length in meter\n",
      "c=3*math.pow(10,8)  # the speed of light in m/s\n",
      "\n",
      "# calculations\n",
      "dt=(L*n1*dl)/c #delay difference in s\n",
      "dT=dt*math.pow(10,9)  # delay difference in ns\n",
      "rm=(L*n1*dl)/(2*math.sqrt(3)*c) # rms pulse broadening s\n",
      "rM=rm*math.pow(10,9) # rms pulse broadening ns\n",
      "bt=0.2/rm # max bit rate in bit/sec\n",
      "bT=bt/math.pow(10,6) # max bit rate in M bits/sec\n",
      "bl=bt*L # bandwidth length product in Hz meter\n",
      "bL=(bt*L)/(math.pow(10,6)*math.pow(10,3))  #bandwidth length product in MHz km\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The delay difference = \",dT,\"ns\"))\n",
      "print ('%s %.2f %s' %(\"\\n The rms pulse broadening = \",rM,\"ns\"))\n",
      "print ('%s %.2f %s' %(\"\\n The max bit rate = \",bT,\"M bits/sec\"))\n",
      "print ('%s %.2f %s' %(\"\\n The bandwidth length product = \",bL,\"MHz km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The delay difference =  486.67 ns\n",
        "\n",
        " The rms pulse broadening =  140.49 ns\n",
        "\n",
        " The max bit rate =  1.42 M bits/sec\n",
        "\n",
        " The bandwidth length product =  14.24 MHz km\n"
       ]
      }
     ],
     "prompt_number": 70
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7: PgNo-208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.5 # core refractive index\n",
      "dl=0.01 # relative index difference\n",
      "L=6*math.pow(10,3) # optical length in meter\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "\n",
      "# calculations\n",
      "rm=(L*n1*dl)/(2*math.sqrt(3)*c) # rms pulse broadening s\n",
      "rM=rm*math.pow(10,9) # rms pulse broadening ns\n",
      "bt=0.2/rm # max bit rate in bit/sec\n",
      "bT=bt/math.pow(10,6) # max bit rate in M bits/sec\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The rms pulse broadening = \",rM,\"ns\"))\n",
      "print ('%s %.4f %s' %(\"\\n The max bit rate = \",bT,\"M bits/sec\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The rms pulse broadening =  86.60 ns\n",
        "\n",
        " The max bit rate =  2.3094 M bits/sec\n"
       ]
      }
     ],
     "prompt_number": 71
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8: PgNo-209"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.4  # core refractive index\n",
      "dl=0.012 # relative index difference\n",
      "L=6*math.pow(10,3) # optical length in meter\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "\n",
      "# Calculations\n",
      "dt=(L*n1*dl)/c # delay difference in s\n",
      "dT=dt*math.pow(10,9) # delay difference in ns\n",
      "rm=(L*n1*dl)/(2*math.sqrt(3)*c) # rms pulse broadening s\n",
      "rM=rm*math.pow(10,9) # rms pulse broadening ns\n",
      "bt=0.2/rm # max bit rate in bit/sec\n",
      "bT=bt/math.pow(10,6) # max bit rate in M bits/sec\n",
      "\n",
      "# Results\n",
      "print ('%s %.f %s' %(\" The delay difference = \",dT,\"ns\"))\n",
      "print ('%s %.1f %s' %(\"\\n The rms pulse broadening = \",rM,\"ns\"))\n",
      "print ('%s %.3f %s' %(\"\\n The max bit rate = \",bT,\"M bits/sec\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The delay difference =  336 ns\n",
        "\n",
        " The rms pulse broadening =  97.0 ns\n",
        "\n",
        " The max bit rate =  2.062 M bits/sec\n"
       ]
      }
     ],
     "prompt_number": 72
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9: PgNo-211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "n1=1.5 #core refractive index\n",
      "c=3*math.pow(10,8) # the speed of light m/s\n",
      "w=6*math.pow(10,-6) # rms spectral width in m\n",
      "M=200   # material dispersion parameter in ps/nm/km\n",
      "NA=0.25 # numerical aperture\n",
      "w=50   # spectral width in nm\n",
      "L=1    # length in m\n",
      "\n",
      "# calculations\n",
      "rm=w*L*M # rms pulse broadening in s/km\n",
      "rM=rm/math.pow(10,3) # rms pulse broadening in ns/km due to material dispersion\n",
      "rm1=(L*1000*math.pow((NA),2))/(4*math.sqrt(3)*n1*c) # rms pulse broadening in ns/km due to material dispersion in sec/m\n",
      "rM1=rm1*math.pow(10,9) # rms pulse broadening in ns/km due to intermodel dispersion in ns/km\n",
      "rmt=math.sqrt(math.pow(rM,2)+math.pow(rM1,2)) # total rms pulse broadening in ns/km\n",
      "bl=0.2/(rmt*math.pow(10,-9)) # bandwidth length product in Hz km\n",
      "bL=bl/math.pow(10,6) # bandwidth length product in MHz km\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The total rms pulse broadening = \",rmt,\"ns/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The bandwidth length product = \",bL,\"MHz km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The total rms pulse broadening =  22.40 ns/km\n",
        "\n",
        " The bandwidth length product =  8.93 MHz km\n"
       ]
      }
     ],
     "prompt_number": 73
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10: PgNo-214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "yo=1320.0 # zero dispersion wavelength in nm\n",
      "y=1290.0  # dispersion wavelength in nm\n",
      "so=0.092 # dispersion slop\n",
      "dt=(y*so/4)*(1-math.pow((yo/y),4)) #toal first order dispersion at 1290 nm in ps/nm/km\n",
      "yo1=1310.0 # zero dispersion wavelength in um\n",
      "y1=1550.0  # dispersion wavelength in nm\n",
      "so=0.092 # dispersion slope\n",
      "dt1=(y1*so/4)*(1-math.pow((yo1/y1),4)) # toal first order dispersion at 1550 nm in ps/nm/km\n",
      "DM=13.5 # profile dispersion in ps/nm/km\n",
      "DP=0.4  # profile dispersion in ps/nm/km\n",
      "DW=dt1-(DM+DP) # wavelength dispersion in ps/nm/km\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The total first order dispersion at 1290 nm = \",dt,\"ps/nm/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The total first order dispersion at 1550 nm = \",dt1,\"ps/nm/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The wavelength dispersion at 1550 nm = \",DW,\"ps/nm/km\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The total first order dispersion at 1290 nm =  -2.86 ps/nm/km\n",
        "\n",
        " The total first order dispersion at 1550 nm =  17.46 ps/nm/km\n",
        "\n",
        " The wavelength dispersion at 1550 nm =  3.56 ps/nm/km\n"
       ]
      }
     ],
     "prompt_number": 74
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11: PgNo-218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable declaration\n",
      "L=6*math.pow(10,-2) # beat length in m\n",
      "dy=6*math.pow(10,-9) # spectral width in m\n",
      "y=1.3*math.pow(10,-6) # operating wavelength in m\n",
      "\n",
      "# Calculations\n",
      "BF=y/(L) # model birefrigence in um\n",
      "Lc=math.pow(y,2)/(BF*dy) # coherence length in m\n",
      "db=2*math.pi/(L) #difference beween two propagation constants\n",
      "dB=(2*math.pi*BF)/y\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The model birefrigence = \",BF*pow(10,6),\"um\"))\n",
      "print ('%s %.1f %s' %(\"\\n The coherence length= \",Lc,\"m\"))\n",
      "print ('%s %.2f' %(\"\\n The difference beween two propagation constants= \", db))\n",
      "print ('%s %.2f' %(\"\\n The difference beween two propagation constants= \", dB))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The model birefrigence =  21.67 um\n",
        "\n",
        " The coherence length=  13.0 m\n",
        "\n",
        " The difference beween two propagation constants=  104.72\n",
        "\n",
        " The difference beween two propagation constants=  104.72\n"
       ]
      }
     ],
     "prompt_number": 75
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12: PgNo-219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "y=0.85*math.pow(10,-6) # operating wavelength in m\n",
      "L=0.5*math.pow(10,-3) # beat length in m\n",
      "BF=y/(L) # model birefrigence in um\n",
      "L1=75 # beat length in m\n",
      "BF1=y/(L1) #model birefrigence in um\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The model birefrigenceat 0.5 nm = \",BF,\"*10^-3\"))\n",
      "print ('%s %.3f %s' %(\"\\n The model birefrigence at 75 m = \",BF1*math.pow(10,8),\"*10^-8\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The model birefrigenceat 0.5 nm =  0.0017 *10^-3\n",
        "\n",
        " The model birefrigence at 75 m =  1.133 *10^-8\n"
       ]
      }
     ],
     "prompt_number": 76
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13: PgNo-222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "Lc=100000 # coherence length in m\n",
      "y=1.32*math.pow(10,-6) # operating wavelength in m\n",
      "dy=1.5*math.pow(10,-9) # spectral width in m\n",
      "BF=math.pow(y,2)/(Lc*dy) # model birefrigence in um\n",
      "L=y/BF # beat length in m\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The beat length= \",L,\"m\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The beat length=  113.64 m\n"
       ]
      }
     ],
     "prompt_number": 77
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14: PgNo-225"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable initialisation\n",
      "n1=1.46 # core refractive index\n",
      "NA=0.25 # numerical aperture\n",
      "c=3*math.pow(10,5) # the speed of light km/s\n",
      "L=7  # length in km\n",
      "si=math.pow(NA,2)/(4*math.sqrt(3)*n1*c) # intermodel pulse broadening ns/km\n",
      "st=si*L # total intermodel pulse broadening\n",
      "BW=0.187/st # bandwidth in MHz\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The intermodel pulse broadening = \",st*math.pow(10,9),\"ns/km\"))\n",
      "print ('%s %.4f %s' %(\"\\n The bandwidth = \",BW/math.pow(10,6),\"MHz\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The intermodel pulse broadening =  144.17 ns/km\n",
        "\n",
        " The bandwidth =  1.2971 MHz\n"
       ]
      }
     ],
     "prompt_number": 78
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15: PgNo-227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.46 # core refractive index\n",
      "df=0.025\n",
      "L=500 # length in m\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "dt=(n1*L*math.pow(df,2))/(8*c) # max dispersion in ns/m\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The  max dispersion = \",dt*math.pow(10,9),\"ns/m\"))\n",
      "print (\"\\n The answer in the textbook is wrong \")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The  max dispersion =  0.1901 ns/m\n",
        "\n",
        " The answer in the textbook is wrong \n"
       ]
      }
     ],
     "prompt_number": 79
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16: PgNo-229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "dy=15 # spectral width in nm\n",
      "L=25 # optical length in km\n",
      "ps=1.60 #pulse spreads in ns/km\n",
      "pS=1.6 # pulse spreads in ns/km\n",
      "d=pS/(dy*L) # material dispersion in ns/km^2/nm\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The  max dispersion = \",d,\"ns/km^2/nm\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The  max dispersion =  0.0043 ns/km^2/nm\n"
       ]
      }
     ],
     "prompt_number": 80
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 17: PgNo-231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "n1=1.46 # core refractive index\n",
      "NA=0.2 # numerical aperture\n",
      "L=1.5*math.pow(10,3) # length in m\n",
      "c=3*math.pow(10,8) # the spee of light in m/s\n",
      "dt=(L*math.pow(NA,2))/(2*c*n1) #intermodel dispersion in ns/km\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The intermodel dispersion = \",dt*math.pow(10,9),\"ns/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The intermodel dispersion =  68.493 ns/km\n"
       ]
      }
     ],
     "prompt_number": 81
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 18: PgNo-234"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "BLP=250*math.pow(10,6) # bandwidth length product in Hz\n",
      "tr=0.32/BLP  # intermodel pulse width broadening\n",
      "md=75    # material dispersion in ps/nm.km\n",
      "tm=2.25  # pulse broadening due to material dispersion in ns/km\n",
      "tc=math.sqrt(math.pow((tr*math.pow(10,9)),2)+math.pow(tm,2)) # combine pulse broadening in ns/km\n",
      "Ba=0.32/tm*math.pow(10,9)  # actual BLP in Hz.km\n",
      "Bac=Ba/math.pow(10,6) # actual BLP in MHz.km\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The intermodel pulse width broadening = \",tr*pow(10,9),\"ns/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n pulse broadening due to material dispersion = \",tm,\"ns/km\"))\n",
      "print ('%s %.4f %s' %(\"\\n The combine pulse broadening = \",tc,\"ns/km\"))\n",
      "print ('%s %.2f %s' %(\"\\n The actual BLP = \",Bac,\"MHz.km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The intermodel pulse width broadening =  1.28 ns/km\n",
        "\n",
        " pulse broadening due to material dispersion =  2.25 ns/km\n",
        "\n",
        " The combine pulse broadening =  2.5886 ns/km\n",
        "\n",
        " The actual BLP =  142.22 MHz.km\n"
       ]
      }
     ],
     "prompt_number": 82
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 19: PgNo-235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "L=40 # length in m\n",
      "Ny=.75 # in ps/nm\n",
      "dy=8  # spectral width in nm\n",
      "t_mat=L*Ny*dy  # chromatic/material dispersion in ps\n",
      "t_mat1=t_mat/1000 # chromatic/material dispersion in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The chromatic/material dispersion = \",t_mat1,\"ns\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The chromatic/material dispersion =  0.24 ns\n"
       ]
      }
     ],
     "prompt_number": 83
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 20: PgNo-237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "y=1.3 # operating wavelength in um\n",
      "md=2.80 # material dispersion in ns\n",
      "wd=0.50 # waveguide dispersion in ns\n",
      "wt=0.60 # width of transmitted pulse in ns\n",
      "\n",
      "# Calculations\n",
      "td=math.sqrt(math.pow(md,2)+math.pow(wd,2)) # total dispersion in ns\n",
      "dt=wt+td  # received pulse width in ns\n",
      "br=1/(5*dt*math.pow(10,-9)) # max bit rate bit/sec\n",
      "Br=br/math.pow(10,6) # max bit rate in mbps\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The received pulse width = \",dt,\"ns\"))\n",
      "print ('%s %.4f %s' %(\"\\n The  max bit rate = \",Br,\"mbps\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The received pulse width =  3.4443 ns\n",
        "\n",
        " The  max bit rate =  58.0671 mbps\n"
       ]
      }
     ],
     "prompt_number": 84
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 21: PgNo-239"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "y=0.85  #  operating wavelength in um\n",
      "md=2.75 # material dispersion in ns\n",
      "wd=0.45 # waveguide dispersion in ns\n",
      "wt=0.50 # width of transmitted pulse in ns\n",
      "\n",
      "# Calculations\n",
      "td=math.sqrt(math.pow(md,2)+math.pow(wd,2)) # total dispersion in ns\n",
      "dt=wt+td # received pulse width in ns\n",
      "br=1/(5*dt*math.pow(10,-9)) # max bit rate bit/sec\n",
      "Br=br/math.pow(10,6) # max bit rate in mbps\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The received pulse width = \",dt,\"ns\"))\n",
      "print ('%s %.2f %s' %(\"\\n The  max bit rate = \",Br,\"mbps\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The received pulse width =  3.2866 ns\n",
        "\n",
        " The  max bit rate =  60.85 mbps\n"
       ]
      }
     ],
     "prompt_number": 85
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 22: PgNo-241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.46 #  core refractive index\n",
      "df=0.025\n",
      "L=1500 # length in meter\n",
      "c=3*math.pow(10,8) # the speed of ligth in m/s\n",
      "md=(n1*L*df)/(c*(1-df)) # max dispersion in sec\n",
      "Md=md*math.pow(10,9) # max dispersion in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The max dispersion = \",Md,\"ns\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max dispersion =  187.18 ns\n"
       ]
      }
     ],
     "prompt_number": 86
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 23: PgNo-243"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.5 #  core refractive index\n",
      "L=1000 # length in meter\n",
      "NA=0.22 # numerical aperture\n",
      "\n",
      "# Calculations\n",
      "dl=math.pow((NA/n1),2)/2;\n",
      "c=3*math.pow(10,8) # the speed of ligth in m/s\n",
      "dt=(L*n1*dl)/c #intermodel dispersion in sec\n",
      "dT=dt*math.pow(10,9) # intermodel dispersion in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The max dispersion = \",dT,\"ns\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max dispersion =  53.78 ns\n"
       ]
      }
     ],
     "prompt_number": 87
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 24: PgNo-246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "w=30.0 #  line width in nm\n",
      "L=1.5 # length in km\n",
      "d1=6.0  # in ns/km\n",
      "d2=85.0 # in ps/km/nm\n",
      "d3=d2/1000 # in ns/km/nm\n",
      "dt=d1*L # intermodel dispersion in ns\n",
      "dt1=w*d3*L # intramodel dispersion in ns\n",
      "dT=math.sqrt(math.pow(dt,2)+math.pow(dt1,2)) # total dispersion in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.1f %s' %(\" The max dispersion = \",dt,\"ns\"))\n",
      "print ('%s %.3f %s' %(\"\\n The max dispersion = \",dt1,\"ns\"))\n",
      "print ('%s %.3f %s' %(\"\\n The max dispersion = \",dT,\"ns\"))\n",
      "print (\"\\n answer in the textbook is wrong \")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max dispersion =  9.0 ns\n",
        "\n",
        " The max dispersion =  3.825 ns\n",
        "\n",
        " The max dispersion =  9.779 ns\n",
        "\n",
        " answer in the textbook is wrong \n"
       ]
      }
     ],
     "prompt_number": 88
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 25: PgNo-248"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.55  # core refractive index\n",
      "n2=1.48  # cladding refractive index\n",
      "l=150   # fiber length in m\n",
      "c=3*math.pow(10,8) #the speed of light in m/s\n",
      "\n",
      "# calculations\n",
      "dl=(math.pow(n1,2)-math.pow(n2,2))/(2*n1)\n",
      "dL=0.068\n",
      "dt=(l*n1*dL)/(c) # intermodel dispersion in s\n",
      "dT=dt*math.pow(10,9) # intermodel dispersion in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The intermodel dispersion = \",dT,\"ns\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The intermodel dispersion =  52.70 ns\n"
       ]
      }
     ],
     "prompt_number": 89
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 26: PgNo-249"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "n1=1.42 # core refractive index\n",
      "dl=0.02\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "dt=(n1*dl)/c # intermodel disersion in sec/m\n",
      "dt1=dt*1000 # intermodel disersion in sec/km\n",
      "dt2=dt1*math.pow(10,9) # intermodel disersion in ns/km\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The intermodel dispersion per km = \",dt2,\"ns/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The intermodel dispersion per km =  94.667 ns/km\n"
       ]
      }
     ],
     "prompt_number": 90
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 27: PgNo-251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Results\n",
      "print (\" Dwg=n2*(dl/cy)*V(d^2(Vb)/dV^2)\")\n",
      "print (\"\\n Dwg=n2*(dl/cy)*V(d^2(V(1-exp(-V))))/dv^2\")\n",
      "print (\"\\n =CV(Z-V)exp(-V)\")\n",
      "print (\"\\n where C=n2(dl/cy)\")\n",
      "print (\"\\n waveguide dispersion will be zero , when V=2\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Dwg=n2*(dl/cy)*V(d^2(Vb)/dV^2)\n",
        "\n",
        " Dwg=n2*(dl/cy)*V(d^2(V(1-exp(-V))))/dv^2\n",
        "\n",
        " =CV(Z-V)exp(-V)\n",
        "\n",
        " where C=n2(dl/cy)\n",
        "\n",
        " waveguide dispersion will be zero , when V=2\n"
       ]
      }
     ],
     "prompt_number": 91
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 28: PgNo-255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# variable initialisation\n",
      "y=900.0   # operating wavelength in nm\n",
      "yo=1343.0 # wavelength in nm\n",
      "so=0.095 # in ps/nm^2-km\n",
      "L=150.0  #  in km\n",
      "dy=50.0  # in nm\n",
      "\n",
      "# calculations\n",
      "Dy=(so*y/4)*(1-math.pow((yo/y),4)) # inps/nm-km\n",
      "Dy1=Dy*(-1) # do not consider -ve sign\n",
      "dt=Dy1*L*dy # pulse spreading in ps\n",
      "dt1=dt/1000 # pulse spreading in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.3f %s' %(\" The pulse spreading = \",dt1,\"ns\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pulse spreading =  634.567 ns\n"
       ]
      }
     ],
     "prompt_number": 92
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 29: PgNo-260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "n1=1.48 #  core refractive index\n",
      "y=900  # operating wavelength in nm\n",
      "yo=1343 # wavelength in nm\n",
      "so=0.095 # in ps/nm^2-km\n",
      "L=1.5 # in km\n",
      "dy=50 # in nm\n",
      "dl=0.002\n",
      "c=3*math.pow(10,8) # the speed of ligth in m/s\n",
      "\n",
      "# calculations\n",
      "Dm=(so*y/4)*(1-math.pow((yo/y),4))# inps/nm-km\n",
      "Dm1=Dm*(-1) # do not consider -ve sign\n",
      "Vd=0.26\n",
      "Dw=((n1*dl)/(c*y*math.pow(10,-9)))*(Vd);\n",
      "DW=Dw*math.pow(10,6)# in ps/nm-km\n",
      "dt=DW*L*dy #  pulse spreading in ps\n",
      "dt1=dt/100 # pulse spreading in ns\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The pulse spreading = \",dt1,\"ps\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The pulse spreading =  2.1378 ps\n"
       ]
      }
     ],
     "prompt_number": 93
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 30: PgNo-263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "a=4.1*math.pow(10,-6) # core radius in um\n",
      "dl=0.0036\n",
      "y1=1.310*math.pow(10,-6) # operating wavelength in um\n",
      "y2=1.550*math.pow(10,-6)# operating wavelength in um\n",
      "n1=1.4677# core refrative index at y=1.310\n",
      "n2=1.4682# core refrative index at y=1.550\n",
      "\n",
      "# Calculations\n",
      "v1=(2*3.14*a*n1*math.sqrt(2*dl))/y1# normalised frequency at y=1.310\n",
      "v2=(2*3.14*a*n2*math.sqrt(2*dl))/y2# normalised frequency at y=1.550\n",
      "wo=a*(0.65+(1.619/math.pow(v1,1.5))+2.879/math.pow(v1,3))\n",
      "wp=wo-a*(0.016+1.567/math.pow(v1,7))\n",
      "wo1=a*(0.65+(1.619/math.pow(v2,1.5))+2.879/math.pow(v2,3))\n",
      "wp1=wo-a*(0.016+1.567/math.pow(v2,7))\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The value of wo = \",wo*pow(10,6),\"um\"))\n",
      "print ('%s %.4f %s' %(\"\\n The value of wp = \",wp*pow(10,6),\"um\"))\n",
      "print ('%s %.4f %s' %(\"\\n The value of wo1 = \",wo1*pow(10,6),\"um\"))\n",
      "print ('%s %.4f %s' %(\"\\n The value of wp1 = \",wp1*pow(10,6),\"um\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The value of wo =  5.2031 um\n",
        "\n",
        " The value of wp =  5.1253 um\n",
        "\n",
        " The value of wo1 =  6.2264 um\n",
        "\n",
        " The value of wp1 =  5.0980 um\n"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 31: PgNo-268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Initialisation of variables\n",
      "y=1.30*math.pow(10,-6) #  operating wavelength in m\n",
      "dn1=math.pow(10,-6)\n",
      "dn2=math.pow(10,-5)\n",
      "\n",
      "# Calculations\n",
      "db1=(dn1*2*3.14)/y# in per m\n",
      "db2=(dn2*2*3.14)/y# in per m\n",
      "Lp1=(2*3.14)/(db1)# beat length in m\n",
      "Lp2=(2*3.14)/(db2)# beat length in m\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The max core radius = \",db1,\"um\"))\n",
      "print ('%s %.2f %s' %(\"\\n The max core radius = \",db2,\"um\"))\n",
      "print ('%s %.2f %s' %(\"\\n The beat length = \",Lp1,\"m\"))\n",
      "print ('%s %.1f %s' %(\"\\n The beat length = \",Lp2*100,\"cm\"))\n",
      "print (\"\\n Hence, range of beat length; 13cm-1.3m\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The max core radius =  4.83 um\n",
        "\n",
        " The max core radius =  48.31 um\n",
        "\n",
        " The beat length =  1.30 m\n",
        "\n",
        " The beat length =  13.0 cm\n",
        "\n",
        " Hence, range of beat length; 13cm-1.3m\n"
       ]
      }
     ],
     "prompt_number": 95
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 32: PgNo-269"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable initialisation\n",
      "n1=1.48     #  core refractive index\n",
      "dl=0.0027\n",
      "a=4.4*math.pow(10,-6) # radius in m\n",
      "y=1.32*math.pow(10,-6) # operating wavelength in m\n",
      "n2=n1*(1-dl)\n",
      "c=3*math.pow(10,8) # the speed of ligth in m/s\n",
      "v=(2*3.14*a*n1*math.sqrt(2*dl))/y\n",
      "VD=0.080+0.549*math.pow((2.834-v),2)\n",
      "DW=(-1)*(n2*dl*VD)/(c*y) # wavelength dispersion in s /um/m\n",
      "Dw=DW*math.pow(10,6)  # wavelength dispersion in ps /nm/km\n",
      "\n",
      "# Results\n",
      "print ('%s %.4f %s' %(\" The wavelength dispersion =  \",Dw,\"ps n/m/km\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The wavelength dispersion =   -2.5213 ps n/m/km\n"
       ]
      }
     ],
     "prompt_number": 96
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 33: PgNo-271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable initialisation\n",
      "n1=1.48 #  core refractive index\n",
      "dl=0.01 #  refractive index difference\n",
      "c=3*math.pow(10,8) # the speed of light in m/s\n",
      "y=1.55 # wavelength in um\n",
      "DM=7.0 # in ps/nm-km\n",
      "DW=(-1)*DM # in ps/nm-km\n",
      "\n",
      "# calculations\n",
      "X=math.pow(-10,12)*(n1*dl)/(c*y)# in ps/nm/km\n",
      "Z=(DW/X)-0.08\n",
      "V=2.834-math.sqrt(-Z/0.549)\n",
      "a=(V*y)/(2*math.pi*n1*math.sqrt(2*dl))# core radius in um\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" The core radius = \",a,\"um\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The core radius =  2.47 um\n"
       ]
      }
     ],
     "prompt_number": 97
    }
   ],
   "metadata": {}
  }
 ]
}