{
 "metadata": {
  "name": "",
  "signature": "sha256:f4c05fd79d4d56cbd4b08f847aeb0bba767b388c9bbe1bea8066d97e3ac78212"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "5: Diffraction"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.1, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=1;\n",
      "lamda=600*10**-9;                 #wavelength(m)\n",
      "theta=35;                          #angle at which first minimum falls(degrees)\n",
      "\n",
      "#Calculation                        \n",
      "theta=theta*math.pi/180;      #angle at which first minimum falls(radian)\n",
      "d=((n*lamda)/math.sin(theta))*10**6;      #width of the slit(micro m)\n",
      "\n",
      "#Result\n",
      "print \"The width of the slit is\",round(d,2),\"micro m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The width of the slit is 1.05 micro m\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.2, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "D=0.95;                          #distance of the screen from the slit(m)\n",
      "lamda=589*10**-9;                #wavelength(m)\n",
      "d=0.5*10**-3;                     #width of the slit(m)\n",
      "\n",
      "#Calculation                        \n",
      "y=((2*D*lamda)/d)*10**3;         #width of a central band(mm)\n",
      "\n",
      "#Result\n",
      "print \"The width of the central band is\",round(y,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The width of the central band is 2.24 mm\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.3, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "D=1.1;                        #distance of the screen from the slit(m)\n",
      "lamda=589*10**-9;             #wavelength(m)\n",
      "y=4.5*10**-3;                  #distance of first minimum on either side of central maximum(m)\n",
      "\n",
      "#Calculation                        \n",
      "d=((D*lamda)/y)*10**3         #slit width(mm)\n",
      "\n",
      "#Result\n",
      "print \"The slit width is\",round(d,3),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The slit width is 0.144 mm\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.4, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=4;\n",
      "lamda=589.6*10**-9;                  #wavelength(m)\n",
      "D=0.95;                              #distance of the screen from the slit(m)\n",
      "w=0.28*10**-3;                        #width of the slit(m)\n",
      "\n",
      "#Calculation                        \n",
      "d=((n*lamda*D)/w)*10**3;     #distance between centres(mm)\n",
      "\n",
      "#Result\n",
      "print \"The distance between centres of central maximum and the fourth dark fringe is\",int(d),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between centres of central maximum and the fourth dark fringe is 8 mm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.5, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "s=5*math.pi/2;                           #secondary maximum\n",
      "\n",
      "#Calculation                        \n",
      "I=(math.sin(s)/s)**2;                      #I2/I0\n",
      "\n",
      "#Result\n",
      "print \"Ratio of intensities of central & second secondary maximum is\",round(I,3)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of intensities of central & second secondary maximum is 0.016\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.6, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=450*10**-9;                  #wavelength(m)\n",
      "n=2;\n",
      "dlambda=1*10**-9;                   #difference in wavelength(m)\n",
      "\n",
      "#Calculation                        \n",
      "N=lamda/(n*dlambda);               #minimum number of lines per cm \n",
      "\n",
      "#Result\n",
      "print \"The minimum number of lines per cm is\",N/2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum number of lines per cm is 112.5\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.7, Page number 86"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=1;\n",
      "lamda=650*10**-9;                       #wavelength(m)\n",
      "d=2*10**-6;                              #width of the slit(m)\n",
      "\n",
      "#Calculation                        \n",
      "theta=math.asin((n*lamda)/d);                #angle at which first minimum will be observed(radian)\n",
      "theta=theta*180/math.pi;      #angle at which first minimum will be observed(degrees)\n",
      "\n",
      "#Result\n",
      "print \"The angle at which first minimum will be observed is\",round(theta,3),\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angle at which first minimum will be observed is 18.966 degrees\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.8, Page number 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "lamda=600*10**-9;                           #wavelength(m)\n",
      "y=2*10**-3;                                 #width of the central band(m)\n",
      "D=1;                                       #distance of the screen from the slit(m)\n",
      "\n",
      "#Calculation                        \n",
      "d=((2*D*lamda)/y)*10**3;                    #slit width(mm)\n",
      "\n",
      "#Result\n",
      "print \"The slit width is\",d,\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The slit width is 0.6 mm\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.9, Page number 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "y=6*10**-3;                     #first minimum is observed(m)\n",
      "d=90*10**-6;                    #slit width(m)\n",
      "D=0.98;                        #distance of the screen from the slit(m)\n",
      "\n",
      "#Calculation                        \n",
      "lamda=((y*d)/D)*10**9;           #wavelength(nm)\n",
      "\n",
      "#Result\n",
      "print \"The wavelength of light used is\",int(lamda),\"nm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of light used is 551 nm\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.10, Page number 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=1;\n",
      "lambda1=450*10**-9;                   #wavelength of first spectral line(m)\n",
      "d=1/5000;                    #number of lines\n",
      "\n",
      "#Calculation                        \n",
      "theta1=math.asin((n*lambda1)/d);    \n",
      "theta1=round(theta1*10**2*180/math.pi);\n",
      "theta2=theta1+2.97;\n",
      "theta2=theta2*math.pi/180;\n",
      "lambda2=d*math.sin(theta2)/n;    #wavelength of second spectral line(nm)\n",
      "\n",
      "#Result\n",
      "print \"The wavelength of second spectral line is\",int(lambda2*10**7),\"nm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of second spectral line is 550 nm\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 5.11, Page number 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "n=3;\n",
      "lamda=700*10**-9;              #wavelength(m)\n",
      "theta=90;         #angle(degrees)\n",
      "\n",
      "#Calculation                        \n",
      "theta=theta*math.pi/180;     #angle(radian)\n",
      "d=n*lamda/math.sin(theta);    #grating element(m)\n",
      "\n",
      "#Result\n",
      "print \"The minimum grating element required to observe the entire third order spectrum is\",d*10**6,\"*10**-6 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum grating element required to observe the entire third order spectrum is 2.1 *10**-6 m\n"
       ]
      }
     ],
     "prompt_number": 45
    }
   ],
   "metadata": {}
  }
 ]
}