{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#11: Fibre Optics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.1, Page number 11.16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.2965\n",
      "acceptance angle is 17 degrees 15.0 minutes\n",
      "critical angle is 78 degrees 26 minutes\n",
      "fractional refractive indices change is 0.02\n"
     ]
    }
   ],
   "source": [
    "#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",
    "theta0=math.asin(NA);     #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "theta0_m=60*(theta0-int(theta0));\n",
    "thetac=math.asin(n2/n1);     #critical angle(radian)\n",
    "thetac=thetac*180/math.pi;    #critical angle(degrees)\n",
    "thetac_m=60*(thetac-int(thetac));\n",
    "delta=(n1-n2)/n1;      #fractional refractive indices change\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,4)\n",
    "print \"acceptance angle is\",int(theta0),\"degrees\",round(theta0_m),\"minutes\"\n",
    "print \"critical angle is\",int(thetac),\"degrees\",int(thetac_m),\"minutes\"\n",
    "print \"fractional refractive indices change is\",round(delta,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.2, Page number 11.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.446\n",
      "acceptance angle is 26 degrees 29.5 minutes\n",
      "answer 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.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",
    "theta0=math.asin(NA);     #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "theta0_m=60*(theta0-int(theta0));\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,3)\n",
    "print \"acceptance angle is\",int(theta0),\"degrees\",round(theta0_m,1),\"minutes\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.3, Page number 11.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fractional refractive indices change is 0.0416\n"
     ]
    }
   ],
   "source": [
    "#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 refractive indices change\n",
    "\n",
    "#Result\n",
    "print \"fractional refractive indices change is\",round(delta,4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.4, Page number 11.17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.3905\n"
     ]
    }
   ],
   "source": [
    "#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));     #numerical aperture\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.5, Page number 11.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of core is 1.546\n",
      "refractive index of cladding is 1.496\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "NA=0.39;     #numerical aperture\n",
    "n1_n2=0.05;    #difference in refractive indices\n",
    "\n",
    "#Calculation\n",
    "x=NA**2/n1_n2;\n",
    "n2=(x-n1_n2)/2;     #refractive index of cladding\n",
    "n1=n2+n1_n2;      #refractive index of core\n",
    "\n",
    "#Result\n",
    "print \"refractive index of core is\",n1\n",
    "print \"refractive index of cladding is\",n2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.6, Page number 11.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.3905\n"
     ]
    }
   ],
   "source": [
    "#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));     #numerical aperture\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,4)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.7, Page number 11.18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.2965\n",
      "acceptance angle is 17 degrees 15.0 minutes\n"
     ]
    }
   ],
   "source": [
    "#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",
    "theta0=math.asin(NA);     #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "theta0_m=60*(theta0-int(theta0));\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,4)\n",
    "print \"acceptance angle is\",int(theta0),\"degrees\",round(theta0_m),\"minutes\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.8, Page number 11.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of core is 1.6583\n",
      "refractive index of cladding is 1.625\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "NA=0.33;     #numerical aperture\n",
    "delta=0.02;     #fractional refractive indices change\n",
    "\n",
    "#Calculation\n",
    "x=1-delta\n",
    "y=math.sqrt(1-x**2);\n",
    "n1=NA/y;       #refractive index of core\n",
    "n2=n1*x;       #refractive index of cladding\n",
    "\n",
    "#Result\n",
    "print \"refractive index of core is\",round(n1,4)\n",
    "print \"refractive index of cladding is\",round(n2,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.9, Page number 11.19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "acceptance angle is 8 degrees 38 minutes 55.4 seconds\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "NA=0.20;     #numerical aperture\n",
    "n2=1.59;     #refractive index of cladding\n",
    "n0=1.33;     #refractive index of water\n",
    "\n",
    "#Calculation\n",
    "n1=math.sqrt(NA**2+n2**2);      #refractive index of core\n",
    "theta0=math.asin(NA/n0);       #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "theta0_m=60*(theta0-int(theta0));\n",
    "theta0_s=60*(theta0_m-int(theta0_m));\n",
    "\n",
    "#Result\n",
    "print \"acceptance angle is\",int(theta0),\"degrees\",int(theta0_m),\"minutes\",round(theta0_s,1),\"seconds\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.10, Page number 11.20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fractional refractive indices change is 6.8966 *10**-3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.45;      #refractive index of core\n",
    "n2=1.44;      #refractive index of cladding\n",
    "\n",
    "#Calculation\n",
    "delta=(n1-n2)/n1;      #fractional refractive indices change\n",
    "\n",
    "#Result\n",
    "print \"fractional refractive indices change is\",round(delta*10**3,4),\"*10**-3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.11, Page number 11.20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of cladding is 1.44\n",
      "numerical aperture is 0.42\n",
      "acceptance angle is 24 degrees 50 minutes\n",
      "critical angle is 73 degrees 44 minutes\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=1.50;      #refractive index of core\n",
    "delta=4/100;    #fractional refractive indices change\n",
    "\n",
    "#Calculation\n",
    "n2=n1-(n1*delta);      #refractive index of cladding\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",
    "theta0_m=60*(theta0-int(theta0));\n",
    "thetac=math.asin(n2/n1);     #critical angle(radian)\n",
    "thetac=thetac*180/math.pi;    #critical angle(degrees)\n",
    "thetac_m=60*(thetac-int(thetac));\n",
    "\n",
    "#Result\n",
    "print \"refractive index of cladding is\",n2\n",
    "print \"numerical aperture is\",round(NA,2)\n",
    "print \"acceptance angle is\",int(theta0),\"degrees\",int(theta0_m),\"minutes\"\n",
    "print \"critical angle is\",int(thetac),\"degrees\",int(thetac_m),\"minutes\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 11.12, Page number 11.21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "numerical aperture is 0.446\n",
      "acceptance angle is 26 degrees 29.5 minutes\n",
      "answer 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.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",
    "theta0=math.asin(NA);     #acceptance angle(radian)\n",
    "theta0=theta0*180/math.pi;    #acceptance angle(degrees)\n",
    "theta0_m=60*(theta0-int(theta0));\n",
    "\n",
    "#Result\n",
    "print \"numerical aperture is\",round(NA,3)\n",
    "print \"acceptance angle is\",int(theta0),\"degrees\",round(theta0_m,1),\"minutes\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  }
 ],
 "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
}