{
 "metadata": {
  "name": "",
  "signature": "sha256:e126fa636efa72af4b20cd3702da45f085d125811e3d4b6de05ba5fde96d2c77"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2:Light propagation in optical ber"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.1 , Page no:30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "ncore=1.46;  #refractive index of core\n",
      "nclad=1;  #refractive index of cladding\n",
      "c=3e5;  #velocity of light in Km/s\n",
      "L=1;  #length of path in Km\n",
      "\n",
      "#CALCULATIONS\n",
      "NA=math.sqrt(ncore**2-nclad**2);  #Numerical aperture\n",
      "delt_tau_by_L=(NA**2)/(2*c*ncore);  #multipath pulse broadening in s/Km\n",
      "delt_tau=delt_tau_by_L*L;  #bandwidth distance product Hz\n",
      "BL=(1/delt_tau)*L;  #bandwidth distance product Hz\n",
      "#case-2\n",
      "ncore1=1.465;  #refractive index of core\n",
      "nclad1=1.45;  #refractive index of cladding\n",
      "NA1=math.sqrt(ncore1**2-nclad1**2);  #Numerical aperture\n",
      "delt_tau_by_L1=(NA1**2)/(2*c*ncore1);  #multipath pulse broadening in s/m\n",
      "BL1=(1/delt_tau_by_L1)*L;  #bandwidth distance product Hz\n",
      "\n",
      "#RESULTS\n",
      "print\"Numerical aperture=\",round(NA,5);  #The answers vary due to round off error\n",
      "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L*1e9,5),\"ns/Km\";  #The answer provided in the textbook is wrong//multiplication by 1e9  to convert s/Km to ns/Km \n",
      "print\"\\nBandwidth distance product=\",round(BL*1e-6,5),\"GHz \";  #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to MHz\n",
      "print\"\\n\\nNumerical aperture=\",round(NA1,5);\n",
      "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L1*1e9,5),\"ns/Km\";  #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n",
      "print\"\\nBandwidth distance product=\",round(BL1*1e-9,5),\"GHz \";  #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to GHz"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical aperture= 1.06377\n",
        "\n",
        "Multipath pulse broadening= 1291.78082 ns/Km\n",
        "\n",
        "Bandwidth distance product= 0.77413 GHz \n",
        "\n",
        "\n",
        "Numerical aperture= 0.20911\n",
        "\n",
        "Multipath pulse broadening= 49.74403 ns/Km\n",
        "\n",
        "Bandwidth distance product= 0.0201 GHz \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.2 , Page no:30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "lamda1=0.7;  #wavelength in um\n",
      "lamda2=1.3;  #wavelength in um\n",
      "lamda3=2;  #wavelength in um\n",
      "\n",
      "#CALCULATIONS\n",
      "f_lambda1=(303.33*(lamda1**-1)-233.33);  #equation for lambda1\n",
      "f_lambda2=(303.33*(lamda2**-1)-233.33);  #equation for lambda2\n",
      "f_lambda3=(303.33*(lamda3**-1)-233.33);  #equation for lambda3\n",
      "\n",
      "#RESULTS\n",
      "print\"Material dispersion at Lambda 0.7um=\",round(f_lambda1,5);\n",
      "print\"\\nMaterial dispersion at Lambda 1.3um=\",round(f_lambda2,5);  #The answers vary due to round off error\n",
      "print\"\\nMaterial dispersion at Lambda 2um=\",round(f_lambda3,5);  #The answers vary due to round off error\n",
      "print\"\\nIts is a standard silica fiber\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Material dispersion at Lambda 0.7um= 199.99857\n",
        "\n",
        "Material dispersion at Lambda 1.3um= 0.00077\n",
        "\n",
        "Material dispersion at Lambda 2um= -81.665\n",
        "\n",
        "Its is a standard silica fiber\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.3 , Page no:32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "ncore=1.505;  #refractive index of core\n",
      "nclad=1.502;  #refractive index of cladding\n",
      "V=2.4;  #v no. for single mode \n",
      "lambda1=1300e-9;  #operating wavelength in m\n",
      "\n",
      "#CALCULATIONS\n",
      "NA=math.sqrt(ncore**2-nclad**2);  #numerical aperture\n",
      "a=V*(lambda1)/(2*3.14*NA);  #dimension of fiber core in m\n",
      "\n",
      "#RESULTS\n",
      "print\"The numarical aperture =\",round(NA,5);\n",
      "print\"\\n Dimension of fiber core =\",round(a*1e6,5),\"um\";  #multiplication by 1e6 to convert unit from m to um"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The numarical aperture = 0.09498\n",
        "\n",
        " Dimension of fiber core = 5.23079 um\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.4 , Page no:33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "V=2;  #v no. for single mode \n",
      "a=4;  #radius of fiber in um\n",
      "\n",
      "#CALCULATIONS\n",
      "w=a*(0.65+1.619*V**(-3/2)+2.87*V**-6);  #effective mode radius in um\n",
      "\n",
      "#RESULTS\n",
      "print\"Effective mode radius =\",round(w,5),\"um\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Effective mode radius = 5.06899 um\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.6 , Page no:34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "m=0;  #for dominant mode\n",
      "v=0;  #for dominant mode\n",
      "n1=1.5;  #refractive index of core\n",
      "delta=0.01;  #core clad index difference\n",
      "a=5;  #fiber radius in um\n",
      "lambda1=1.3;  #wavelength of operation in um\n",
      "\n",
      "#CALCULATIONS\n",
      "k0=(2*3.14/lambda1);  #constant in /m\n",
      "beta=math.sqrt((k0**2)*(n1**2)-(2*k0*n1*math.sqrt(2*delta)/a));  #propagation constant in rad/um\n",
      "\n",
      "#RESULTS\n",
      "print\"Propagation constant=\",round(beta,5),\"rad/um\";  #The answers vary due to round off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Propagation constant= 7.21781 rad/um\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.8 , Page no:34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "M=1000;  #modes supported\n",
      "lambda1=1.3;  #operating wavelength in um\n",
      "n1=1.5;  #refractive index of core\n",
      "n2=1.48;  #refractive index of cladding\n",
      "\n",
      "#CALCULATIONS\n",
      "V=math.sqrt(2*M);  #normalised frequency V no.\n",
      "NA=math.sqrt(n1**2-n2**2);  #numerical apperture\n",
      "R=lambda1*V/(2*3.14*NA);  #radius of fiber in um\n",
      "\n",
      "#RESULTS\n",
      "print\"Core Radius=\",round(R,5),\"um\";  #The answer provided in the textbook is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Core Radius= 37.92063 um\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.9 , Page no:35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "lambda1=1.3;  #wavelength of operation in um\n",
      "n1=1.5;  #refractive index of core\n",
      "n2=1.48;  #refractive index of cladding\n",
      "k0=2*3.14/lambda1;  #constant in /m\n",
      "\n",
      "#CALCULATIONS\n",
      "#case-1\n",
      "b=0.5;  #normalized propagation constant\n",
      "k0=2*3.14/lambda1;  #constant\n",
      "beta=k0*math.sqrt(n2**2+b*(n1**2-n2**2));  #propagation constant\n",
      "\n",
      "#case-2\n",
      "#given \n",
      "lambda1=1.3;  #wavelength of operation in um\n",
      "n1=1.5;  #refractive index of core\n",
      "n2=1.48;  #refractive index of cladding\n",
      "k0=2*3.14/lambda1;  #constant in /m\n",
      "b=0.5;  #normalized propagation constant\n",
      "k0=2*3.14/lambda1;  #constant\n",
      "b1=(((n1+n2)/2)**2-n2**2)/(n1**2-n2**2);  #normalized propagation constant\n",
      "\n",
      "#case-3\n",
      "#given \n",
      "lambda1=1.3;  #wavelength of operation in um\n",
      "n1=1.5;  #refractive index of core\n",
      "n21=1.0;  #refractive index of cladding\n",
      "k0=2*3.14/lambda1;  #constant in /m\n",
      "b=0.5;  #normalized propagation constant\n",
      "k0=2*3.14/lambda1;  #constant\n",
      "beta1=k0*math.sqrt(n21**2+b*(n1**2-n21**2));  #propagation constant\n",
      "\n",
      "#RESULTS\n",
      "print\"Propagation constant=\",round(beta,5),\"rad/um\";  #The answers vary due to round off error\n",
      "print\"\\nPropagation constant=\",round(b1,5);  #The answers vary due to round off error\n",
      "print\"\\nPropagation constant=\",round(beta1,5),\"rad/um\";  #The answers vary due to round off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Propagation constant= 7.19801 rad/um\n",
        "\n",
        "Propagation constant= 0.49832\n",
        "\n",
        "Propagation constant= 6.15805 rad/um\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2.10 , Page no:35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#initialisation of variables\n",
      "#case-1\n",
      "n1=1.49;  #refractive index of core\n",
      "n2=1.46;  #refractive index of cladding\n",
      "c=3*10**5;  #speed of light in Km/s\n",
      "t1=n1/c;  #time delay for one traveling along axis in s/Km\n",
      "t2=(n1**2/n2)/c;  #time delay for one traveling along path that is totally reflecting at the first interface in s/km\n",
      "\n",
      "#case-2\n",
      "n11=1.47;  #refractive index of core\n",
      "n21=1.46;  #refractive index of cladding\n",
      "c1=3*10**5;  #speed of light in Km/s\n",
      "t11=n11/c1;  #time delay for one traveling along axis in\n",
      "t22=(n11**2/n21)/c1;  #time delay for one traveling along path that is totally reflecting at the first interface\n",
      "\n",
      "\n",
      "print\"time delay for traveling along axis =\",round(t1*1e6,5),\"us/Km\";  #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
      "print\"\\ntime delay for  traveling along path that is totally reflecting at the first interface =\",round(t2*1e6,5),\"us/Km\";  #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
      "print\"\\ntime delay for traveling along axis =\",round(t11*1e6,5),\"us/Km\";  #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
      "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t22*1e6,5),\"us/Km\";  #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
      "#The answer provided in the textbook is wrong it has got wrong unit"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "time delay for traveling along axis = 4.96667 us/Km\n",
        "\n",
        "time delay for  traveling along path that is totally reflecting at the first interface = 5.06872 us/Km\n",
        "\n",
        "time delay for traveling along axis = 4.9 us/Km\n",
        "\n",
        "time delay for traveling along path that is totally reflecting at the first interface = 4.93356 us/Km\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}