{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 12: Fiber Optics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.1, Page number 12.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.55  #refractive inde of core\n",
      "n2 = 1.50  #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "NA = math.sqrt(n1**2-n2**2)\n",
      "\n",
      "#Result\n",
      "print \"Numerical Aperture =\",round(NA,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical Aperture = 0.391\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.2, Page number 12.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.563  #refractive inde of core\n",
      "n2 = 1.498  #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "NA = math.sqrt(n1**2-n2**2)\n",
      "alpha_i = math.degrees(math.asin(NA))\n",
      "\n",
      "#Result\n",
      "print \"Angle of acceptance =\",round(alpha_i,2),\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Angle of acceptance = 26.49 degrees\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.3, Page number 12.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "NA = 0.39       #numerical aperture\n",
      "delta_n = 0.05  #differnce between refractive indices of core & cladding\n",
      "\n",
      "#Calculaations\n",
      "n1 = NA/math.sqrt(2*delta_n)\n",
      "\n",
      "#Result\n",
      "print \"Refractive index of core =\",round(n1,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Refractive index of core = 1.2333\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.4, Page number 12.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "n1 = 1.563  #refractive inde of core\n",
      "n2 = 1.498  #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "delta = (n1-n2)/n1\n",
      "\n",
      "#Result\n",
      "print \"Fractional index change for the given fiber is\",round(delta,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Fractional index change for the given fiber is 0.0416\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.5, Page number 12.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.48  #refractive inde of core\n",
      "n2 = 1.45  #refractive index of cladding\n",
      "\n",
      "#Calculations\n",
      "NA = math.sqrt(n1**2-n2**2)\n",
      "alpha_i = math.degrees(math.asin(NA))\n",
      "\n",
      "#Result\n",
      "print \"Numerical aperture =\",round(NA,4)\n",
      "print \"Angle of acceptance =\",round(alpha_i,2),\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical aperture = 0.2965\n",
        "Angle of acceptance = 17.25 degrees\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12.6, Page number 12.14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "Pout = 40.     #output power(mW)\n",
      "Pin = 100.     #input power(mW)\n",
      "\n",
      "#Calculation\n",
      "A = -10*math.log10(Pout/Pin)  #Attenuation(dB)\n",
      "\n",
      "#Result \n",
      "print \"Attenuation =\",round(A,2),\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Attenuation = 3.98 dB\n"
       ]
      }
     ],
     "prompt_number": 22
    }
   ],
   "metadata": {}
  }
 ]
}