{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9: Quantum Physics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.1, Page 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "e = 1.602e-19; # Charge of electron in Coloumb\n",
      "lamda = 2e-10; # Wavelength of a photon in meters\n",
      "h = 6.62e-34; # Planc's constant in Joule second\n",
      "c = 3.e8; # Velocity og light in air in meter per second\n",
      "\n",
      "#Calculations\n",
      "E = (h*c)/(lamda*e);#Thermal conductivity of Ni\n",
      "p = h/lamda;#The momentum of photon \n",
      "\n",
      "#Results\n",
      "print 'The energy of photon is ',round(E,3),'eV' #Incorrect answer in textbook\n",
      "print 'The momentum of photon is ',p,'(kg.m)/s'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The energy of photon is  6198.502 eV\n",
        "The momentum of photon is  3.31e-24 (kg.m)/s\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.2, Page 280"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "h = 6.62e-34; # Planck's constant J.s\n",
      "v = 440e3; # Operating frequency of radio in Hertz\n",
      "P = 20e3 ; # Power of radio transmitter in Watts\n",
      "\n",
      "#Calculation\n",
      "n = P/(h*v);# Let n be the number of photons emitted per second\n",
      "\n",
      "#Result\n",
      "print 'Number of photon emitted per second is ',round(n/1e30,2),'*10^30'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of photon emitted per second is  68.66 *10^30\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.3, Page 280"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "h = 6.62e-34; # Planck's constant in J.s\n",
      "c = 3e8; # Velocity of ligth in air\n",
      "t = 18000; # Time of glow - (5*3600) in seconds\n",
      "P = 30 #Power in watts\n",
      "lamda = 5893e-10; # Wavelength of emitted ligth in meters\n",
      "\n",
      "#calculations\n",
      "E = (h*c)/lamda; # Energy of a photon\n",
      "n = (P*t)/E; # let n be the number of photons emitted in 5 hours\n",
      "\n",
      "#Result\n",
      "print 'Number of photons emitted in 5 hours is',round(n/1e24,3),'*10^24'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Number of photons emitted in 5 hours is 1.602 *10^24\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.4, Page 287"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos\n",
      "\n",
      "#Varaible declaration\n",
      "h = 6.62*1e-34; # Plancl's constant in J.s\n",
      "c = 3*1e8; # Velocity of light in vacccum in m/s \n",
      "m = 9.1*1e-31; # Mass of electron in Kg\n",
      "l = 0.7078*1e-10 # Wavelength in meter\n",
      "theta = 90;\n",
      "\n",
      "#Calculations\n",
      "delta = (h*(1-round(cos(theta)))/(m*c));\n",
      "Nlambda = l + delta;\n",
      "\n",
      "#Result\n",
      "print 'The wavelength of scattered X-rays is %.4f A'%(Nlambda/1e-10)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of scattered X-rays is 0.7320 A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.5, Page 287"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos,degrees,radians\n",
      "\n",
      "#Varaible declaration\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in J.s\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "lamda = 1.8e18; # Frequency of the incident rays\n",
      "theta = 180;#angle in degree\n",
      "\n",
      "#Calculations\n",
      "lamda = c/lamda;\n",
      "delta = (h*(1-cos(radians(theta))))/(m*c);\n",
      "Nlambda = lamda+delta;#'Wavelength of scattered X-rays\n",
      "\n",
      "#Result\n",
      "print 'Wavelength of scattered X-rays is %.4f A'%(Nlambda/1e-10)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength of scattered X-rays is 1.7152 A\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.6, Page 288"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos\n",
      "\n",
      "#Varaible declaration\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "lamda = 1.12e-10; # Wavelength of light in meters\n",
      "theta = 90;\n",
      "\n",
      "#Calculations\n",
      "delta = (h*(1-round(cos(theta))))/(m*c);\n",
      "Nlambda = lamda + delta;#The wavelength of scattered X-rays \n",
      "E = (h*c)*((1/lamda)-(1/Nlambda)) ;#Energy of electron\n",
      "\n",
      "#Results\n",
      "print 'The wavelength of scattered X-rays is %.3f A'%(Nlambda/1e-10)\n",
      "print 'Energy of electron is %.2f *10^-17 J'%(E/1e-17)\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength of scattered X-rays is 1.144 A\n",
        "Energy of electron is 3.76 *10^-17 J\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Exampe 9.7, Page 289"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos,radians\n",
      "\n",
      "#Varaible declaration\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "lamda = 0.03e-10; # Wavelength of light in meters\n",
      "theta = 60;#angle in degrees\n",
      "\n",
      "#Calculations\n",
      "delta = (h*(1-cos(radians(theta))))/(m*c);\n",
      "Nlambda = lamda + delta;\n",
      "E = ((h*c)*((1./lamda)-(1./Nlambda)))/1.6e-19 ;#Energy of recoiling electron\n",
      "\n",
      "#Result\n",
      "print 'Energy of recoiling electron is %.3f MeV'%(E/1e+6)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of recoiling electron is 0.119 MeV\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Eample 9.8, Page 289"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos,radians\n",
      "\n",
      "#Varaible declaration\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "lamda = 0.5e-10; # Wavelength of light in meters\n",
      "theta = 90;\n",
      "\n",
      "#Calculations\n",
      "delta = (h*(1-cos(radians(theta))))/(m*c);\n",
      "Nlambda = lamda + delta;\n",
      "E = (h*c)*((1./lamda)-(1./Nlambda)) ;\n",
      "\n",
      "#Result\n",
      "print 'Energy of electron is %.2f *10^-16 J'%(E/1e-16)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electron is 1.84 *10^-16 J\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.9, Page 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "lamda = 1.5e-10; # Wavelength of light in meters\n",
      "E = 0.5e-16; # Energy of electron in J \n",
      "\n",
      "#Calculation\n",
      "Nlambda = ((h*c)/lamda)-E;#'Energy of scattered electron\n",
      "\n",
      "#Result\n",
      "print 'Energy of scattered electron is %.2f *10^-16 J'%(Nlambda/1e-16)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of scattered electron is 12.74 *10^-16 J\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.10, Page 290"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import cos,radians\n",
      "\n",
      "#Varaible declaration\n",
      "lamda=0.022*1e-10;#wavelength in meters\n",
      "th=45;#angle in degree\n",
      "m=9.1*1e-31;\n",
      "c=3*1e8;#velocity of light in free space\n",
      "h=6.62*1e-34;#planck's constant\n",
      "\n",
      "#Calculations&Results\n",
      "x=cos(th);\n",
      "dlamda=h*(1-cos(radians(th)))/(m*c);#delta lemda \n",
      "print 'delta lemda is= %.3f A'%(dlamda/1e-10)\n",
      "lamda1=lamda-dlamda;#wavelength of incident X-rays\n",
      "print 'wavelength of incident X-rays %.3f A'%(lamda1/1e-10)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "delta lemda is= 0.007 A\n",
        "wavelength of incident X-rays 0.015 A\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.11, Page 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "a = 1e-10 # Width of box in meter\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "n = 1; # Single electron\n",
      "\n",
      "#Calculation\n",
      "E = (n**2 * h**2)/(8*m*a**2*1.6e-19);\n",
      "\n",
      "#Result\n",
      "print'Energy of electrons is %.1f n^2 eV'%E\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electrons is 37.6 n^2 eV\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.12, Page 314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "a = 1e-10 # Width of box in meter\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "n = 1; # Single electron\n",
      "\n",
      "#Calculations\n",
      "E = (h**2)/(8*m*a**2);#Energy of in lower level\n",
      "p = h/(2*a);#Momentum \n",
      "\n",
      "#Results\n",
      "print 'Energy of in lower level %.f *10^-18 J'%(E/1e-18)\n",
      "print'Momentum is %.2f *10^-24 (kg.m)/s'%(p/1e-24)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of in lower level 6 *10^-18 J\n",
        "Momentum is 3.31 *10^-24 (kg.m)/s\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.13, Page 315"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "a = 0.2e-9 # Width of box in meter\n",
      "m = 9.1e-31; # Mass of electron in kg\n",
      "h = 6.62e-34; # Planck's constant in Js\n",
      "c = 3e8; # Velocity of light in vaccum\n",
      "E5 = 230*1.6e-19 #  Energy of a particle in Volts in 5th antinode\n",
      "n = 5;\n",
      "\n",
      "#Calculations\n",
      "E1 = E5/(n**2);\n",
      "m = (h**2)/(8*E1*a**2);#Mass of electron \n",
      "\n",
      "#Result\n",
      "print 'Mass of electron is %.2f *10^-31 kg'%(m/1e-31)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of electron is 9.30 *10^-31 kg\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.14, Page 316"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "n = 1; # Single particle\n",
      "a = 50e-10; # Width of box in meter\n",
      "deltax = 10e-10; # Intervel between particle\n",
      "\n",
      "#Calculations\n",
      "p = (2/a)*deltax;#The probability of finding the particle\n",
      "\n",
      "#Result\n",
      "print 'The probability of finding the particle is %.1f'%p\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The probability of finding the particle is 0.4\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.15, Page 316"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "\n",
      "#Varaible declaration\n",
      "h = 6.62*1e-34; # Planck's constant\n",
      "m = 1e-9; # Mass of particle in kg\n",
      "t = 100; #Time reqired by the particle to cross 1 mm distance\n",
      "a = 1e-3 ; # Width of box in m\n",
      "v = 1e-5; # Velocity of particle in m/s\n",
      "\n",
      "#Calculations\n",
      "E = (0.5*m*v**2);\n",
      "n = sqrt(8*m*a**2*E/(h**2));#The quantum state\n",
      "\n",
      "#Result\n",
      "print 'The quantum state is %.f*10^16 '%(n/1e+16)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quantum state is 3*10^16 \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9.16, Page 317"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Varaible declaration\n",
      "h = 6.62e-34; # Planck's constant in J.s\n",
      "m = 9.1e-31 # Mass of electron in kg\n",
      "nk =1;\n",
      "nl = 1;\n",
      "nm = 1;\n",
      "a = 0.5e-10 # Width of cubical box in meter\n",
      "\n",
      "#Calculation\n",
      "E = (h**2*(nk**2+nl**2+nm**2))/(8*m*a**2*1.6e-19);#The lowest energy level will have energy\n",
      "\n",
      "#Result\n",
      "print 'The lowest energy level will have energy %.f eV'%E\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The lowest energy level will have energy 451 eV\n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}