{ "metadata": { "name": "" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Chapter 2: Diffraction of Light" ] }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2.1, Page number 2-10" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "theta = 30 #angle(degrees)\n", "n = 1 \n", "lamda = 6500*10**-8 #wavelength(cm)\n", "\n", "#Calculations\n", "a = (n*lamda)/math.sin(theta*math.pi/180)\n", "\n", "#Result\n", "print \"a =\",a/1e-4,\"*10^-4 cm\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "a = 1.3 *10^-4 cm\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2.2, Page number 2-10" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "a = 6*10**-4 #width of slit(cm)\n", "n = 1 #first order\n", "lamda = 6000*10**-8 #wavelength(cm)\n", "\n", "#Calculations\n", "def deg_to_dms(deg):\n", " d = int(deg)\n", " md = abs(deg - d) * 60\n", " m = int(md)\n", " sd = (md - m) * 60\n", " sd=round(sd,2)\n", " return [d, m, sd]\n", "\n", "theta = (math.asin((n*lamda)/a))*180/math.pi\n", "d = 2*theta #angular seperation\n", "\n", "#Result\n", "print \"Angular seperation between the 1st order minima is\",deg_to_dms(d)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Angular seperation between the 1st order minima is [11, 28, 42.03]\n" ] } ], "prompt_number": 10 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2.3, Page number 2-11" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "n1 = 2 #for second minimum\n", "n2 = 3 #for third minimum\n", "lamda = 4000 #wavelength(A)\n", "\n", "#Calculations\n", "'''For 2nd order,\n", "a sin0 = n1*lamda\n", "\n", "For 3rd order,\n", "a sin0 = n2*lamda'''\n", "\n", "lamda = (n2*lamda)/n1\n", "\n", "#Result\n", "print \"Wavelength =\",lamda,\"A\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Wavelength = 6000 A\n" ] } ], "prompt_number": 11 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2.4, Page number 2-11" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "a = 0.16*10**-3 #width of slit(cm)\n", "n = 1 #first order\n", "lamda = 5600*10**-10 #wavelength(cm)\n", "\n", "#Calculations\n", "def deg_to_dms(deg):\n", " d = int(deg)\n", " md = abs(deg - d) * 60\n", " m = int(md)\n", " sd = (md - m) * 60\n", " sd=round(sd,2)\n", " return [d, m, sd]\n", "\n", "theta = (math.asin((n*lamda)/a))*180/math.pi\n", "\n", "\n", "#Result\n", "print \"Half angular width=\",deg_to_dms(theta)\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Half angular width= [0, 12, 1.93]\n" ] } ], "prompt_number": 22 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2.5, Page number 2-11" ] }, { "cell_type": "code", "collapsed": false, "input": [ "import math\n", "\n", "#Variable declaration\n", "a = 12*10**-5 #width of slit(cm)\n", "n = 1 #first order\n", "lamda = 6000*10**-8 #wavelength(cm)\n", "\n", "#Calculations\n", "theta = (math.asin((n*lamda)/a))*180/math.pi\n", "\n", "\n", "#Result\n", "print \"Half angular width=\",(theta),\"degrees\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Half angular width= 30.0 degrees\n" ] } ], "prompt_number": 30 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.2.6, Page number 2-12" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "a = 2*10**-6 #width of slit(cm)\n", "n = 1 #first order\n", "lamda = 6500*10**-10 #wavelength(cm)\n", "\n", "#Calculations\n", "theta = (math.asin((n*lamda)/a))*180/math.pi\n", "\n", "\n", "#Result\n", "print \"Angle theta =\",round(theta,2),\"degrees\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Angle theta = 18.97 degrees\n" ] } ], "prompt_number": 34 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.3.1, Page number 2-16" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "a = 0.16 #width(mm)\n", "b = 0.8 #distance(mm)\n", "\n", "#Calculations & Results\n", "m = ((a+b)/a)\n", "\n", "for n in range(1,4):\n", " print \"m =\",m*n\n", " \n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "m = 6.0\n", "m = 12.0\n", "m = 18.0\n" ] } ], "prompt_number": 48 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.1, Page number 2-24" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "lamda1 = 5*10**-5 #cm\n", "lamda2 = 7*10**-5 #cm\n", "a_plus_b = 1./4000 #cm\n", "\n", "#Calculations\n", "m_max1 = a_plus_b/lamda1\n", "m_max2 = round((a_plus_b/lamda2),1)\n", "\n", "#Results\n", "print m_max2,\"orders are visible for 7000 A and\",m_max1,\"orders for 5000 A and either\",m_max2,\",4 or\",m_max1,\"for intermediate wavelengths\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "3.6 orders are visible for 7000 A and 5.0 orders for 5000 A and either 3.6 ,4 or 5.0 for intermediate wavelengths\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.2, Page number 2-24" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "theta = 30 #angle of diffraction(degrees)\n", "lamda1 = 5400*10**-8 #cm\n", "lamda2 = 4050*10**-8 #cm\n", "\n", "#Calculations\n", "m = lamda2/(lamda1-lamda2)\n", "a_plus_b = (m*lamda1)/math.sin(theta*math.pi/180)\n", "N = 1/a_plus_b\n", "\n", "#Result\n", "print \"Number of lines per cm =\",round(N,2)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Number of lines per cm = 3086.42\n" ] } ], "prompt_number": 60 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.3, Page number 2-25" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "lamda = 4992 #A\n", "m1 = 3 #for 3rd order\n", "m2 = 4 #for 4th order\n", "\n", "#Calculations\n", "'''For m = 3,\n", "(a+b)sin0 = 3*lamda\n", "\n", "For m = 4,\n", "(a+b)sin0 = 4*lamda'''\n", "\n", "l = (m2*lamda)/m1\n", "\n", "#Results\n", "print \"Wavelength =\",l,\"A\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Wavelength = 6656 A\n" ] } ], "prompt_number": 62 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.4, Page number 2-25" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "lamda = 6328*10**-8 #wavelength(cm)\n", "m1 = 1\n", "m2 = 2\n", "a_plus_b = 1./6000 #cm\n", "\n", "#Calculations\n", "theta1 = math.asin((m1*lamda)/a_plus_b)*180/math.pi\n", "theta2 = math.asin((m2*lamda)/a_plus_b)*180/math.pi\n", "\n", "#Result\n", "print \"01 =\",round(theta1,2),\"degrees\"\n", "print \"02 =\",round(theta2,2),\"degrees\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "01 = 22.31 degrees\n", "02 = 49.41 degrees\n" ] } ], "prompt_number": 69 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.5, Page number 2-26" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "m = 2 #2nd order\n", "lamda = 5*10**-5 #wavelength(cm)\n", "theta = 30\n", "\n", "#Calculations\n", "a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)\n", "N = 1/a_plus_b\n", "\n", "#Result\n", "print \"The number of lines/cm of the grating surface is\",N" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The number of lines/cm of the grating surface is 5000.0\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.6, Page number 2-26" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "m = 3 #3rd order\n", "a_plus_b = 1./7000 #no. of lines/cm\n", "sin0 = 1\n", "\n", "#Calculation\n", "lamda = (a_plus_b*sin0)/m\n", "\n", "#Result\n", "print \"Wavelength =\",round(lamda/1e-8),\"A\"\n" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Wavelength = 4762.0 A\n" ] } ], "prompt_number": 7 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.7, Page number 2-26" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "m = 1 #1st order\n", "lamda = 6560*10**-8 #wavelength(cm)\n", "theta = 16+12./60\n", "\n", "#Calculations\n", "a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)\n", "N = 1/a_plus_b\n", "w = 2*N\n", "\n", "#Result\n", "print \"The total number of lines is\",round(w)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The total number of lines is 8506.0\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.8, Page number 2-27" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "m = 1 #1st order\n", "lamda = 6.56*10**-5 #wavelength(cm)\n", "theta = 18+14./60\n", "\n", "#Calculations\n", "a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)\n", "N = 1/a_plus_b\n", "w = 2*N\n", "\n", "#Result\n", "print \"The total number of lines is\",round(w,1)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The total number of lines is 9539.3\n" ] } ], "prompt_number": 3 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.9, Page number 2-27" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "lamda = 6*10**-5 #wavelength(cm)\n", "a_plus_b = 1./5000 #cm\n", "\n", "#Calculations\n", "m_max = a_plus_b/lamda\n", "\n", "#Result\n", "print \"Order =\",round(m_max)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Order = 3.0\n" ] } ], "prompt_number": 2 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.10, Page number 2-28" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Variable declaration\n", "lamda = 6000*10**-8 #wavelength(cm)\n", "a_plus_b = 1./5000 #cm\n", "\n", "#Calculations\n", "m_max = a_plus_b/lamda\n", "\n", "#Result\n", "print \"m_max =\",round(m_max)\n", "\n", "#The rest of the solution is theoretical" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "m_max = 3.0\n" ] } ], "prompt_number": 4 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.4.11, Page number 2-28" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Variable declaration\n", "m = 1 #1st order\n", "lamda = 5790*10**-8 #wavelength(cm)\n", "theta = 19.994\n", "\n", "#Calculations\n", "a_plus_b = (m*lamda)/math.sin(theta*math.pi/180)\n", "N = 1/a_plus_b\n", "w = 2.54*N\n", "\n", "#Result\n", "print \"The total number of lines is\",round(w)" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The total number of lines is 15000.0\n" ] } ], "prompt_number": 5 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6.1, Page number 2-31" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Varaible declaration\n", "n = 3000./0.5 #no. of lines per cm\n", "m = 2 #for 2nd order\n", "lamda1 = 5893*10**-8 #wavelength(cm)\n", "lamda2 = 5896*10**-8 #wavelength(cm)\n", "\n", "#Calculations\n", "a_plus_b = 1/n\n", "theta1 = math.degrees(math.asin((2*lamda1)/(a_plus_b)))\n", "theta2 = math.degrees(math.asin((2*lamda2)/(a_plus_b)))\n", "d = theta2-theta1 #angular seperation\n", "N = lamda1*10**8/(m*3)\n", "\n", "#Result\n", "print \"Since N=\",round(N),\"which is smaller than 3000 lines, the two lines will be resolved in the second order\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Since N= 982.0 which is smaller than 3000 lines, the two lines will be resolved in the second order\n" ] } ], "prompt_number": 13 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6.2, Page number 2-32" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Varaible declaration\n", "m = 3 #for 3rd order\n", "lamda = 481 #wavelength(nm)\n", "n = 620 #no. of ruling per mm\n", "w = 5.05 #width(mm)\n", "\n", "#Calculations\n", "N = n*w\n", "dl = lamda/(m*N)\n", "\n", "#Result\n", "print \"Smallest wavelength interval =\",round(dl,4),\"nm\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Smallest wavelength interval = 0.0512 nm\n" ] } ], "prompt_number": 15 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6.3, Page number 2-33" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "import math\n", "\n", "#Varaible declaration\n", "m = 2 #for 2nd order\n", "lamda = 5890 #wavelength(A)\n", "dl = 6 #A\n", "n = 500. #no. of lines per cm\n", "\n", "#Calculations\n", "N = lamda/(dl*m)\n", "W = N/n\n", "\n", "#Result\n", "print \"Least width =\",W,\"cm\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Least width = 0.98 cm\n" ] } ], "prompt_number": 17 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6.4, Page number 2-33" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Varaible declaration\n", "N = 3*5000 #no. of lines per cm\n", "a_plus_b = 1./5000 #cm\n", "lamda = 5890*10**-8 #wavelength(cm)\n", "\n", "#Calculations\n", "m_max = round(a_plus_b/lamda)\n", "RP = m_max*N\n", "\n", "#Result\n", "print \"Maximum value of resolving power =\",RP" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Maximum value of resolving power = 45000.0\n" ] } ], "prompt_number": 24 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6.5, Page number 2-34" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Varaible declaration\n", "m = 2 #for 2nd order\n", "lamda = 5890 #wavelength(A)\n", "dl = 6 #A\n", "w = 3. #width of a line(cm)\n", "\n", "#Calculations\n", "lamda2 = lamda+dl\n", "N = lamda/(dl*m)\n", "\n", "a_plus_b = w/N\n", "\n", "#Results\n", "print \"The minimum no. of lines a grating must have is\",N\n", "print \"The grating element is\",round(a_plus_b/1e-3,2),\"*10^-3 cm\"" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "The minimum no. of lines a grating must have is 490\n", "The grating element is 6.12 *10^-3 cm\n" ] } ], "prompt_number": 28 }, { "cell_type": "heading", "level": 2, "metadata": {}, "source": [ "Example 2.6.6, Page number 2-34" ] }, { "cell_type": "code", "collapsed": false, "input": [ "\n", "#Varaible declaration\n", "N = 40000 #no. of lines per cm\n", "m = 2 #for 2nd order\n", "\n", "#Calculations\n", "RP = m*N\n", "\n", "#Result\n", "print \"Maximum value of resolving power =\",RP" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "Maximum value of resolving power = 80000\n" ] } ], "prompt_number": 29 } ], "metadata": {} } ] }