{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Chapter 1 : Wave Optics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1, Page Number 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Thickness of sheet= 1178*10**-8 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5890*10**-8    #wavelength\n",
    "myu=1.6              #refractive index\n",
    "m=12                 #order of the fringe\n",
    "\n",
    "#Calculations\n",
    "t=(lamda*m)/(myu-1)/10**-6\n",
    "\n",
    "#Result\n",
    "print\"Thickness of sheet= %i*10**-8 cm\" %t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2, Page Number 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Thickness of sheet= 1071.45*10**-8 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5893*10**-8    #wavelength\n",
    "myu=1.55             #refractive index\n",
    "n=10                 #order of the fringe\n",
    "\n",
    "#Calculations\n",
    "t=(lamda*n)/(myu-1)/(10**-3)*10**3\n",
    "\n",
    "#Result\n",
    "print\"Thickness of sheet= %0.2f*10**-8 cm\" %t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3, Page Number 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angular position of first minima is= 0.16\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5640*10**-8    #wavelength\n",
    "d=0.01               #distnce between slits\n",
    "n=0                  #first minimum\n",
    "\n",
    "#Calculations\n",
    "theta=(n+(1/2))*(lamda/d)\n",
    "\n",
    "#Result\n",
    "print\"Angular position of first minima is= %0.2f\" %math.degrees(theta)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4, Page Number 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum thickness of the film t= 3.927*10**-5 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5890*10**-8    #wavelength\n",
    "myu=1.5              #refractive index of glass\n",
    "n=1                  #first minimum\n",
    "r=60                 #angle in degrees\n",
    "\n",
    "#Calculations\n",
    "t=(n*lamda)/(2*myu*0.5)/10**-5\n",
    "\n",
    "#Result\n",
    "print\"minimum thickness of the film t= %1.3f*10**-5 cm\" %t #The answer provided in the textbook is incorrect"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5, Page Number 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i)For the first order wavelength= 9.58*10**-5 cm\n",
      "(ii)For the second order wavelength= 4.79*10**-5 cm\n",
      "(iii)For the third order wavelength= 3.19*10**-5 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "i=35                 #incident angle in degrees\n",
    "myu=1.33             #refractive index \n",
    "n=1                  #first minimum\n",
    "t=4*10**-5           #thickness\n",
    "\n",
    "#Calculations\n",
    "cos_r=0.90\n",
    "lamda1=2*myu*t*cos_r/10**-5        #for first order n=1\n",
    "lamda2=(2*myu*t*cos_r)/2/10**-5    #for second order n=2\n",
    "lamda3=(2*myu*t*cos_r)/3/10**-5    #for third order n=3\n",
    "\n",
    "#Result\n",
    "print\"(i)For the first order wavelength= %1.2f*10**-5 cm\" %lamda1     #The answer provided in the textbook is incorrect\n",
    "print\"(ii)For the second order wavelength= %1.2f*10**-5 cm\" %lamda2\n",
    "print\"(iii)For the third order wavelength= %1.2f*10**-5 cm\" %lamda3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 6, Page Number 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Thickness of the film t= 3.927*10**-4 mm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5890*10**-10   #wavelength\n",
    "myu=1.5              #refractive index of glass\n",
    "n=1                  #first minimum\n",
    "r=60                 #angle in degrees\n",
    "\n",
    "#Calculations\n",
    "t=(n*lamda)/(2*myu*0.5)/10**-7\n",
    "\n",
    "#Result\n",
    "print\"Thickness of the film t= %1.3f*10**-4 mm\" %t "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 7, Page Number 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thickness of the film t= 3.132*10**-4 mm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5890*10**-10   #wavelength\n",
    "myu=1.33             #refractive index of glass\n",
    "n=1                  #first minimum\n",
    "r=45                 #angle in degrees\n",
    "cos_r=0.707\n",
    "\n",
    "#Calculations\n",
    "t=(n*lamda)/(2*myu*cos_r)/10**-7\n",
    "\n",
    "#Result\n",
    "print\"thickness of the film t= %1.3f*10**-4 mm\" %t "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 8, Page Number 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thickness of the film t= 1.2*10**-5 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5.1*10**-7     #wavelength\n",
    "myu=4/3              #refractive index of glass\n",
    "r=45                 #angle in degrees\n",
    "sin_i=4/5\n",
    "n=50\n",
    "\n",
    "#Calculations\n",
    "sin_r=sin_i/myu\n",
    "cos_r=(1-sin_r**2)**0.5\n",
    "t=(n*lamda)/(2*myu*cos_r)/10**-5\n",
    "\n",
    "#Result\n",
    "print\"thickness of the film t= %1.1f*10**-5 m\" %t "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 9, Page Number 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "order of the dark ring n1= 80\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n2=20                 #order of dark ring\n",
    "lamda=5890*10**-8     #wavelenght\n",
    "\n",
    "#Calculations\n",
    "n1=n2*4\n",
    "\n",
    "#Result\n",
    "print\"order of the dark ring n1= %i\" %n1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 10 , Page Number 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Radius of curvature= 99.8 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Dm=0.590              #diameter of ring 15\n",
    "Dn=0.336              #diameter of ring 5\n",
    "lamda=5890*10**-8\n",
    "m=15\n",
    "n=5\n",
    "\n",
    "#Calculation\n",
    "R=(Dm**2-Dn**2)/(4*lamda*(m-n))\n",
    "\n",
    "#Result\n",
    "print\"Radius of curvature= %0.1f cm\" %R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 11 , Page Number 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diameter of the nth ring= 0.2546 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda1=6000*10**-8           \n",
    "lamda2=4500*10**-8\n",
    "R=90                 #Radius of curvature\n",
    "n=3\n",
    "\n",
    "#Calculation\n",
    "dn=math.sqrt(4*n*lamda1*R)\n",
    "\n",
    "#Result\n",
    "print\"diameter of the nth ring= %0.4f cm\" %dn\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 12, Page Number 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Radius of curvature= 105.93 cms\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Dm=0.50               #diameter of ring 1\n",
    "lamda=5900*10**-8     #wavelenght\n",
    "m=10\n",
    "\n",
    "#Calculation\n",
    "R=(Dm**2)/(4*lamda*m)/10**2*10**2\n",
    "\n",
    "#Result\n",
    "print\"Radius of curvature= %0.2f cms\" %R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 13, Page Number 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Refractive index of liquid= 1.31 \n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "dn=0.3                #diameter of ring 5\n",
    "lamda=5.895*10**-5    #wavelenght\n",
    "R=100\n",
    "n=5\n",
    "\n",
    "#Calculation\n",
    "myu=(4*R*n*lamda)/dn**2\n",
    "\n",
    "#Result\n",
    "print\"Refractive index of liquid= %0.2f \" %myu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 14, Page Number 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Refractive index of liquid= 1.361 \n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "D2=1.40                \n",
    "D1=1.20                \n",
    "\n",
    "#Calculation\n",
    "myu=(D2/D1)**2\n",
    "\n",
    "#Result\n",
    "print\"Refractive index of liquid= %1.3f \" %myu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 15, Page Number 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Radius of curvature= 139 cm\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "myu=4/3\n",
    "Dn=0.5                 #diameter of 10th ring\n",
    "lamda=6*10**-5\n",
    "n=10\n",
    "\n",
    "#Calculation\n",
    "R=(myu*Dn**2)/(4*n*lamda)\n",
    "\n",
    "#Result\n",
    "print\"Radius of curvature= %1.0f cm\" %R"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 16, Page Number 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of liquid= 1.441 \n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "myu=4/3\n",
    "Dn=0.5                 #diameter of 10th ring\n",
    "lamda=5895*10**-8\n",
    "n=6\n",
    "R=100\n",
    "r=0.15\n",
    "\n",
    "#Calculation\n",
    "myu=(((2*n)-1)*lamda*R)/(2*r**2)\n",
    "\n",
    "#Result\n",
    "print\"refractive index of liquid= %1.3f \" %myu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 17, Page Number 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength of liquid used= 5880 Armstrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "D15=5.90*10**-3        #diameter of 15th ring\n",
    "D5=3.36*10**-3         #diameter of 5th ring\n",
    "m=10\n",
    "R=100\n",
    "\n",
    "#Calculation\n",
    "lamda=(D15**2-D5**2)/(4*m*R)/10**-9*10**3\n",
    "\n",
    "#Result\n",
    "print\"wavelength of liquid used= %i Armstrong\" %lamda"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 18, Page Number 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "refractive index of liquid= 1.331\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "D1=1.50\n",
    "D2=1.30\n",
    "\n",
    "#Calculation\n",
    "myu=(D1/D2)**2\n",
    "\n",
    "#Result\n",
    "print\"refractive index of liquid= %1.3f\" %myu"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 19 , Page Number 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i)radius of curvature R= 4.583051 m\n",
      "(ii)Thickness of air film t= 2.95*10**-6 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules \n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=5.9*10**-7\n",
    "r=5.2*10**-3           #radius of ring\n",
    "n=10\n",
    "\n",
    "#Calculation\n",
    "R=(r**2)/(n*lamda)\n",
    "t=(n*lamda)/2/10**-6\n",
    "\n",
    "#Result\n",
    "print\"(i)radius of curvature R= %f m\" %R\n",
    "print\"(ii)Thickness of air film t= %1.2f*10**-6 m\" %t"
   ]
  }
 ],
 "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.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
