{
 "metadata": {
  "name": "",
  "signature": "sha256:99fe784c923b9389b1b34d49f0a0fc6c7079e6fd55741e762bc73de0fe21384b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "11: Fibre Optics and Holography"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 11.1, Page number 11.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.55    #refractive index of core\n",
      "n2 = 1.50    #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "NA = math.sqrt(n1**2 - n2**2)\n",
      "NA = math.ceil(NA*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print \"numerical aperture is\",NA"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "numerical aperture is 0.391\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 11.2, Page number 11.6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.563    #refractive index of core\n",
      "n2 = 1.498;    #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "NA = math.sqrt(n1**2 - n2**2)      #numerical aperture \n",
      "NA = math.ceil(NA*10**4)/10**4;   #rounding off to 4 decimals\n",
      "alpha_i = math.asin(NA)        #angle of acceptance(radians)\n",
      "alpha_i = alpha_i*180/math.pi       #angle(degrees)\n",
      "deg = int(alpha_i)\n",
      "t = 60*(alpha_i-deg)\n",
      "mint = int(t)       #angle(minutes)\n",
      "\n",
      "#Result\n",
      "print \"the angle of acceptance is\",deg,\"degrees and\",mint,\"minutes\"\n",
      "print \"answer given in the book differs due to rounding off errors\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the angle of acceptance is 26 degrees and 29 minutes\n",
        "answer given in the book differs due to rounding off errors\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 11.3, Page number 11.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "delta = 0.05     #difference in refractive indices of core and cladding\n",
      "NA = 0.39    #numerical aperture\n",
      "\n",
      "#Calculation\n",
      "n1 = NA/math.sqrt(2*delta)     #refractive index of core\n",
      "n1 = math.ceil(n1*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"refractive index of the core is\",n1"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "refractive index of the core is 1.2333\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 11.4, Page number 11.7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.563    #refractive index of core\n",
      "n2 = 1.498    #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "delta = (n1-n2)/n1      #fractional index change\n",
      "delta = math.ceil(delta*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print \"fractional index change is\",delta"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "fractional index change is 0.0416\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 11.5, Page number 11.8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.48    #refractive index of core\n",
      "n2 = 1.45    #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "NA = math.sqrt(n1**2 - n2**2)     #numerical aperture \n",
      "NA = math.ceil(NA*10**4)/10**4;   #rounding off to 4 decimals\n",
      "alpha_i = math.asin(NA)      #angle of acceptance(radian)\n",
      "alpha_i = alpha_i*180/math.pi       #angle(degrees)\n",
      "deg = int(alpha_i)\n",
      "t = 60*(alpha_i-deg)\n",
      "mint = round(t)       #angle(minutes)\n",
      "\n",
      "#Result\n",
      "print \"numerical aperture is\",NA\n",
      "print \"the angle of acceptance is\",deg,\"degrees and\",mint,\"minutes\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "numerical aperture is 0.2965\n",
        "the angle of acceptance is 17 degrees and 15.0 minutes\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 11.6, Page number 11.15"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "Pin = 100          #power of signal(mW)\n",
      "Pout = 40          #outcoming signal power(mW)\n",
      "\n",
      "#Calculation\n",
      "l = -10*math.log10(Pout/Pin)       #attenuation loss(dB)\n",
      "l = math.ceil(l*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"the attenuation loss is\",l,\"dB\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the attenuation loss is 3.98 dB\n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}