{
 "metadata": {
  "name": "",
  "signature": "sha256:faf80c20562ef1fa5d737b0d74b9cf873ec0d412505987698b0fa170ec356db4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "7: Thin film interference and diffraction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.1, Page number 158"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "alpha=0.01;    #angle(radian)\n",
      "n=10;        #number of fringe\n",
      "lamda=6000*10**-8;  #wavelength(cm)\n",
      "\n",
      "#Calculation\n",
      "#for dark fringe 2*u*t*cos(alpha)=n*lam\n",
      "#t=xtan(alpha)\n",
      "x=(n*lamda)/(2*alpha);    #distance of 10th fringe from edge of wedge(cm)\n",
      "\n",
      "#Result\n",
      "print \"distance of 10th fringe from edge of wedge is\",x,\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "distance of 10th fringe from edge of wedge is 0.03 cm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.2, Page number 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "t=5*10**-5;    #thickness of soap film(cm)\n",
      "u=1.33; \n",
      "\n",
      "#Calculation\n",
      "#for constructive interference of reflected light\n",
      "#2*u*t*cos(r)=(2*n+1)(lam/2), where n=0,1,2,3\n",
      "#for normal incidence r=0, cos(r)=1\n",
      "#for n=0 lamda=lamda1\n",
      "lamda1=4*u*t;    #wavelength for zero order(cm)\n",
      "#for n=1 lamda=lamda2\n",
      "lamda2=4*u*t*(1/3);    #wavelength for first order(cm)\n",
      "#for n=2 lamda=lamda3\n",
      "lamda3=4*u*t*(1/5);    #wavelength for second order(cm)\n",
      "#for n=3 lamda=lamda4\n",
      "lamda4=4*u*t*(1/7);    #wavelength for third order(cm)\n",
      "\n",
      "#Result\n",
      "print \"wavelength that is strongly reflected in visible spectrum is\",lamda3*10**8,\"angstrom\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "wavelength that is strongly reflected in visible spectrum is 5320.0 angstrom\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.3, Page number 159"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=10;   #10th dark ring\n",
      "D10=0.5;    #diameter of ring(cm)\n",
      "lamda=5000*10**-8;    #wavelength of light(cm)   \n",
      "\n",
      "#Calculation\n",
      "R=(D10**2)/(4*n*lamda);    #radius of curvature of lens(cm)\n",
      "D50=math.sqrt(4*50*R*lamda);   #diameter of 50th dark ring(cm)\n",
      "r50=D50/2;        #radius of 50th dark ring(cm)\n",
      "\n",
      "#Result\n",
      "print \"radius of 50th dark ring is\",round(r50,2),\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "radius of 50th dark ring is 0.56 cm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.4, Page number 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "i=45;     #angle of incidence(degrees)\n",
      "mew=1.33;   #refractive index\n",
      "lamda=5000;    #wavelength(angstrom)\n",
      "\n",
      "#Calculation\n",
      "i=i*(math.pi/180);    #angle of incidence(radian)\n",
      "sin_r=math.sin(i)/mew;    #value of sin(r)\n",
      "r=math.asin(sin_r);    #angle of refraction(radian) \n",
      "r1=r*(180/math.pi);     #angle of refraction(degrees)\n",
      "#for bright fringe 2*u*t*cos(r)=(2*n+1)(lamda/2)\n",
      "#for minimum thickness n=0\n",
      "t=lamda/(4*mew*math.cos(r));    #minimum thickness(angstrom)\n",
      "\n",
      "#Result\n",
      "print \"minimum thickness of film is\",int(t),\"angstrom\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "minimum thickness of film is 1109 angstrom\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.5, Page number 160"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=5500*10**-8;     #wavelength(cm)\n",
      "V=0.2;      #volume of oil drop(cc)\n",
      "A=100*100;   #surface area(sq.cm)\n",
      "\n",
      "#Calculation\n",
      "#since both reflections occur at surface of denser medium\n",
      "#condition for brightness for min thickness, n=1\n",
      "#for normal incidence r=0, cos(r)=1\n",
      "t=V/A;    #thickness of film(cm)\n",
      "mew0=lamda/(2*t);   #refractive index of oil\n",
      "\n",
      "#Result\n",
      "print \"refractive index of oil is\",mew0"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "refractive index of oil is 1.375\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.6, Page number 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=6300;    #wavelength of light(angstrom)\n",
      "mew=1.5;       #refractive index\n",
      "n=10;\n",
      "\n",
      "#Calculation\n",
      "#condition for dark 2*u*t=n*lam\n",
      "#condition for bright 2*u*t=(2*n-1)(lam/2)\n",
      "#when t=0 n=0 order dark band will come and at edge 10th bright band will come \n",
      "t=(((2*n)-1)*(lamda))/(4*mew);   #thickness of air film(angstrom)\n",
      "\n",
      "#Result\n",
      "print \"thickness of air film is\",t,\"angstrom\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thickness of air film is 19950.0 angstrom\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.7, Page number 161"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "mewg=1.5;    #refractive index of glass\n",
      "mewo=1.3;    #refractive index of oil\n",
      "lamda1=7000;   #wavelength(angstrom)\n",
      "lamda2=5000;   #wavelength(angstrom)\n",
      "r=0;     #for nth minimum\n",
      "\n",
      "#Calculation\n",
      "#here reflection occurs both time at surface of denser medium\n",
      "#condition for distructive interference in reflected side\n",
      "#2*u*t*cos(r)=(2*n-1)(lam1/2), for nth min.\n",
      "#2*u*t=(2*n+1)(lam1/2), n=0,1,2,3\n",
      "#for (n+1)th min.\n",
      "#2*u*t=(2*(n+1)+1)(lam2/2), n=0,1,2,3\n",
      "t=(2/(4*mewo))*((lamda1*lamda2)/(lamda1-lamda2));      #thickness of layer(angstrom)\n",
      "\n",
      "#Result\n",
      "print \"thickness of layer is\",int(t),\"angstrom\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "thickness of layer is 6730 angstrom\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.8, Page number 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "Dn=1.40;    #diameter of 10th ring(cm)\n",
      "D=1.27;     #changed diameter(cm)\n",
      "\n",
      "#Calculation\n",
      "#when mew=1\n",
      "#(Dn^2)=4*n*lam*R=(1.40^2)\n",
      "#when mew=mew1\n",
      "#(D^2)=(4*n*lam*R)/u1=(1.27^2)\n",
      "mewl=((Dn**2)/(D**2));      #refractive index of liquid \n",
      "\n",
      "#Result\n",
      "print \"refractive index of liquid is\",round(mewl,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "refractive index of liquid is 1.2152\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.9, Page number 162"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "B=0.5;   #fringe width(cm)\n",
      "mew=1.4;    #refractive index\n",
      "\n",
      "#Calculation\n",
      "alpha=((math.pi*10)/(60*60*180));   #converting into radian\n",
      "lamda=2*B*alpha*mew;   #wavelength of light(cm)\n",
      "\n",
      "#Result\n",
      "print \"wavelength of light used is\",int(lamda*10**8),\"angstrom\"\n",
      "print \"answer given in the book varies due to rounding off errors\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "wavelength of light used is 6787 angstrom\n",
        "answer given in the book varies due to rounding off errors\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.10, Page number 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=6000*10**-8;    #wavelengh of light(cm)\n",
      "mew=1.5;    #refractive index\n",
      "\n",
      "#Calculation\n",
      "#condition for dark fringe is 2*t=n*lam\n",
      "#but B=(lam/(2*alpha*u))\n",
      "#delta_t=alpha*x\n",
      "delta_t=(10*lamda)/(2*mew);     #difference t2-t1(cm)\n",
      "\n",
      "#Result\n",
      "print \"difference t2-t1 is\",delta_t,\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "difference t2-t1 is 0.0002 cm\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.11, Page number 163"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=5890;   #wavelength of light(angstrom)\n",
      "mew=1.5;    #refractive index\n",
      "r=60;       #angle of refraction(degrees)\n",
      "\n",
      "#Calculation\n",
      "#condition for dark is 2*mew*t*cos(r)=n*lamda\n",
      "r=60*(math.pi/180);    #angle of refraction(radian)\n",
      "#for n=1\n",
      "t=(lamda)/(2*mew*math.cos(r));    #smallest thickness of glass plate(angstrom)\n",
      "\n",
      "#Result\n",
      "print \"smallest thickness of glass plate is\",int(t),\"angstrom\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "smallest thickness of glass plate is 3926 angstrom\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.13, Page number 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "aplusb=1/1250;    #transmission grating(lines/cm)\n",
      "n=2;     #order of spectral line\n",
      "theta=30;    #deviation angle(degrees)\n",
      "\n",
      "#Calculation\n",
      "theta=theta*(math.pi/180);   #deviation angle(radian)\n",
      "#(a+b)sin(theta)=n*lamda\n",
      "lamda=(aplusb*math.sin(theta))/n;   #wavelength of spectral line(cm)\n",
      "\n",
      "#Result\n",
      "print \"wavelength of spectral line is\",lamda,\"cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "wavelength of spectral line is 0.0002 cm\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.14, Page number 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=5893*10**-8;    #wavelength(cm)\n",
      "aplusb=2.54/2540;  #grating(lines/cm)\n",
      "\n",
      "#Calculation\n",
      "#n=nmax, if sin(theta)=1\n",
      "nmax=(aplusb/lamda);      #maximum order\n",
      "\n",
      "#Result\n",
      "print \"maximum order is\",int(nmax)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "maximum order is 16\n"
       ]
      }
     ],
     "prompt_number": 47
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.15, Page number 180"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=2;   #second order\n",
      "aplusb=1/5000;   #transmission grating(lines/cm)\n",
      "lamda=5893*10**-8;      #wavelength(cm)\n",
      "f=30;    #focal length(cm)\n",
      "\n",
      "#Calculation\n",
      "dtheta=(2.5*3.14)/(180*60);    #change in angular displacement(radian)\n",
      "#dlamda=((a+b)cos(theta)/n)dtheta\n",
      "costheta=math.sqrt(1-(((n*lamda)/aplusb)**2));\n",
      "dlamda=(dtheta*aplusb*costheta)/n;  #difference in wavelength(cm)\n",
      "dl=f*dtheta;   #linear separation(cm)\n",
      "\n",
      "#Result\n",
      "print \"difference in wavelength of two yellow lines\",round(dlamda*10**8),\"angstrom\"\n",
      "print \"linear separation is\",round(dl*10**2,2),\"*10**-2 cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "difference in wavelength of two yellow lines 6.0 angstrom\n",
        "linear separation is 2.18 *10**-2 cm\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.16, Page number 181"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda1=5400*10**-8;    #wavelength1(cm)\n",
      "lamda2=4050*10**-8;    #wavelength(cm)\n",
      "theta=30;      #angle of diffraction(degrees)\n",
      "\n",
      "#Calculation\n",
      "#nth order of lamda1 is superimposed on (n+1)th order of lamda2 for theta=30\n",
      "#(a+b)sin(30)=n*5400*10^-8=(n+1)*4050*10^-8\n",
      "n=(lamda2/(lamda1-lamda2));    #nth order\n",
      "theta=30*(math.pi/180);     #angle of diffraction(radian)\n",
      "N=math.sin(theta)/(n*lamda1);      #lines/cm in grating\n",
      "\n",
      "#Result\n",
      "print \"lines/cm in grating is\",int(N),\"lines/cm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "lines/cm in grating is 3086 lines/cm\n"
       ]
      }
     ],
     "prompt_number": 51
    }
   ],
   "metadata": {}
  }
 ]
}