{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9: Fibre Optics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1, Page 463"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu_1 = 1.55;  # Refractive index of the core \n",
      "mu_2 = 1.50;  # Refractive indices of cladding \n",
      "\n",
      "#Calculations\n",
      "NA = mu_1*sqrt(2*(mu_1-mu_2)/mu_1); \n",
      "print \"The NA of the optical fibre = %5.3f\"%NA\n",
      "theta_a = degrees(asin(NA));    # The acceptance angle of optical fibre, degrees\n",
      "\n",
      "#Result\n",
      "print \"The acceptance angle of the optical fibre is = %.1f degrees\"%theta_a\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The NA of the optical fibre = 0.394\n",
        "The acceptance angle of the optical fibre is = 23.2 degrees\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2, Page 463"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu_1 = 1.50;  # Refractive index of the core \n",
      "mu_2 = 1.45;  # Refractive index cladding\n",
      "\n",
      "#Calculations&Results\n",
      "NA = mu_1*sqrt(2*(mu_1-mu_2)/mu_1);     # Numerical aperture of optical fibre\n",
      "print \"The NA of the optical fibre = %5.3f\"%NA\n",
      "theta_a = degrees(asin(NA));        # The acceptance angle of optical fibre, degrees\n",
      "print \"The acceptance angle of the optical fibre = %5.2f degrees\"%theta_a\n",
      "theta_c = degrees(asin(mu_2/mu_1)); # The critical angle of the optical fibre, degrees\n",
      "print \"The acceptance angle of the optical fibre = %4.1f degrees\"%theta_c\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The NA of the optical fibre = 0.387\n",
        "The acceptance angle of the optical fibre = 22.79 degrees\n",
        "The acceptance angle of the optical fibre = 75.2 degrees\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3, Page 464"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu0 = 1;  # Refactive index of fibre in air\n",
      "mu2 = 1.59;  # Refactive index of the cladding \n",
      "NA = 0.2;  # Numerial aperture of optical fibre\n",
      "\n",
      "#Calculations\n",
      "mu1 = sqrt(NA**2+mu2**2);  # Refractive index of core\n",
      "mu0 = 1.33;     # Refactive index of fibre in water\n",
      "NA = sqrt(mu1**2-mu2**2)/mu0;    # Numerial aperture of optical fibre in water\n",
      "theta_a = degrees(asin(NA));    # Acceptance angle for the fibre in water\n",
      "\n",
      "#Result\n",
      "print \"The acceptance angle for the optical fibre in water = %3.1f degrees\"%theta_a\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The acceptance angle for the optical fibre in water = 8.6 degrees\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4, Page 464"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu0 = 1;        # Refractive index of air\n",
      "mu1 = 1.50;  # Refractive index of glass core`\n",
      "delta = 0.005;  # Fractional change in refractive index\n",
      "\n",
      "#Calculations&Results\n",
      "mu2 = mu1*(1-delta);      # Refractive index of cladding\n",
      "print \"The refractive index of cladding =%6.4f\"%mu2\n",
      "theta_c = degrees(asin(mu2/mu1));   # Critical angle, degrees\n",
      "print \"The critical angle = %5.2f degrees\"%theta_c\n",
      "theta_a = degrees(asin(sqrt(mu1**2-mu2**2)/mu0));     # Acceptance angle, degrees\n",
      "print \"The value of acceptance angle is = %4.2f degrees\"%theta_a\n",
      "NA = mu1*sqrt(2*delta);      # Numerical aperture of optical fibre\n",
      "print \"The NA of the optical fibre = %4.2f\"%NA   #incorrect answer in the textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The refractive index of cladding =1.4925\n",
        "The critical angle = 84.27 degrees\n",
        "The value of acceptance angle is = 8.62 degrees\n",
        "The NA of the optical fibre = 0.15\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5, Page 465"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "NA = 0.22;      # Numerical aperture of the optical fibre\n",
      "delta = 0.012;  # Fractional difference between the refractive index of core and cladding\n",
      "\n",
      "#Calculations\n",
      "mu1 = NA/sqrt(2*delta);   # The refractive index of core of optical fibre\n",
      "print \"The refractive index of core = %4.2f\"%mu1\n",
      "mu2 = mu1*(1-delta);  # The refractive index of cladding of optical fibre\n",
      "\n",
      "#Result\n",
      "print \"The refractive index of cladding = %4.2f\"%mu2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The refractive index of core = 1.42\n",
        "The refractive index of cladding = 1.40\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6, Page 466"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu1 = 1.466;   # Refractive index of core\n",
      "mu2 = 1.460;   # Refractive index of cladding\n",
      "v = 2.4;  # Cut-off parameter of the optical fibre\n",
      "lamda = 0.8e-006;  # Operating wavelength, m\n",
      "\n",
      "#Calculations&Results\n",
      "NA = sqrt(mu1**2-mu2**2);\n",
      "print \"The NA of optical fibre = %4.2f\"%NA\n",
      "# Asthe cut-off parameter v of the optical fibre, v = 2*%pi*a*sqrt(mu1^2-mu2^2)/lambda, solving for a\n",
      "a = lamda*v/(2*pi*sqrt(mu1**2-mu2**2));\n",
      "print \"The core radius of the optical fibre = %4.2f micrometer\"%(a/1e-006)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The NA of optical fibre = 0.13\n",
        "The core radius of the optical fibre = 2.31 micrometer\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.7, Page 466"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu1 = 1.54;    # The refractive index of core\n",
      "mu2 = 1.50;    # The refractive index of cladding\n",
      "lamda = 1.3e-006;  # Operating wavelength of optical fibre, m\n",
      "a = 25e-006;  # Radius of fibre core, m\n",
      "\n",
      "#Calculations\n",
      "v = 2*pi*a*sqrt(mu1**2-mu2**2)/lamda;   # V-number of optical fibre \n",
      "print \"The cut-off parameter of the optical fibre = %5.2f\"%v\n",
      "n = v**2/2;      # The number of modes supported by the fibre \n",
      "\n",
      "#Result\n",
      "print \"The number of modes supported by the fibre = %3d\"%(ceil(n))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cut-off parameter of the optical fibre = 42.14\n",
        "The number of modes supported by the fibre = 888\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.8, Page 466"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu1 = 1.54;  # Refractive index of core\n",
      "v = 2.405;  # Cut-off parameter of optical fibre\n",
      "lamda = 1.3e-006;  # Operating wavelength of optical fibre, m\n",
      "a = 1e-006;  # Radius of the core,\n",
      "\n",
      "#Calculations\n",
      "NA = v*lamda/(2*pi*a);    # Numerical aperture of optical fibre\n",
      "delta = 1./2*(NA/mu1)**2;   #  Fractional change in refractive index of core and cladding\n",
      "print \"The fractional difference of refractive indices of core and cladding = %7.5e\"%delta\n",
      "mu2 = mu1*(1-delta);     # Maximum value of refractive index of cladding\n",
      "print \"The maximum refractive index of cladding = %5.3f\"%mu2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fractional difference of refractive indices of core and cladding = 5.22018e-02\n",
        "The maximum refractive index of cladding = 1.460\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.9, Page 467"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu1 = 1.45;  # Index of refraction of core\n",
      "NA = 0.16;  # Numerical aperture of step index fibre\n",
      "a = 3e-006;  # Radius of the core, m\n",
      "lamda = 0.9e-006;  # Operating wavelength of optical fibre, m\n",
      "\n",
      "#Calculations\n",
      "v = 2*pi*a*NA/lamda;      # The normalized frequency or v-number of optical fibre\n",
      "\n",
      "#Result\n",
      "print \"The normalized frequency of the optical fibre = %5.2f\"%v\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The normalized frequency of the optical fibre =  3.35\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.10, Page 467"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu1 = 1.52;  # Refractive index of core\n",
      "a = 14.5e-006;  # Radius of the fibre core, m\n",
      "delta = 0.0007;  # Fractional index difference\n",
      "lamda = 1.3e-006;  # Operating wavelength of optical fibre, m\n",
      "\n",
      "#Calculations&Results\n",
      "mu2 = mu1*(1-delta);      # Refractive index of cladding\n",
      "v = 2*pi*a*sqrt(mu1**2-mu2**2)/lamda;     # Cut-off parameter v of the optical fibre\n",
      "print \"The cut-off parameter of the optical fibre = %5.3f\"%v\n",
      "#The is number of modes supported by the fibre given by,\n",
      "n = v**2/2;\n",
      "print \"The number of modes supported by the fibre = %d\"%(ceil(n))\n",
      "#Incorrect answer in the textbook for mu2. Hence the difference in answers"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cut-off parameter of the optical fibre = 3.985\n",
        "The number of modes supported by the fibre = 8\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.11, Page 468"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "alpha = 3.5;  # Attenuation of the optical fibre, dB/km\n",
      "Pi = 0.5;  # Input power of optical fibre, mW\n",
      "L = 4;      # Distance through the optical wave transmits through the fibre, km\n",
      "\n",
      "#Calculations\n",
      "# As alpha = 10/L*log10(Pi/Po), solving for Po\n",
      "Po = Pi/exp(alpha*L*2.3026/10); # Output power of optical fibre, mW\n",
      "\n",
      "#Result\n",
      "print \"The output power of optical fibre = %4.1f micro-watt\"%(Po/1e-003)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The output power of optical fibre = 19.9 micro-watt\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.12, Page 468"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "Pi =1;  # Input power of optical fibre, mW\n",
      "Po = 0.85;  # Outptu power of optical fibre, mW\n",
      "L = 0.5;  #The distance through the optical wave transmits through the fibre, km \n",
      "\n",
      "#Calculations\n",
      "alpha = (10/L)*log10(Pi/Po);      # The attenuation of power through the optical fibre\n",
      "\n",
      "#Result\n",
      "print \"The attenuation of power through the optical fibre = %5.3f dB/km\"%alpha\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The attenuation of power through the optical fibre = 1.412 dB/km\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.13, Page 469"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "C = 0.8;    # Connector loss per km, dB\n",
      "F = 1.5;    # Fibre loss per km, dB\n",
      "alpha = C + F;  # Attenuation of power the optical fibre, dB/km\n",
      "Po = 0.3e-006;  # Output power of optical fibre, W\n",
      "L = 15;  # The distance through the optical wave transmits through the fibre, km\n",
      "\n",
      "#Calculations\n",
      "#As the attenuation, alpha = 10/L*log(Pi/Po), solving for Pi\n",
      "Pi = Po*exp(2.3026*alpha*L/10);     # Input power of optical fibre, mW\n",
      "\n",
      "#Result\n",
      "print \"The minimum input power to optical fibre = %5.3f mW\"%(Pi/1e-003)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum input power to optical fibre = 0.846 mW\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}