{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#14: Optics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.1, Page number 14.41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of maximum intensity to minimum intensity is 19.727\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",
    "I1=10;     #intensity(w/m**2)\n",
    "I2=25;     #intensity(w/m**2)\n",
    "\n",
    "#Calculation\n",
    "a1bya2=math.sqrt(I1/I2);    \n",
    "I=((1+a1bya2)**2)/((a1bya2-1)**2);    #ratio of maximum intensity to minimum intensity\n",
    "\n",
    "#Result\n",
    "print \"ratio of maximum intensity to minimum intensity is\",round(I,3)\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.2, Page number 14.42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "angular position of 10th maximum is 3 degrees 7 minutes 30.887 seconds\n",
      "answer varies due to rounding off errors\n",
      "angular position of 1st minimum is 0 degrees 9 minutes 23 seconds\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5460*10**-10;    #wavelength(m)\n",
    "d=1*10**-4;     #seperation(m)\n",
    "D=2;     #distance(m)\n",
    "n=10;    #position\n",
    "\n",
    "#Calculation\n",
    "Xmax10=n*lamda*D/d;\n",
    "tan_phi=Xmax10/D;     \n",
    "phi_max10=math.atan(tan_phi);\n",
    "phi_max10=phi_max10*180/math.pi;     #angular position of 10th maximum(degrees)\n",
    "phim=60*(phi_max10-int(phi_max10));\n",
    "phis=60*(phim-int(phim));\n",
    "xmin1=lamda*D/(2*d);       \n",
    "tan_phi1=xmin1/D;\n",
    "phi_min1=math.atan(tan_phi1);\n",
    "phi_min1=phi_min1*180/math.pi;     #angular position of 1st minimum(degrees)\n",
    "phi_m=60*(phi_min1-int(phi_min1));\n",
    "phi_s=60*(phi_m-int(phi_m));\n",
    "\n",
    "#Result\n",
    "print \"angular position of 10th maximum is\",int(phi_max10),\"degrees\",int(phim),\"minutes\",round(phis,3),\"seconds\"\n",
    "print \"answer varies due to rounding off errors\"\n",
    "print \"angular position of 1st minimum is\",int(phi_min1),\"degrees\",int(phi_m),\"minutes\",int(phi_s),\"seconds\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.3, Page number 14.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5320.0 angstrom lies in the visible region\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mew=1.33;      #refractive index of soap\n",
    "t=5000*10**-10;    #thickness(m)\n",
    "n0=0;\n",
    "n1=1;\n",
    "n2=2;\n",
    "n3=3;\n",
    "\n",
    "#Calculation\n",
    "x=4*mew*t;\n",
    "lamda1=x/((2*n0)+1);       #for n=0\n",
    "lamda2=x/((2*n1)+1);       #for n=1\n",
    "lamda3=x/((2*n2)+1);       #for n=2\n",
    "lamda4=x/((2*n3)+1);       #for n=3\n",
    "\n",
    "#Result\n",
    "print lamda3*10**10,\"angstrom lies in the visible region\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.4, Page number 14.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength of light is 5880 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "D15=0.59*10**-2;     #diameter of 15th ring(m)\n",
    "D5=0.336*10**-2;     #diameter of 5th ring(m)\n",
    "R=1;    #radius(m)\n",
    "m=10;\n",
    "\n",
    "#Calculation\n",
    "lamda=((D15**2)-(D5**2))/(4*m*R);     #wavelength of light(m)\n",
    "\n",
    "#Result\n",
    "print \"wavelength of light is\",int(lamda*10**10),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.5, Page number 14.44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "radius of curvature is 1.059 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "D10=0.5*10**-2;     #diameter of 10th ring(m)\n",
    "lamda=5900*10**-10;    #wavelength of light(m)\n",
    "n=10;\n",
    "\n",
    "#Calculation\n",
    "R=D10**2/(4*n*lamda);     #radius of curvature(m)\n",
    "\n",
    "#Result\n",
    "print \"radius of curvature is\",round(R,3),\"m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.6, Page number 14.44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "least distance of the point is 13 mm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda1=650*10**-9;      #wavelength(m)\n",
    "lamda2=500*10**-9;      #wavelength(m)\n",
    "D=1;    #distance(m)\n",
    "d=0.5*10**-3;     #seperation(m)\n",
    "n=10;\n",
    "\n",
    "#Calculation\n",
    "x=n*lamda1*D/d;    #least distance of the point(m)\n",
    "\n",
    "#Result\n",
    "print \"least distance of the point is\",int(x*10**3),\"mm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.7, Page number 14.45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thickness is 2.5 micro m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=500*10**-9;    #wavelength(m)\n",
    "n=10;\n",
    "D10=2*10**-3;     #diameter(m)\n",
    "\n",
    "#Calculation\n",
    "r10=D10/2;    #radius(m)\n",
    "R=D10**2/(4*n*lamda);\n",
    "t=r10**2/(2*R);        #thickness(m)\n",
    "\n",
    "#Result\n",
    "print \"thickness is\",t*10**6,\"micro m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.8, Page number 14.45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fringe width is 2.75 mm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "d=0.2*10**-3;     #seperation(m)\n",
    "lamda=550*10**-9;    #wavelength(m)\n",
    "D=1;     #diameter(m)\n",
    "\n",
    "#Calculation\n",
    "beta=lamda*D/d;     #fringe width(m)\n",
    "\n",
    "#Result\n",
    "print \"fringe width is\",beta*10**3,\"mm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.9, Page number 14.45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "separation between slits is 2 mm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=500*10**-9;    #wavelength(m)\n",
    "D=2;     #diameter(m)\n",
    "beta=(5/100)*10**-2;     #fringe width(m)\n",
    "\n",
    "#Calculation\n",
    "d=lamda*D/beta;      #separation between slits(m)\n",
    "\n",
    "#Result\n",
    "print \"separation between slits is\",int(d*10**3),\"mm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.10, Page number 14.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of maximum intensity to minimum intensity is 2.0\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a12=36;       #intensity 1\n",
    "a22=1;        #intensity 2\n",
    "\n",
    "#Calculation\n",
    "a1=math.sqrt(a12);\n",
    "a2=math.sqrt(a22);\n",
    "Imin=(a1-a2)**2;     #minimum intensity\n",
    "Imax=(a1+a2)**2;     #maximum intensity\n",
    "r=Imax/Imin;\n",
    "\n",
    "#Result\n",
    "print \"ratio of maximum intensity to minimum intensity is\",round(r)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 14.11, Page number 14.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diameter of 25th ring is 0.8239 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "D5=0.3;      #diameter of 5th ring(cm)\n",
    "D15=0.62;    #diameter of 15th ring(cm)\n",
    "\n",
    "#Calculation\n",
    "D_25=2*(D15**2)-(D5**2);\n",
    "D25=math.sqrt(D_25);      #diameter of 25th ring(cm)\n",
    "\n",
    "#Result\n",
    "print \"diameter of 25th ring is\",round(D25,4),\"cm\""
   ]
  }
 ],
 "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
}