{
 "metadata": {
  "celltoolbar": "Raw Cell Format",
  "name": "",
  "signature": "sha256:203945c2a904a6f0edf3cdf28ac6e63e0d37dadb3a95128dce91cd424eb43420"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9: Optical Fibers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1,Page number 296"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "n2=1.35;            #refractive index\n",
      "n1=1.4;             #refractive index\n",
      "Wo=math.degrees(math.asin(n2/n1));    #in radians\n",
      "print\"Critical Angle,Wo =\",round(Wo,4),\"degree\";\n",
      "NA=sqrt(n1**2-n2**2);\n",
      "print\"Numerical Aperture,NA =\",round(NA,4);\n",
      "Wa=math.degrees(math.asin(NA));       #in radians\n",
      "print\"Angle of acceptance,Wa =\",round(Wa,4),\"degree\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Critical Angle,Wo = 74.6411 degree\n",
        "Numerical Aperture,NA = 0.3708\n",
        "Angle of acceptance,Wa = 21.7656 degree\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2,Page number 300"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Po=8;           #in mW\n",
      "Pi=50.;         #in mW\n",
      "l=15;           #in km\n",
      "TA=-10*math.log10(Po/Pi);\n",
      "print\"Total fibre Attenuation,L =\",round(TA,4),\"dB/\",l,\"km\";\n",
      "Alpha=TA/l;     \n",
      "print\"Alpha is =\",round(Alpha,4),\"dB/km\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total fibre Attenuation,L = 7.9588 dB/ 15 km\n",
        "Alpha is = 0.5306 dB/km\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3,Page number 300"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Po=10.;            #in mW\n",
      "Pi=150;            #in mW\n",
      "Alpha=0.8;         #in dB/km\n",
      "TA=-10*math.log10(Po/Pi);\n",
      "print\" Total fibre Attenuation,L =\",round(TA,4),\"dB\";\n",
      "l=TA/Alpha;\n",
      "print\" maximum length is,l =\",round(l,4),\"km\";\n",
      "\n",
      "#Round off Variations appear"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Total fibre Attenuation,L = 11.7609 dB\n",
        " maximum length is,l = 14.7011 km\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4,Page number 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "B=92*10**-12;         #in m**2/N\n",
      "Tf=1550;              #in K\n",
      "n=1.46;               #refractive index\n",
      "p=0.29;\n",
      "K=1.38*10**-23;       #in J/K\n",
      "l=1;             #in km\n",
      "L1=630;          #in nm\n",
      "L2=1330;         #in nm\n",
      "L3=1550;         #in nm\n",
      "print\"Rayleight scattering coefficient\";\n",
      "Y1=8*math.pi**3*n**8*p**2*B*K*Tf/3/(L1*10**-9)**4;\n",
      "Y2=8*math.pi**3*n**8*p**2*B*K*Tf/3/(L2*10**-9)**4;\n",
      "Y3=8*math.pi**3*n**8*p**2*B*K*Tf/3/(L3*10**-9)**4;  \n",
      "print\"for L1= 630nm, is\",\"{0:.3e}\".format(Y1);\n",
      "print\"for L2= 1330nm, is\",\"{0:.3e}\".format(Y2);\n",
      "print\"for L3= 1550nm, is\",\"{0:.3e}\".format(Y3);\n",
      "#Misprinted answer\n",
      "\n",
      "print\"Rayleight scattering attenuation factor\";\n",
      "Fr1=math.e**-(Y1*l*10**3);\n",
      "Fr2=math.e**-(Y2*l*10**3);\n",
      "Fr3=math.e**-(Y3*l*10**3);\n",
      "print\"for Y1=  0.00179 is\",round(Fr1,4);\n",
      "print\"for Y2=  0.00009 is\",round(Fr2,4);\n",
      "print\"for Y3=  0.0000182 is\",round(Fr3,4);\n",
      "\n",
      "\n",
      "print\"Rayleight scattering attenuation\";\n",
      "Ar1=10*math.log10(Fr1**-1);\n",
      "Ar2=10*math.log10(Fr2**-1);\n",
      "Ar3=10*math.log10(Fr3**-1);\n",
      "print\"for Ar1=  0.17 is\",round(Ar1,4),\"dB/km\";\n",
      "print\"for Ar2=  0.91 is\",round(Ar2,4),\"dB/km\";\n",
      "print\"for Ar3=  0.98 is\",round(Ar3,4),\"dB/km\";\n",
      "#For L3 answers in book are misprinted"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Rayleight scattering coefficient\n",
        "for L1= 630nm, is 1.793e-03\n",
        "for L2= 1330nm, is 9.029e-05\n",
        "for L3= 1550nm, is 4.895e-05\n",
        "Rayleight scattering attenuation factor\n",
        "for Y1=  0.00179 is 0.1664\n",
        "for Y2=  0.00009 is 0.9137\n",
        "for Y3=  0.0000182 is 0.9522\n",
        "Rayleight scattering attenuation\n",
        "for Ar1=  0.17 is 7.7886 dB/km\n",
        "for Ar2=  0.91 is 0.3921 dB/km\n",
        "for Ar3=  0.98 is 0.2126 dB/km\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5,Page number 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=850;          #in nm\n",
      "L1=0.850;       #converted L in micrometer for using in given formula\n",
      "A=0.5;          #in dB/km\n",
      "d=5;            #in micrometer\n",
      "Bw=1;           #in Gz\n",
      "Po=4.4*10**-3*A*Bw*L1**2*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.0397 W\n",
        "Therefore,Po(Th) = 39.7375 mW\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6,Page number 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=1330;         #in nm\n",
      "L1=1.330;       #converted L in micrometer for using in given formula\n",
      "A=0.5;          #in dB/km\n",
      "d=5;            #in micrometer\n",
      "Bw=1;           #in Gz\n",
      "Po=4.4*10**-3*A*Bw*L1**2*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.0973 W\n",
        "Therefore,Po(Th) = 97.2895 mW\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.7,Page number 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=1550;         #in nm\n",
      "L1=1.550;       #converted L in micrometer for using in given formula\n",
      "A=0.5;          #in dB/km\n",
      "d=5;            #in micrometer\n",
      "Bw=1;           #in Gz\n",
      "Po=4.4*10**-3*A*Bw*L1**2*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.1321 W\n",
        "Therefore,Po(Th) = 132.1375 mW\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.8,Page number 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=850;          #in nm\n",
      "L1=0.850;       #converted L in micrometer for using in given formula\n",
      "A=0.5;          #in dB/km\n",
      "d=8;            #in micrometer\n",
      "Bw=1;           #in Gz\n",
      "Po=4.4*10**-3*A*Bw*L1**2*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.1017 W\n",
        "Therefore,Po(Th) = 101.728 mW\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.9,Page number 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=850;          #in nm\n",
      "L1=0.850;       #converted L in micrometer for using in given formula\n",
      "A=0.5;          #in dB/km\n",
      "d=10;           #in micrometer\n",
      "Bw=1;           #in Gz\n",
      "Po=4.4*10**-3*A*Bw*L1**2*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.159 W\n",
        "Therefore,Po(Th) = 158.95 mW\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.10,Page number 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=850.;         #in nm\n",
      "L1=L/1000;      #converted L in micrometer for using in given formula\n",
      "A=0.4;          #in dB/km\n",
      "d=5;            #in micrometer\n",
      "Po=5.9*10**-2*A*L1*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.5015 W\n",
        "Therefore,Po(Th) = 501.5 mW\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.11,Page number 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=1330.;          #in nm\n",
      "L1=L/1000;        #converted L in micrometer for using in given formula\n",
      "A=0.4;            #in dB/km\n",
      "d=5;              #in micrometer\n",
      "Po=5.9*10**-2*A*L1*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";  #unit in book is wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.7847 W\n",
        "Therefore,Po(Th) = 784.7 mW\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.12,Page number 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=1550.;          #in nm\n",
      "L1=L/1000;        #converted L in micrometer for using in given formula\n",
      "A=0.4;            #in dB/km\n",
      "d=5;              #in micrometer\n",
      "Po=5.9*10**-2*A*L1*d**2;\n",
      "print\"Po(Th) =\",round(Po,4),\"W\";\n",
      "print\"Therefore,Po(Th) =\",round(Po*1000,4),\"mW\";   #unit in book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Po(Th) = 0.9145 W\n",
        "Therefore,Po(Th) = 914.5 mW\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.13,Page number 310"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "R=25;                #in nm\n",
      "R1=25*10**-6;        #in m\n",
      "L=1000;              #in nm\n",
      "L1=10**-6;           #in m\n",
      "NA=0.2;     \n",
      "V=2*math.pi/L1*R1*NA;\n",
      "print\"Normalised frequency(V) =\",round(V,4);\n",
      "y=2.;                #for parabolic\n",
      "Mmax=y/(y+2)*(V**2)/2;\n",
      "print\"Maximum number of modes is equal to =\",round(Mmax,4);   #answer mistake in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Normalised frequency(V) = 31.4159\n",
        "Maximum number of modes is equal to = 246.7401\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.14,Page number 313"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Tp=0.25;             #in microsec\n",
      "fB=0.529/Tp/10**-6;  #channel bitrate\n",
      "fBw=fB;              #channel bandwidth = channel bitrate when zero ISI and RZ input data is modulated\n",
      "print\"Maximum operating bandwidth =\",round(fBw*10**-6,4),\"MHz\";\n",
      "L=50;            #in km\n",
      "D=Tp*10**-6/L;   #Dispersion\n",
      "print\"Dispersion =\",round(D*10**9,4),\"ns/km\";\n",
      "fBwL=fBw*10**-6*L;            #bandwidth length product\n",
      "print\"Bandwidth length product(fBw*L) =\",round(fBwL,4),\"MHz/km\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum operating bandwidth = 2.116 MHz\n",
        "Dispersion = 5.0 ns/km\n",
        "Bandwidth length product(fBw*L) = 105.8 MHz/km\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.15,Page number 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Tp=2;               #in microsec\n",
      "fB=0.529/Tp/10**-6; #channel bit rate\n",
      "fBw=fB;             #channel bandwidth = channel bitrate when zero ISI and RZ input data is modulated\n",
      "print\"Maximum operating bandwidth =\",round(fBw*10**-6,4),\"MHz\";\n",
      "L=50;            #in km\n",
      "D=Tp*10**-6/L;   #Dispersion\n",
      "print\"Dispersion =\",round(D*10**9,4),\"ns/km\";       #unit in book is wrong\n",
      "fBwL=fBw*10**-6*L;            #bandwidth length product\n",
      "print\"Bandwidth length product(fBw*L) =\",round(fBwL,4),\"MHz/km\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum operating bandwidth = 0.2645 MHz\n",
        "Dispersion = 40.0 ns/km\n",
        "Bandwidth length product(fBw*L) = 13.225 MHz/km\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.16,Page number 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Tp=5;                 #in microsec\n",
      "fB=0.529/Tp/10**-6;   #channel bitrate\n",
      "fBw=fB;               #channel bandwidth = channel bitrate when zero ISI and RZ input data is modulated\n",
      "print\"Maximum operating bandwidth =\",round(fBw*10**-6,4),\"MHz\";\n",
      "L=50;            #in km\n",
      "D=Tp*10**-6/L;   #Dispersion\n",
      "print\"Dispersion =\",round(D*10**6,4),\"micro s/km\";\n",
      "fBwL=fBw*10**-6*L;            #bandwidth length product\n",
      "print\"Bandwidth length product(fBw*L) =\",round(fBwL,4),\"MHz/km\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Maximum operating bandwidth = 0.1058 MHz\n",
        "Dispersion = 0.1 micro s/km\n",
        "Bandwidth length product(fBw*L) = 5.29 MHz/km\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.17,Page number 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Slw=25;         #in nm\n",
      "L=850;          #in nm         given\n",
      "c=3*10**5;      #in km/s\n",
      "ofmd=0.02;      #optical fiber material dispersion\n",
      "Mdp=1./L/c*ofmd;         #answer mismatch due to differnt value chosen for calculation\n",
      "print\"Material Dispersion parameter Mdp =\",round(Mdp*10**12,4),\"ps/nm.km\";\n",
      "l=1;            #in km\n",
      "dmd=Slw*l*Mdp;  #pulse chirping\n",
      "print\"pulse chirping dmd =\",round(dmd*10**9,4),\"ns/km\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Material Dispersion parameter Mdp = 78.4314 ps/nm.km\n",
        "pulse chirping dmd = 1.9608 ns/km\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.18,Page number 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Slw=2;          #in nm\n",
      "L=850;          #in nm         given\n",
      "c=3*10**5;      #in km/s\n",
      "ofmd=0.02;      #optical fiber material dispersion\n",
      "Mdp=1./L/c*ofmd;   #answer mismatch due to differnt value chosen for calculation\n",
      "print\"Material Dispersion parameter Mdp =\",round(Mdp*10**12,4),\"ps/nm.km\";\n",
      "l=1;            #in km\n",
      "dmd=Slw*l*Mdp;  #pulse chirping\n",
      "print\"pulse chirping dmd =\",round(dmd*10**9,4),\"ns/km\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Material Dispersion parameter Mdp = 78.4314 ps/nm.km\n",
        "pulse chirping dmd = 0.1569 ns/km\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.19,Page number 325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "fb1=2.5;        #in Gb/s\n",
      "D1=20;          #in ps/nm.km\n",
      "D2=5;           #in ps/nm.km\n",
      "fb2=D1/D2*fb1;      \n",
      "print\" fb2 =\",fb2,\"Gb/s\";\n",
      "#Values of D1 and D2 are conflicted in question ,however solution is correct "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " fb2 = 10.0 Gb/s\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.20,Page number 325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "fb1=2.5;            #in Gb/s\n",
      "DV1=100;          #in GHz\n",
      "DV2=50;          #in GHz\n",
      "fb2=DV1/DV2*fb1;\n",
      "print\" fb2 =\",fb2,\"Gb/s\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " fb2 = 5.0 Gb/s\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.21,Page number 332"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "L=400;          #in km\n",
      "dAV=4;          #in ps/km\n",
      "dTL=L*dAV;      #total chromatic dispersion\n",
      "print\"dTL =\",round(dTL,4),\"ps/nm.km\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "dTL = 1600.0 ps/nm.km\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.22,Page number 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "no=1;               #refractive index\n",
      "n1=1.35;            #refractive index\n",
      "Po=((n1-no)/(n1+no))**2;     #fresnal reflection\n",
      "print\" Po(refl)=\",round(Po,4);\n",
      "Lrefl=-10*math.log10(1-Po);      #attenuation loss\n",
      "print\"L(refl)=\",round(Lrefl,4),\"dB\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Po(refl)= 0.0222\n",
        "L(refl)= 0.0974 dB\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.23,Page number 335"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "no=1;               #refractive index\n",
      "n1=1.55;            #refractive index\n",
      "Po=((n1-no)/(n1+no))**2;    #fresnal reflection\n",
      "print\"Fresnel reflective coefficient,Po(refl)=\",round(Po,4);\n",
      "Lrefl=-10*log10(1-Po);     #attenuation loss\n",
      "print\"Attenuation based on Fresnel reflective coefficient,L(refl)=\",round(Lrefl,4),\"dB\";\n",
      "Ltot=5*Lrefl;\n",
      "print\"Total link attenuation on Fresnel reflections,Ltotal =\",round(Ltot,4),\"dB\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fresnel reflective coefficient,Po(refl)= 0.0465\n",
        "Attenuation based on Fresnel reflective coefficient,L(refl)= 0.2069 dB\n",
        "Total link attenuation on Fresnel reflections,Ltotal = 1.0344 dB\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.24,Page number 336"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "n1=1;\n",
      "n2=1.5;\n",
      "a=25.;         #in micrometer\n",
      "y=3.;          #in micrometer\n",
      "Csim=16*(n1/n2)**2/math.pi/(1+(n1/n2))**4*(2*math.acos(y/2/a)-(y/a)*(1-(y/2/a)**2)**0.5); \n",
      "\n",
      "#lateral coupling coefficient\n",
      "a=2*math.acos(y/2/a)-(y/a)*math.sqrt(1-(y/2./a)**2);\n",
      "b=16*(n1/n2)**2/math.pi/(1+(n1/n2))**4;\n",
      "print\"Lateral coupling coefficient,Csim=\",round(Csim,4);\n",
      "Lsim=-10*math.log10(1-Csim);\n",
      "print\"Insertion Loss,Lsim=\",round(Lsim,4),\"dB\";\n",
      "#Answer wrong in book"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lateral coupling coefficient,Csim= 0.8512\n",
        "Insertion Loss,Lsim= 8.2751 dB\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.25,Page number 337"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "Alpha=2.;\n",
      "a=25.;           #in micrometer\n",
      "y=2.;            #in micrometer\n",
      "Cgim=2/math.pi*(y/a)*(Alpha+2)/(Alpha+1);       #lateral coupling coefficient\n",
      "print\" Csim=\",round(Cgim,4);\n",
      "Lgim=-10*math.log10(1-Cgim);     #insertion loss\n",
      "print\" Insertion Loss,Lgim=\",round(Lgim,4),\"dB\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Csim= 0.0679\n",
        " Insertion Loss,Lgim= 0.3054 dB\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.26,Page number 339"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "n1=1.5;            #refractive index\n",
      "n2=1.5;            #refractive index\n",
      "W=2.5;             #in degree\n",
      "NA1=0.3;\n",
      "NA2=0.4;\n",
      "Csim1=16*(n1/n2)**2/(1+(n1/n2)**4)*(1-n2*W/(180*NA1));   #angular coupling coefficient\n",
      "#Answer wrong in book\n",
      "print\"Csim=\",round(Csim1,4);\n",
      "Lsim1=-10*math.log10(Csim1);\n",
      "print\"Insertion Loss,Lsim=\",round(Lsim1,4),\"dB\";\n",
      "Csim2=16*(n1/n2)**2/(1+(n1/n2)**4)*(1-n2*W/(180*NA2)); #angular coupling coefficient\n",
      "#Answer wrong in book\n",
      "print\"Csim=\",round(Csim2,4);\n",
      "Lsim2=-10*math.log10(Csim2);\n",
      "print\"Insertion Loss,Lsim=\",round(Lsim2,4),\"dB\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Csim= 7.4444\n",
        "Insertion Loss,Lsim= -8.7183 dB\n",
        "Csim= 7.5833\n",
        "Insertion Loss,Lsim= -8.7986 dB\n"
       ]
      }
     ],
     "prompt_number": 52
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.27,Page number 340"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "a=4;            #in micrometer\n",
      "V=2.4;\n",
      "aw=1;           #in degree\n",
      "NA1=0.2;\n",
      "n1=1.45;        #refractive index\n",
      "y=1;            #in micrometer\n",
      "omega=a*(0.65+1.62*V**-1.5+2.88*V**-6)/math.sqrt(2);\n",
      "print\"Normalised spot view (w)=\",round(omega,4),\"micrometer\";\n",
      "Lsml=2.17*(y/omega)**2;\n",
      "print\"Insertion loss due to lateral,Lsm=\",round(Lsml,4),\"dB\";     #answer is wrong in book \n",
      "Lsmg=2.17*(aw*math.pi/180*omega*n1*V/a/NA1)**2;\n",
      "print\"Insertion loss due to angular,Lsm=\",round(Lsmg,4),\"dB\";\n",
      "\n",
      "print\"Total Insertion loss,Lsmtotal=\",round(Lsml+Lsmg,4),\"dB\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Normalised spot view (w)= 3.1135 micrometer\n",
        "Insertion loss due to lateral,Lsm= 0.2239 dB\n",
        "Insertion loss due to angular,Lsm= 0.1213 dB\n",
        "Total Insertion loss,Lsmtotal= 0.3451 dB\n"
       ]
      }
     ],
     "prompt_number": 53
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.28,Page number 340"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#given\n",
      "\n",
      "a1=4.5;          #in micrometer\n",
      "a2=4;            #in micrometer\n",
      "V=2.1;\n",
      "aw=1;            #in degree\n",
      "NA=0.2;\n",
      "n1=1.45;\n",
      "y=1;             #in micrometer\n",
      "w1=a1*(0.65+1.62*V**-0.5+2.88*V**-6)/math.sqrt(2);     #insertion loss\n",
      "print\"Wo1=\",round(w1,4);\n",
      "w2=a2*(0.65+1.62*V**-0.5+2.88*V**-6)/math.sqrt(2);     #insertion loss\n",
      "print\"Wo2=\",round(w2,4);\n",
      "Lintr=-10*math.log10(4*((w1/w2+w2/w1)**-2));           #toatl insertion loss at joint\n",
      "print\"Lintr=\",round(Lintr,4),\"dB\";        #Answer wrong in book\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wo1= 5.7323\n",
        "Wo2= 5.0954\n",
        "Lintr= 0.0601 dB\n"
       ]
      }
     ],
     "prompt_number": 56
    }
   ],
   "metadata": {}
  }
 ]
}