{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5: Physical Optics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1, Page 297"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "n1 = 10;  # Order of interference maximum for lambda = 7000 angstrom\n",
      "lambda1 = 7000;  # Wavelength of the light, angstrom\n",
      "lambda2 = 5000;  # Wavelength of the light, angstrom\n",
      "\n",
      "#Calculations\n",
      "# As W = D*lambda/(2*d) then, x = n1*D*lambda1/(2*d) = n2*D*lambda2/(2*d), solving for n2\n",
      "n2 = n1*lambda1/lambda2;    # Order of interference maximum for lambda = 5000 angstrom\n",
      "\n",
      "#Result\n",
      "print \"The order of interference maximum for wavelength of 5000 angstrom = %2d \"%n2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The order of interference maximum for wavelength of 5000 angstrom = 14 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2, Page 297"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable Declaration\n",
      "D = 1.6;  # Distance between the slit and the screen, m\n",
      "a = 0.4;  # Distance between the slit and the biprism, m\n",
      "mu = 1.52;  # Refractive index of the material of biprism\n",
      "W = 1e-004;    # Fringe width, m\n",
      "lamda = 5.893e-007;  # Wavelength of light used, m\n",
      "\n",
      "#Calculations\n",
      "# As W = lambda*D/(2*a(mu-1)*alpha then\n",
      "alpha = ((lamda*D)/(2*a*(mu-1)*W))*180/pi;    # Angle of biprism, degrees\n",
      "\n",
      "#Result\n",
      "print \"The angle of the biprism = %3.1f degrees\"%alpha\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angle of the biprism = 1.3 degrees\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3, Page 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "lamda = 5.890e-7;  # Wavelength of source of light, m \n",
      "mu = 1.6;  #refractive index of the mica sheet\n",
      "\n",
      "#Calculations\n",
      "# As del_x = W*(mu-1)*t/lambda, where del_x = 3*W, solving for t\n",
      "t = 3*lamda/(mu-1);    # Thickness of the mica sheet, m  \n",
      "\n",
      "#Result\n",
      "print \"The thickness of the mica sheet = %5.3e cm\"%(t/1e-02)\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thickness of the mica sheet = 2.945e-04 cm\n"
       ]
      }
     ],
     "prompt_number": 54
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4, Page 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "lamda = 6.0e-7;  # Wavelength of the monochromatic light, m\n",
      "D = 1;  # Distance between the screen and the two coherent sources, m \n",
      "W = 5e-004;  # Fringe width, m\n",
      "\n",
      "#Calculations\n",
      "d = lamda*D/(W*1e-03);    # Distance between two coherent sources, mm\n",
      "\n",
      "\n",
      "print \"The distance between the two coherent sources = %3.1f mm\"%d\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between the two coherent sources = 1.2 mm\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5, Page 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable Declaration\n",
      "D = 1;  # Distance between slits and the screen, m\n",
      "mu = 1.5;    # Refractive index of the material of biprism\n",
      "a = 0.5;  # The distance between the slit and the biprism, m \n",
      "W = 1.35e-004;  # Width of the fringes, m\n",
      "\n",
      "#Calculations\n",
      "alpha = (180.-179.)/2*pi/180;    # Acute angle of biprism, radian\n",
      "lamda = 2*a*(mu-1)*alpha*W/D;    # Wavelength of light used, m\n",
      "\n",
      "#Result\n",
      "print \"The wavelength of light used = %4d angstrom\"%(lamda/1e-10)\n",
      "#Incorrect answer in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of light used = 5890 angstrom\n"
       ]
      }
     ],
     "prompt_number": 59
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6, Page 299"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "lamda = 6.328e-007;  # Wavelength of the monochromatic light, m\n",
      "D = 40;  # Distance between the slits and the screen, m \n",
      "W = 0.1;  # Distance between the interference maxima, m\n",
      "\n",
      "#Calculations\n",
      "d = lamda*D/W;    # Distance between the slits, m\n",
      "\n",
      "#Result\n",
      "print \"The distance between the slits = %6.4f mm\"%(d/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between the slits = 0.2531 mm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7, Page 299"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "lamda = 5.0e-007;  # Wavelength of the monochromatic light, m\n",
      "D = 1;  # Distance between the silts and the screen, m\n",
      "d = 5e-004/2;  # Half of the distance between the two slits, m\n",
      "mu = 1.5;  # Refractive index of glass\n",
      "t = 1.5e-006;  # Thickness of thin glass plate, m\n",
      "\n",
      "#Calculations\n",
      "del_x = D*(mu-1)*t/(2*d);\n",
      "\n",
      "#Result\n",
      "print \"The lateral shift of central maximum = %3.1f mm\"%(del_x/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The lateral shift of central maximum = 1.5 mm\n"
       ]
      }
     ],
     "prompt_number": 60
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.8, Page 300"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable Declaration\n",
      "lamda = 6.0e-007;  # Wavelength of the light, m\n",
      "mu = 1.463;  # Refrctive index of a soap bubble film\n",
      "n = 0;    # Value of n for smallest thickness\n",
      "r = 0;    # Angle of refraction for normal incidence\n",
      "\n",
      "#Calculations\n",
      "# As 2*mu*t*cos(r) = (2*n+1)*lambda/2, solving for t\n",
      "t = (2*n+1)*lamda/(4*mu*cos(r));    # The thickness of a soap bubble film, m \n",
      "\n",
      "#Result\n",
      "print \"The thickness of a soap bubble film = %5.1f angstrom\"%(t/1e-010)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thickness of a soap bubble film = 1025.3 angstrom\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.9, Page 300"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "D5 = 3.36e-003;  # Diameter of Newton's 5th ring, m \n",
      "D15 = 5.90e-003;  # Diameter of Newton's 15th ring, m \n",
      "m = 10;    # Number of ring\n",
      "R = 1;  # Radius of the plano-convex lens, m\n",
      "\n",
      "#Calculations\n",
      "lamda = (D15**2-D5**2)/(4*m*R);\n",
      "\n",
      "\n",
      "print \"The wavelength of the light used = %4d angstrom\"%(lamda/1e-010)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of the light used = 5880 angstrom\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.10, Page 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "D10 = 0.005;  # Diameter of Newton's 5th ring, m \n",
      "n = 10;  # Order of the ring\n",
      "lamda = 6.0e-007;  # Wavelength of the light used, m\n",
      "\n",
      "#Calculations&Results\n",
      "R = (D10**2)/(4*n*lamda);    # Radius of the curvature of the lens, m\n",
      "print \"The radius of the curvature of the lens = %6.4f m\"%R\n",
      "t = D10**2/(8*R);  \n",
      "print \"The thickness of the corresponding air film = %3.1e m\"%t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radius of the curvature of the lens = 1.0417 m\n",
        "The thickness of the corresponding air film = 3.0e-06 m\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.11, Page 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "mu = 1.43;  # Refractive index of the soap film\n",
      "n = 0;    # Order of fringes for smallest thickness\n",
      "i = 30;    # Angle of incidence, degrees\n",
      "\n",
      "#Calculations\n",
      "# As sin(i)/sin(r) = mu, cos(r)\n",
      "cosr = sqrt(1-(sin(i*pi/180)/mu)**2);    # Cosine of angle r\n",
      "lamda = 6.0e-007;  # Wavelength of the light, m\n",
      "t = (2*n+1)*lamda/(4*mu*cosr);  # Thickness of the soap film, m\n",
      "\n",
      "#Result\n",
      "print \"The thickness of the soap film = %4.2e m\"%t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thickness of the soap film = 1.12e-07 m\n"
       ]
      }
     ],
     "prompt_number": 64
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.12, Page 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 5.893e-007;  # Wavelength of the sodium light, m\n",
      "mu = 1.42;  # Refractive index of the soap film\n",
      "r = 0;    # Angle of refraction, degrees\n",
      "n = 0;    # Order of diffraction for least thickness of dark film\n",
      "\n",
      "#Calculations&Result\n",
      "t = (2*n+1)*lamda/(4*mu*cos(r));    # Least thickness of the film that will apear bright, m\n",
      "print \"The least thickness of the film that will appear bright = %5.1f m\"%(t/1e-010)\n",
      "n = 1;    # Order of diffraction for least thickness of bright film\n",
      "t = n*lamda/(2*mu*cos(r));    # Least thickness of the film that will apear dark, m \n",
      "print \"The least thickness of the film that will appear dark = %6.2f m\"%(t/1e-010)  #incorrect answer in the textbook\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The least thickness of the film that will appear bright = 1037.5 m\n",
        "The least thickness of the film that will appear dark = 2075.00 m\n"
       ]
      }
     ],
     "prompt_number": 66
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.13, Page 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.893e-007;  # Wavelength of the sodium light, m\n",
      "\n",
      "#Calculations\n",
      "# As fringe width of the thin wedge-shaped air film is\n",
      "# W = lambda/(2*t/20*W), solving for t\n",
      "t = (10*lamda);    # Thickness of the wire separating edges of two plane glass surfaces, m\n",
      "\n",
      "#Result\n",
      "print \"The thickness of the wire = %5.3e m\"%t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thickness of the wire = 5.893e-06 m\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.14, Page 303"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.9e-007;  # Wavelength of the reflected light, m\n",
      "n = 10;  # Order of the ring\n",
      "D10 = 0.005;  # Diameter of the 10th ring,in m \n",
      "\n",
      "#Calculations&Result\n",
      "R = (D10**2)/(4*n*lamda);    # Radius of curvature of the lens, m\n",
      "print \"The radius of curvature of the lens = %6.4f m\"%R\n",
      "t = (D10**2)/(8*R);    # Thickness of the corresponding air film, m\n",
      "print \"The thickness of the corresponding air film = %4.2e m\"%t\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The radius of curvature of the lens = 1.0593 m\n",
        "The thickness of the corresponding air film = 2.95e-06 m\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.16, Page 304"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 6.328e-007;  # Wavelength of monochromatic light from He laser, m\n",
      "n1 = 1;  # First order \n",
      "n2 = 2;  # Second order\n",
      "l = 6000;  # Lines/cm of the diffraction grating\n",
      "A= 1.66e-6;\n",
      "\n",
      "#Calculations&Result\n",
      "theta = degrees(asin(n1*lamda/A));\n",
      "print \"The first order maximum angle = %4.1f degrees\"%theta\n",
      "theta = degrees(asin(n2*lamda/A));\n",
      "print \"The second order maximum angle = %4.1f degrees\"%theta\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The first order maximum angle = 22.4 degrees\n",
        "The second order maximum angle = 49.7 degrees\n"
       ]
      }
     ],
     "prompt_number": 69
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.17, Page 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "a = 1;    # For simplicity assume slit width to be unity, unit\n",
      "theta = 1; # For simplicity assume diffraction angle to be unity, unit\n",
      "\n",
      "#Calculations\n",
      "# As a*sin(theta) = m*lambda, solving for lambdas\n",
      "lambda1 = a*sin(theta);    # First wavelength, angstrom\n",
      "lambda2 = a*sin(theta)/2;    # First wavelength, angstrom\n",
      "\n",
      "#Result\n",
      "print \"lambda1 = %d*lambda2\"%(lambda1/lambda2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "lambda1 = 2*lambda2\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.18, Page 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 5.5e-7;  # Wavelength of light, m\n",
      "a = 2.2e-6;  # Width of the slit, m\n",
      "l = 6000;  # Lines /cm of the diffraction grating\n",
      "# In a single slit diffraction pattern the directions of minimum intensity are given by a*sintheta = m*lambda where m = 1,2,3  \n",
      "# For m = 1\n",
      "\n",
      "#Calculations&Results\n",
      "m = 1;  # First order\n",
      "theta = degrees(asin((m*lamda)/a));    # Angular position of first minima on either side of the central maxima, degrees\n",
      "print \"The angular position of first minima on either side of the central maxima = %.2f degrees\"%(theta)\n",
      "\n",
      "# For m = 2\n",
      "m = 2;  # Second order\n",
      "theta = degrees(asin(m*lamda/a));\n",
      "print \"The angular position of second minima on either side of the central maxima = %.2f degrees\"%(theta)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angular position of first minima on either side of the central maxima = 14.48 degrees\n",
        "The angular position of second minima on either side of the central maxima = 30.00 degrees\n"
       ]
      }
     ],
     "prompt_number": 85
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.19, Page 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "D = 1.7;  # Distance between the slit and the screen, m\n",
      "W = 2.5e-003;  # Given fringe width, m \n",
      "a = 8e-005;  # Width of the first slit, m\n",
      "b = 4e-004;  # Width of the second slit, m\n",
      "n = b;    #      \n",
      "p = [1, 2, 3, 4, 5, 6];\n",
      "\n",
      "#Calculations&Results\n",
      "# In a double slit experiment Fraunhoffer diffraction pattern,the fringe width is given by W = lambda*D/n \n",
      "lamda = b*W/D;    # Wavelength of the light used, m\n",
      "print \"The wavelength of light = %4d angstrom\"%(lamda/1e-010)\n",
      "print \"The missing orders are:\\n\"\n",
      "for i in range(1,6):\n",
      "    s = ((a+b)/a)*i;\n",
      "    print \"%d,\"%s,\n",
      "    \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of light = 5882 angstrom\n",
        "The missing orders are:\n",
        "\n",
        "6, 12, 18, 24, 30,\n"
       ]
      }
     ],
     "prompt_number": 94
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.20, Page 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "D = 2;  # Distance of the screen from the slit, m\n",
      "x = 1.6e-02;  # Position of centre of the second dark band, m\n",
      "m = 2;    # Order of diffraction\n",
      "a = 1.4e-04;  # Width of the slit, m\n",
      "\n",
      "#Calculations\n",
      "lamda = (a*x)/(m*D);    # Wavelength of light, m\n",
      "\n",
      "#Result\n",
      "print \"The wavelength of the light = %4d angstrom\"%((lamda/1e-010))\n",
      "#rounding-off error"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of the light = 5599 angstrom\n"
       ]
      }
     ],
     "prompt_number": 95
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.21, Page 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lambda1 = 5890;  # Wavelength of the line, angstrom\n",
      "lambda2 = 5896;  # Wavelength of the line, angstrom\n",
      "\n",
      "#Calculations\n",
      "d_lambda = lambda2 - lambda1;  # Wavelength difference, angstrom\n",
      "n = 2;  # Order of diffraction\n",
      "N = lambda2/(n*d_lambda);    # Minimum no. of lines in a grating\n",
      "\n",
      "#Result\n",
      "print \"The minimum number of lines in the grating = %3d lines\"%N\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum number of lines in the grating = 491 lines\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.22, Page 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 5.0e-07;  # Wavelength of the radiation, m\n",
      "a_plus_b = 2.54e-02/2620;  # The grating element, m\n",
      "theta_max = 90;    # Maximum value of angle of diffraction, degrees\n",
      "\n",
      "#Calculations\n",
      "n_max = a_plus_b/lamda*sin(theta_max*pi/180);    # Maximum number of visible orders \n",
      "\n",
      "#Result\n",
      "print \"The number of visible orders = %2d \"%n_max\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The number of visible orders = 19 \n"
       ]
      }
     ],
     "prompt_number": 96
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.23, Page 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "lambda1 = 6000;  # Wavelength of yellow line, angstrom\n",
      "lambda2 = 4800;  # Wavelength of blue line, angstrom\n",
      "\n",
      "#Calculations\n",
      "#(a+b)sin(theta) = n*6000   ---1\n",
      "#(a+b)sin(theta) = (n+1)*4800\n",
      "#Comparing 1 and 2, we get the following,\n",
      "n = 48./12\n",
      "theta = 3./4;    # Angle of diffraction, radian\n",
      "a_plus_b = (n*lambda1)/theta\n",
      "\n",
      "#Results\n",
      "print \"Grating element = %d A\"%a_plus_b"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Grating element = 32000 A\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.26, Page 310"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import *\n",
      "\n",
      "#Variable declaration\n",
      "n = 5;  # Order for given wavelength\n",
      "m = [4, 5, 6, 7, 8];    # Orders of spectral lines in the visible range\n",
      "lambda1 = 6000;  # Wavelength of the spectral line in visible range, angstrom\n",
      "lambda2 = zeros(5);\n",
      "\n",
      "print \"The spectral lines in visible ranges are:\\n\"\n",
      "for i in range(1,5):\n",
      "    l2 = (n*lambda1)/m[i];\n",
      "    lambda2[i] = l2;    # Preserve the lambda value\n",
      "    print \"%4d angstrom\\n\"%(l2),\n",
      "\n",
      "print \"The other spectral lines in the visible range 4000A to 7000A are\"\n",
      "for i in range(1,5):\n",
      "    if lambda2[i] < 7000 and lambda2[i] > 4000:\n",
      "        if lambda2[i] == 6000:\n",
      "            continue\n",
      "            #print \"%4dA\"%lambda2[i]\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The spectral lines in visible ranges are:\n",
        "\n",
        "6000 angstrom\n",
        "5000 angstrom\n",
        "4285 angstrom\n",
        "3750 angstrom\n",
        "The other spectral lines in the visible range 4000A to 7000A are\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.27, Page 310"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "N = 4500;  # Number of lines in grating\n",
      "n = 2;  # Order of diffraction\n",
      "lambda1 = 5890;  # Wavelength, angstrom\n",
      "lambda2 = 5896;  # Wavelength, angstrom\n",
      "\n",
      "#Calculations&Result\n",
      "RP2 = n*N;    # Resolving power of grating in the second order\n",
      "lamda = (lambda1+lambda2)/2;    # Mean wavelength of sodium light, angstrom\n",
      "d_lambda = lambda2 - lambda1;    # Wavelength difference, angstrom\n",
      "RP = lamda/d_lambda;    # Calculated resolving power of grating \n",
      "if RP2 <> RP:\n",
      "    print(\"The D1 and D2 lines of Na light cannot be resolved in second order\");\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The D1 and D2 lines of Na light cannot be resolved in second order\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.28, Page 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.5e-07;  # Wavelength of light used, m\n",
      "f = 3.0;  # Focal length of telescope objective, m \n",
      "a = 0.01;  # Diameter of the telescope objective, m\n",
      "\n",
      "#Calculations\n",
      "# As x/f = 1.22*lambda/a, the Rayleigh criterian for resolution, solving for x\n",
      "x = 1.22*f*lamda/a;    # Distance between two stars just seen as separate, m\n",
      "\n",
      "\n",
      "print \"The distance between two stars just seen as separate = %3.1e m \"%x\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The distance between two stars just seen as separate = 2.0e-04 m \n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.29, Page 311"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.461e-07;  # Wavelength of light used, m\n",
      "d = 4.0e-07;  # Distance between the two luminous objects, m\n",
      "\n",
      "#Calculations\n",
      "# As d = 1.22*lambda/(2*mu*sin(alpha)) = 1.22*lambda/(2*NA), solving for NA\n",
      "NA = 1.22*lamda/(2*d);     # Numerical aperature of the objective of microscope \n",
      "\n",
      "\n",
      "print \"The numerical aperature of the objective of microscope = %5.3f \"%NA\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The numerical aperature of the objective of microscope = 0.833 \n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.30, Page 312"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 6.0e-07;  # Wavelength of light used, m\n",
      "d_theta = 2.44e-06;  # Angular separation between the two stars, radian\n",
      "\n",
      "#Calculations\n",
      "a = 1.22*lamda/d_theta;    # Aperature of the objective of a telescope from Rayleigh criterian, m\n",
      "\n",
      "\n",
      "print \"The aperature of the objective of the telescope = %3.1f m \"%a\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The aperature of the objective of the telescope = 0.3 m \n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.31, Page 312"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.5e-007;  # Wavelength of light used, m\n",
      "x = 1.5e-003;  # Distance between the two pinholes, m\n",
      "a = 4.0e-003;  # Diameter of objective, m\n",
      "\n",
      "#Calculations\n",
      "D = a*x/(1.22*lamda);    # Minimum distance from the telescope at which the the pinhole can be resolved from Rayleigh criterian, m \n",
      "\n",
      "\n",
      "print \"The minimum distance from the telescope at which the the pinhole can be resolved = %4.2f m \"%D\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minimum distance from the telescope at which the the pinhole can be resolved = 8.94 m \n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.32, Page 312"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.461e-07;  # Wavelength of light used, m\n",
      "d = 5.55e-07;  # Distance between the two luminous objects, m\n",
      "\n",
      "#Calculations\n",
      "# As d = 1.22*lambda/(2*mu*sin(alpha)) = 1.22*lambda/(2*NA), solving for NA\n",
      "NA = 1.22*lamda/(2*d);     # Numerical aperature of the objective of microscope \n",
      "\n",
      "\n",
      "print \"The numerical aperature of the objective of microscope = %4.2f \"%NA\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The numerical aperature of the objective of microscope = 0.60 \n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.33, Page 313"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "#Variable declaration\n",
      "i = 60;    # Angle of incidence, degrees\n",
      "mu = tan(i*pi/180);    # Brewester's Law to calculate refractive index\n",
      "A = 60*pi/180;  # Angle of prism, degrees\n",
      "\n",
      "#Calculations\n",
      "# As mu = sind((A+delta_m)/2)/sind(A/2), solving for delta_m\n",
      "delta_m = 2*degrees(asin(mu*sin(A/2)))   # Angle of minimum deviation for green light for its passage through a prism, degrees\n",
      "\n",
      "#Result\n",
      "print \"The angle of minimum deviation for green light for its passage through a prism = %.f degrees\"%((delta_m-60))\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angle of minimum deviation for green light for its passage through a prism = 60 degrees\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.34, Page 313"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "lamda = 5.89e-07;  # Wavelength of light used, m\n",
      "mu_O = 1.55;    # Refractive index of ordinary light\n",
      "mu_E = 1.54;    # Refractive index of extraordinary light\n",
      "\n",
      "#Calculations\n",
      "tQ = lamda/(4*(mu_O-mu_E));    # The thickness of the quarter wave plate, m\n",
      "\n",
      "\n",
      "print \"The thickness of the quarter plate is = %6.4e m\"%tQ\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The thickness of the quarter plate is = 1.4725e-05 m\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.35, Page 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "theta = 9.9;  # Optical rotation of solution, degrees\n",
      "l = 20;  # Length of the tube, cm\n",
      "S = 66;  # Specific rotation of pure sugar solution, degree per dm-(g/cc)\n",
      "\n",
      "#Calculations\n",
      "# As the specific rotation, S = 10*theta/l*c, solving for c\n",
      "c = 10*theta/(l*S);    # Concentration of solution for pure sugar, g/cc\n",
      "c_prime = 0.080;    # Concentration of solution for impure sugar, g/cc\n",
      "Percentage_purity = c*100/c_prime;    # Percentage purity of sugar sample\n",
      "\n",
      "\n",
      "print \"The percentage_purity of the sugar sample = %5.2f percent\"%Percentage_purity\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage_purity of the sugar sample = 93.75 percent\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.36, Page 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "theta = 26.4;  # Optical rotation of sugar solution, degrees\n",
      "l = 20;  # Length of the tube, cm\n",
      "c = 0.20;  # Concentration of the solution, g/cc\n",
      "\n",
      "#Calculations\n",
      "S = 10*theta/(l*c);    # The specific rotation of the sugar solution, degree per dm per (g/cc) \n",
      "\n",
      "\n",
      "print \"The specific rotation of the sugar solution = %2d degrees\"%S\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The specific rotation of the sugar solution = 66 degrees\n"
       ]
      }
     ],
     "prompt_number": 45
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.37, Page 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "# Function to convert degrees to deg-min\n",
      "def deg_to_dms(deg):\n",
      "    d = int(deg)\n",
      "    md = abs(deg - d) * 60\n",
      "    md = round(md)\n",
      "    return [d, md]\n",
      "\n",
      "lamda = 7.62e-07;  # Wavelength of the polarized light, m\n",
      "mu_R = 1.53914;    # Refractive index of quartz for right-handed circularly polarized light\n",
      "mu_L = 1.53920;    # Refractive index of quartz for left-handed circularly polarized light\n",
      "t = 5.0e-004;  # Thickness of the plate, m\n",
      "\n",
      "\n",
      "theta = pi*t*(mu_L-mu_R)/lamda;     # The angle of optical rotation, radian\n",
      "d = deg_to_dms(theta*180/pi);    # Call the conversion function\n",
      "\n",
      "\n",
      "print \"The angle of rotation produced by its plate = \",d\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The angle of rotation produced by its plate =  [7, 5.0]\n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.38, Page 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "theta = 13.;  # Optical rotation of the solution, degrees\n",
      "l = 20.;  # Length of the tube, cm\n",
      "l_prime = 30.;  # New length of the tube, cm\n",
      "c = 1.;    # For simplicity assume concentration of sugar solution to be unity, g/cc\n",
      "\n",
      "#Calculations\n",
      "c_prime = c/3;    # New concentration of sugar solution, g/cc\n",
      "# As, S = 10*theta/(l*c) so 10*theta/(l*c) = 10*theta_prime/(l_prime*c_prime)\n",
      "# Solving for theta_prime\n",
      "theta_prime = theta/(l*c)*l_prime*c_prime;    # The optical rotation produced by new length of sugar solution, degrees\n",
      "\n",
      "\n",
      "print \"The optical rotation of %d cm length of sugar solution = %3.1f degrees\"%(l_prime, theta_prime)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The optical rotation of 30 cm length of sugar solution = 6.5 degrees\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.39, Page 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "theta = 11.;  # Optical rotation of sugar solution, degrees\n",
      "l = 20;  # Length of the tube, cm\n",
      "S = 66;  # Specific rotation of sugar solution, degrees\n",
      "\n",
      "#Calculations\n",
      "c = theta*10/(l*S);    # The concentration of sugar solution, g/cc\n",
      "\n",
      "\n",
      "print \"The strength of the solution = %6.4f g/cc\"%c\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The strength of the solution = 0.0833 g/cc\n"
       ]
      }
     ],
     "prompt_number": 51
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.40, Page 316"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " #Variable declaration\n",
      "theta = 20;  # Optical rotation of sugar solution, degrees\n",
      "theta_prime = 35.;  # New optical rotation of sugar solution, degrees\n",
      "c = 5;  # Percentage concentration of the solution\n",
      "c_prime = 10;  # New percentage concentration of the solution\n",
      "l = 1;       # For simplicity assume length of the sugar solution to be unity\n",
      "\n",
      "#Calculations\n",
      "l_prime = theta_prime*l*c/(c_prime*theta);\n",
      "\n",
      "\n",
      "print \"The length of sugar solution for %d percent concentration and %d degrees optical rotation = %5.3f*l \"%(c_prime, theta_prime, l_prime)\n",
      "\n",
      "   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The length of sugar solution for 10 percent concentration and 35 degrees optical rotation = 0.875*l \n"
       ]
      }
     ],
     "prompt_number": 53
    }
   ],
   "metadata": {}
  }
 ]
}