{
 "metadata": {
  "name": "",
  "signature": "sha256:9517150eeae7e7bf9389a01495b7c5d59b808d0c5432252a5c80e780ef687d70"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "6: Fiber Optics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.1, Page number 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.5;      #refractive index of core\n",
      "n2 = 1.0;      #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "thetac = math.asin(n2/n1);      #critical angle(radian)\n",
      "thetac = thetac*180/math.pi;        #critical angle(degrees)\n",
      "thetac = math.ceil(thetac*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"critical angle is\",thetac,\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "critical angle is 41.82 degrees\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.2, Page number 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n1 = 1.5;         #refractive index of core\n",
      "n2 = 1.47;      #refractive index of cladding\n",
      "\n",
      "#Calculation\n",
      "thetac = math.asin(n2/n1);      #critical angle(radian)\n",
      "thetac = thetac*180/math.pi;        #critical angle(degrees)\n",
      "thetac = math.ceil(thetac*10**2)/10**2;   #rounding off to 2 decimals\n",
      "NA = math.sqrt(n1**2-n2**2);           #numerical aperture of fiber\n",
      "NA = math.ceil(NA*10)/10;   #rounding off to 1 decimal\n",
      "thetaa = math.asin(NA);        #acceptance angle(radian)\n",
      "thetaa = thetaa*180/math.pi;        #acceptance angle(degrees)\n",
      "thetaa = math.ceil(thetaa*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"critical angle is\",thetac,\"degrees\"\n",
      "print \"numerical aperture of fiber is\",NA\n",
      "print \"acceptance angle is\",thetaa,\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "critical angle is 78.53 degrees\n",
        "numerical aperture of fiber is 0.3\n",
        "acceptance angle is 17.46 degrees\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}