{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5:Quantum Mechanics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.1, Page number 5-5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 10**-2          #mass of object(kg)\n",
      "v = 1               #velocity(m/s)\n",
      "l = 1*10**-10       #wavelength(m)\n",
      "d = 10**-3          #distance travelled(m)\n",
      "\n",
      "#Calculations\n",
      "lamda = h/(m*v)\n",
      "\n",
      "v = h/(m*l)\n",
      "\n",
      "t1 = d/v\n",
      "t = t1/(365*24*60*60)\n",
      "\n",
      "#Results\n",
      "print \"de Brogile wavelength =\",round(lamda/1e-32,2),\"*10^-32 m\"\n",
      "print \"Velocity =\",round(v/1e-22,2),\"*10^-22 m/s(Calculation mistake in the textbook)\"\n",
      "print \"Distance travelled =\",round(t/1e+10,2),\"*10^10 years(Calculation mistake in the textbook)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "de Brogile wavelength = 6.63 *10^-32 m\n",
        "Velocity = 6.63 *10^-22 m/s(Calculation mistake in the textbook)\n",
        "Distance travelled = 4.78 *10^10 years(Calculation mistake in the textbook)\n"
       ]
      }
     ],
     "prompt_number": 57
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.2, Page number 5-6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "lamda = 1*10**-10   #wavelength(m)\n",
      "\n",
      "#calculation\n",
      "v = h/(m*lamda)\n",
      "\n",
      "#Result\n",
      "print \"Velocity =\",round(v/1e+6,2),\"*10^6 m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity = 7.29 *10^6 m/s\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.3, Page number 5-6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34     #Planck's constant(J-s)\n",
      "m = 9.1*10**-31      #mass of electron(kg)\n",
      "lamda = 5000*10**-10 #wavelength(m)\n",
      "\n",
      "#calculation\n",
      "E = (h**2/(2*m*lamda**2))/(1.6*10**-19)\n",
      "\n",
      "#Result\n",
      "print \"Kinetic energy =\",round(E/1e-6,5),\"*10^-6 eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Kinetic energy = 6.03804 *10^-6 eV\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.4, Page number 5-7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34      #Planck's constant(J-s)\n",
      "m = 1.676*10**-27     #mass of object(kg)\n",
      "E = 0.025*1.6*10**-19 #energy(J)\n",
      "\n",
      "#Calculation\n",
      "lamda = h/math.sqrt(2*m*E)\n",
      "\n",
      "#Result\n",
      "print \"Wavelength =\",round(lamda/1e-10,2),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength = 1.81 A\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.5, Page number 5-7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34      #Planck's constant(J-s)\n",
      "m = 9.1*10**-31       #mass of electron(kg)\n",
      "E = 120*1.6*10**-19   #energy(J)\n",
      "\n",
      "#Calculation\n",
      "lamda = h/math.sqrt(2*m*E)\n",
      "\n",
      "#Result\n",
      "print \"Wavelength =\",round(lamda/1e-10,2),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength = 1.12 A\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.6, Page number 5-7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 1.67*10**-27    #mass of neutron(kg)\n",
      "lamda = 1*10**-10   #wavelength(m)\n",
      "\n",
      "#calculation\n",
      "v = h/(m*lamda)\n",
      "\n",
      "E = (h**2/(2*m*lamda**2))/(1.6*10**-19)\n",
      "\n",
      "#Result\n",
      "print \"Velocity =\",round(v,2),\"m/s\"\n",
      "print \"Kinetic energy =\",round(E/1e-2,3),\"*10^-2 eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Velocity = 3970.06 m/s\n",
        "Kinetic energy = 8.225 *10^-2 eV\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.7, Page number 5-8"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 1               #mass of object(kg)\n",
      "v = 1               #velocity(m/s)\n",
      "V = 182             #potential differnce(V)\n",
      "\n",
      "#Calculation\n",
      "#Case i\n",
      "lamda = 12.27/math.sqrt(V)\n",
      "\n",
      "#Case ii\n",
      "l = h/(m*v)\n",
      "\n",
      "#Results\n",
      "print \"de Brogile wavelength for accelerated electron=\",round(lamda,2),\"A\"\n",
      "print \"de Brogile wavelength for object=\",l,\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "de Brogile wavelength for accelerated electron= 0.91 A\n",
        "de Brogile wavelength for object= 6.63e-34 A\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.8, Page number 5-9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "lamda = 10**-14     #wavelength(m)\n",
      "\n",
      "#Calculations\n",
      "p = h/lamda\n",
      "\n",
      "E = (p**2/(2*m))/(1.6*10**-13)\n",
      "\n",
      "#Results\n",
      "print \"Momentum =\",p,\"kg-m/s\"\n",
      "print \"Energy =\",round(E,2),\"MeV\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Momentum = 6.63e-20 kg-m/s\n",
        "Energy = 15095.09 MeV\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.9, Page number 5-10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "V = 3000            #potential differnce(V)\n",
      "\n",
      "#Calculation\n",
      "#Case i\n",
      "lamda = 12.27/math.sqrt(V)\n",
      "\n",
      "#Case ii\n",
      "p = h/(lamda*10**-10)\n",
      "\n",
      "#Case iii\n",
      "lamda_b = 1/(lamda*10**-10)\n",
      "\n",
      "#Case iv\n",
      "d = 2.04*10**-10  #m\n",
      "n = 1             #for first order\n",
      "theta = math.degrees(math.asin((n*lamda*10**-10)/(2*d)))\n",
      "\n",
      "#Results\n",
      "print \"Momentum =\",round(p/1e-23,2),\"*10^-23 kg-m/s\"\n",
      "print \"de Brogile wavelength =\",round(lamda,3),\"A\"\n",
      "print \"Wave number =\",round(lamda_b/1e+10,3),\"*10^10 /m\"\n",
      "print \"Bragg angle =\",round(theta,3),\"degrees\"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Momentum = 2.96 *10^-23 kg-m/s\n",
        "de Brogile wavelength = 0.224 A\n",
        "Wave number = 4.464 *10^10 /m\n",
        "Bragg angle = 3.147 degrees\n"
       ]
      }
     ],
     "prompt_number": 55
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.10, Page number 5-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "V = 10*10**3        #potential differnce(V)\n",
      "\n",
      "#Calculation\n",
      "lamda = 12.27/math.sqrt(V)\n",
      "\n",
      "p = h/(lamda*10**-10)\n",
      "\n",
      "#result\n",
      "print \"Wavelength =\",lamda,\"A\"\n",
      "print \"Momentum =\",round(p/1e-23,3),\"*10^-23 kg-m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength = 0.1227 A\n",
        "Momentum = 5.403 *10^-23 kg-m/s\n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.12, Page number 5-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 6.68*10**-27    #mass of particle(kg)\n",
      "E = 1.6*10**-16     #energy(J)\n",
      "\n",
      "#Calculations\n",
      "lamda = h/math.sqrt(2*m*E)\n",
      "\n",
      "v = h/(m*lamda)\n",
      "\n",
      "#Results\n",
      "print \"Wavelength =\",round(lamda/1e-13,3),\"*10^-13 A\"\n",
      "print \"Velocity =\",round(v/1e+5,2),\"*10^5 m/s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength = 4.535 *10^-13 A\n",
        "Velocity = 2.19 *10^5 m/s\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.13, Page number 5-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "c = 3*10**8         #velocity of light(m/s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "E = 1.6*10**-19     #energy(J)\n",
      "\n",
      "#Calculations\n",
      "lamda_ph = (h*c)/E            #wavelength of photon\n",
      " \n",
      "lamda_e = h/math.sqrt(2*m*E)  #wavelength of electron\n",
      "\n",
      "#Result\n",
      "print \"Wavelength of proton =\",round(lamda_ph/1e-6,3),\"*10^-6 m\"\n",
      "print \"Wavelength of electron =\",round(lamda_e/1e-10,3),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength of proton = 1.243 *10^-6 m\n",
        "Wavelength of electron = 12.286 A\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3.14, Page number 5-13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "c = 3*10**8         #velocity of light(m/s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "\n",
      "#Calculations\n",
      "E = m*c**2\n",
      "lamda = h/math.sqrt(2*m*E)\n",
      "\n",
      "#Result\n",
      "print \"de Brogile wavelength =\",round(lamda/1e-12,3),\"*10^-12 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "de Brogile wavelength = 1.717 *10^-12 m\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.1, Page number 5-26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "del_v = (0.01*400)/100\n",
      "\n",
      "#Calculation\n",
      "del_x = h/(4*math.pi*m*del_v)\n",
      "\n",
      "#Result\n",
      "print \"Accuracy =\",round(del_x/1e-3,2),\"mm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Accuracy = 1.45 mm\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.2, Page number 5-27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "del_x = 10*10**-9   #m\n",
      "E = 1.6*10**-16     #energy(J)\n",
      "\n",
      "#Calculation\n",
      "del_px = h/(4*math.pi*del_x)\n",
      "p = math.sqrt(2*m*E)\n",
      "per = (del_px/p)*100\n",
      "\n",
      "#Result\n",
      "print \"Percentage of uncertainity =\",round(per,4),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of uncertainity = 0.0309 %\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.3, Page number 5-27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "del_v = (0.01*4*10**5)/100\n",
      "\n",
      "#Calculation\n",
      "del_x = h/(4*math.pi*m*del_v)\n",
      "\n",
      "#Result\n",
      "print \"Accuracy =\",round(del_x/1e-6,2),\"*10^-6 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Accuracy = 1.45 *10^-6 m\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.4, Page number 5-27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "del_v = (1.88*10**6)/100\n",
      "\n",
      "#Calculation\n",
      "del_x = h/(4*math.pi*m*del_v)\n",
      "\n",
      "#Result\n",
      "print \"Precision =\",round(del_x/1e-9,3),\"*10^-9 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Precision = 3.084 *10^-9 m\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.5, Page number 5-28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 4*10**-7    #wavelength(m)\n",
      "c = 3*10**8         #velocity of light(m/s)\n",
      "del_l = 8*10**-15   #spectral width(m)\n",
      "\n",
      "#calculation\n",
      "del_t = lamda**2/(4*math.pi*c*del_l)\n",
      "\n",
      "#Result\n",
      "print \"Time spent by the elctrons =\",round(del_t/1e-9,3),\"*10^-9 s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time spent by the elctrons = 5.305 *10^-9 s\n"
       ]
      }
     ],
     "prompt_number": 44
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.6, Page number 5-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34      #Planck's constant(J-s)\n",
      "del_t = 1.4*10**-10   #time spent(s)\n",
      "\n",
      "#calculation\n",
      "E = (h/(4*math.pi*del_t))/(1.6*10**-19)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainity =\",round(E/1e-6,2),\"*10^-6 eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainity = 2.36 *10^-6 eV\n"
       ]
      }
     ],
     "prompt_number": 50
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7.7, Page number 5-29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "lamda = 546*10**-9  #wavelength(m)\n",
      "c = 3*10**8         #velocity of light(m/s)\n",
      "del_l = 10**-14     #spectral width(m)\n",
      "\n",
      "#calculation\n",
      "del_t = lamda**2/(4*math.pi*c*del_l)\n",
      "\n",
      "#Result\n",
      "print \"Time spent by the elctrons =\",round(del_t/1e-9,2),\"*10^-9 s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time spent by the elctrons = 7.91 *10^-9 s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15.1, Page number 5-41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "L = 2*10**-10       #width(m)\n",
      "\n",
      "#Calculation\n",
      "E1 = (h**2/(8*m*L**2))/(1.6*10**-19)\n",
      "E2 = 4*E1\n",
      "E3 = 9*E1\n",
      "\n",
      "#Result\n",
      "print \"Energy of electron in ground state =\",round(E1,3),\"eV\"\n",
      "print \"Energy of electron in first state =\",round(E2,3),\"eV\"\n",
      "print \"Energy of electron in second state =\",round(E3,3),\"eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electron in ground state = 9.434 eV\n",
        "Energy of electron in first state = 37.738 eV\n",
        "Energy of electron in second state = 84.91 eV\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15.2, Page number 5-42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "L = 5.6*10**-3      #width(m)\n",
      "\n",
      "#Calculation\n",
      "E = L/4\n",
      "\n",
      "#Result\n",
      "print \"Ground state energy =\",E,\"eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ground state energy = 0.0014 eV\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15.4, Page number 5-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import scipy\n",
      "from scipy import integrate\n",
      "\n",
      "#Variable declaration\n",
      "#Intervals\n",
      "x1 = 0\n",
      "x2 = 1./2\n",
      "\n",
      "#Calculation\n",
      "x = lambda x: 3*x**2\n",
      "P = integrate.quad(x, x1, x2)\n",
      "\n",
      "#Result\n",
      "print \"Probability =\",P[0]"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Probability = 0.125\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15.5, Page number 5-44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m1 = 9.1*10**-31    #mass of electron(kg)\n",
      "m2 = 10**-9         #mass of grain dust(kg)\n",
      "L1 = 10**-9         #width(m)\n",
      "L2 = 10**-4         #width(m)\n",
      "\n",
      "#Calculation\n",
      "#For electron\n",
      "print \"For an electron, the lowest thre energy states obtained for n=1,2 and 3 are\"\n",
      "for n in range(1,4):\n",
      "    En1 = ((n**2*h**2)/(8*m*L1**2))/(1.6*10**-19)\n",
      "    print round(En1,4),\"eV\"\n",
      "    \n",
      "#For the grain of dust\n",
      "print \"\\nFor a grain of dust, the lowest thre energy states obtained for n=1,2 and 3 are\"\n",
      "for n in range(1,4):\n",
      "    En2 = ((n**2*h**2)/(8*m2*L2**2))/(1.6*10**-19)\n",
      "    print round(En2/1e-32,3),\"eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For an electron, the lowest thre energy states obtained for n=1,2 and 3 are\n",
        "0.3774 eV\n",
        "1.5095 eV\n",
        "3.3964 eV\n",
        "\n",
        "For a grain of dust, the lowest thre energy states obtained for n=1,2 and 3 are\n",
        "3.434 eV\n",
        "13.737 eV\n",
        "30.907 eV\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15.6, Page number 5-45\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "E1 = 38*1.6*10**-19 #energy(J)\n",
      "\n",
      "#Calculation\n",
      "L = math.sqrt(h**2/(8*m*E1))\n",
      "              \n",
      "#Result\n",
      "print \"Width of well =\",round(L/1e-10,4),\"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Width of well = 0.9965 A\n"
       ]
      }
     ],
     "prompt_number": 48
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15.7, Page number 5-45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Variable declaration\n",
      "h = 6.63*10**-34    #Planck's constant(J-s)\n",
      "m = 9.1*10**-31     #mass of electron(kg)\n",
      "L = 5*10**-10       #width(m)\n",
      "n1 = 1\n",
      "n2 = 2\n",
      "c = 3*10**8         #velocity of light(m/s)\n",
      "\n",
      "#Calculation\n",
      "E = ((3*h**2)/(8*m*L**2))   #E2-E1\n",
      "Ev = E/(1.6-10**-19)        #J\n",
      "lamda = (h*c)/E\n",
      "\n",
      "#Result\n",
      "print \"Energy =\",round(Ev/1e-19,2),\"eV\"\n",
      "print \"Wavelength =\",round(lamda/1e-7,3),\"*10^-7 m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy = 4.53 eV\n",
        "Wavelength = 2.745 *10^-7 m\n"
       ]
      }
     ],
     "prompt_number": 55
    }
   ],
   "metadata": {}
  }
 ]
}