{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#12: Fibre Optics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.1, Page number 263"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of core is 1.233\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "NA=0.39;    #numerical aperture\n",
    "delta=0.05;     #refractive index of cladding\n",
    "\n",
    "#Calculation\n",
    "n1=NA/math.sqrt(2*delta);      #refractive index of core\n",
    "\n",
    "#Result\n",
    "print \"refractive index of core is\",round(n1,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.2, Page number 264"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fractional index change is 0.04159\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.563;          #Core refractive index\n",
    "n2=1.498;          #Cladding refractive index\n",
    "\n",
    "#Calculation\n",
    "delta=(n1-n2)/n1;    #fractional index change\n",
    "\n",
    "#Result\n",
    "print \"fractional index change is\",round(delta,5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.3, Page number 264"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.39\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.55;          #Core refractive index\n",
    "n2=1.50;          #Cladding refractive index\n",
    "\n",
    "#Calculation\n",
    "NA=math.sqrt(n1**2-n2**2);    #numerical aperture\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.4, Page number 264"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "acceptance angle is 26.49 degrees\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.563;          #Core refractive index\n",
    "n2=1.498;          #Cladding refractive index\n",
    "\n",
    "#Calculation\n",
    "NA=math.sqrt(n1**2-n2**2);    #numerical aperture\n",
    "theta0=math.asin(NA);    #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "\n",
    "#Resul\"\n",
    "print \"acceptance angle is\",round(theta0,2),\"degrees\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.5, Page number 265"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "critical angle is 68.14 degrees\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.53;          #Core refractive index\n",
    "n2=1.42;          #Cladding refractive index\n",
    "\n",
    "#Calculation\n",
    "thetac=math.asin(n2/n1);     #critical angle(radian)\n",
    "thetac=thetac*180/math.pi;    #critical angle(degrees)\n",
    "\n",
    "#Resul\"\n",
    "print \"critical angle is\",round(thetac,2),\"degrees\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.6, Page number 265"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "acceptance angle is 35.62 degrees\n",
      "answer in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.6;          #Core refractive index\n",
    "n0=1.33;         #refractive index of air\n",
    "n2=1.4;          #Cladding refractive index\n",
    "\n",
    "#Calculation\n",
    "NA=math.sqrt(n1**2-n2**2)/n0;    #numerical aperture\n",
    "theta0=math.asin(NA);    #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "\n",
    "#Resul\"\n",
    "print \"acceptance angle is\",round(theta0,2),\"degrees\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.7, Page number 265"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fractional index change is 0.133\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.5;          #Core refractive index\n",
    "n2=1.3;          #Cladding refractive index\n",
    "\n",
    "#Calculation\n",
    "delta=(n1-n2)/n1;    #fractional index change\n",
    "\n",
    "#Result\n",
    "print \"fractional index change is\",round(delta,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.8, Page number 265"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refraction angle is 57.03 degrees\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.55;          #Core refractive index\n",
    "n2=1.6;          #Cladding refractive index\n",
    "theta1=60*math.pi/180;     #incident angle(degrees)\n",
    "\n",
    "#Calculation\n",
    "x=n1*math.sin(theta1)/n2;\n",
    "theta2=math.asin(x);    #refraction angle(radian)\n",
    "theta2=theta2*180/math.pi;    #refraction angle(degrees)\n",
    "\n",
    "#Result\n",
    "print \"refraction angle is\",round(theta2,2),\"degrees\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.9, Page number 266"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of core is 1.51\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n2=1.3;          #Cladding refractive index\n",
    "delta=0.140;    #fractional index change\n",
    "\n",
    "#Calculation\n",
    "n1=n2/(1-delta);     #Core refractive index\n",
    "\n",
    "#Result\n",
    "print \"refractive index of core is\",round(n1,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 12.10, Page number 266"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.45088\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "theta0=26.80*math.pi/180;    #acceptance angle(radian)\n",
    "\n",
    "#Calculation\n",
    "NA=math.sin(theta0);       #numerical aperture\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,5)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
