{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 15: Quantum Mechanics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.1, Page 15.24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "E = 1000 # energy of electron in eV\n",
      "delta_x = 1e-10 # error in position in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "p = sqrt(2 * m * E * e)\n",
      "delta_p = h / (4 * pi * delta_x)\n",
      "P = (delta_p / p) * 100\n",
      "\n",
      "#Result\n",
      "print \"Percentage of uncertainty in momentum is %.1f%%\"%P"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of uncertainty in momentum is 3.1%\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.3, Page 15.25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "E = 500 # energy of electron in eV\n",
      "delta_x = 2e-10 # error in position in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "p = sqrt(2 * m * E * e)\n",
      "delta_p = h / (4 * pi * delta_x)\n",
      "P = (delta_p / p) * 100\n",
      "\n",
      "#Result\n",
      "print \"Percentage of uncertainty in momentum is %.2f%%\"%P"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Percentage of uncertainty in momentum is 2.18%\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.4, Page 15.25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "delta_lambda = 1e-6 # accuracy in wavelength of its one part\n",
      "lamda = 1e-10 # wavelength of x-ray in m\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_x = lamda / (4 * pi * delta_lambda)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainty in position is %.2f micrometer\"%(delta_x*10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainty in position is 7.96 micrometer\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.5, Page 15.26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "delta_x = 1e-10 # error in position in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_p = h / (4 * pi * delta_x)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainty in momentum is %.2e kg m/sec\"%delta_p"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainty in momentum is 5.27e-25 kg m/sec\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.6, Page 15.26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "M = 5.4e-26 # momentum of electron in kg-m/sec\n",
      "p = 0.05 # percentage accuracy in momentum\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_m = p * M / 100\n",
      "delta_x = h / (4 * pi * delta_m)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainty in position is %.3f micrometer\"%(delta_x * 10**6)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainty in position is 1.951 micrometer\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.7, Page 15.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "r = 0.53e-10 # radius of hydrogen atom in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_M = h / (4 * pi * r)\n",
      "delta_k = delta_M**2 / (2 * m)\n",
      "\n",
      "#Result\n",
      "print \"Minimum energy of electron is %.3e J\"%delta_k"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum energy of electron is 5.428e-19 J\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.8, Page 15.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "v = 5e3 # speed of electron in m/sec\n",
      "a = 0.003 # percentage accuracy in measurement of speed \n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_v = v * a / 100\n",
      "delta_p = m * delta_v\n",
      "delta_x = h / (4 * pi * delta_p)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainty in determining the position of electron is %.3e m\"%delta_x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainty in determining the position of electron is 3.859e-04 m\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.9, Page 15.27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "v = 6.6e4 # speed of electron in m/sec\n",
      "a = 0.01 # percentage accuracy in measurement of speed \n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.6e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_v = v * a / 100\n",
      "delta_p = m * delta_v\n",
      "delta_x = h / (4 * pi * delta_p)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainty in determining the position is %.2e m\"%delta_x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainty in determining the position is 8.74e-06 m\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.10, Page 15.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "v = 3e7 # speed of electron in m/sec \n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "c = 3e8 # speed of light in m/sec\n",
      "\n",
      "#Calculations\n",
      "delta_p = m * v / sqrt(1 - (v/c)**2)\n",
      "delta_x = h / (4 * pi * delta_p)\n",
      "\n",
      "#Result\n",
      "print \"Uncertainty in determining the position is %.2e m\"%delta_x"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Uncertainty in determining the position is 1.92e-12 m\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.11, Page 15.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "\n",
      "# Given \n",
      "t = 2.5e-14 # life time of hydrogen atom in exited state in sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_E = h / (4 * pi * t)\n",
      "\n",
      "#Result\n",
      "print \"Minimum error in measurement of the energy is %.2e J\"%delta_E"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum error in measurement of the energy is 2.11e-21 J\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.12, Page 15.28"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "t = 10**-8 # life time of atom in exited state in sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_f = 1 / (4 * pi * t)\n",
      "\n",
      "#Result\n",
      "print \"Minimum uncertainty in frequency is %.2e sec\"%delta_f"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Minimum uncertainty in frequency is 7.96e+06 sec\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.13, Page 15.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import pi\n",
      "\n",
      "# Given \n",
      "delta_x = 20e-10 # uncertainty in position in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "m_ = 1.67e-27 # mass of proton in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "delta_v1 = h / (4 * pi * m * delta_x)\n",
      "delta_v2 = h / (4 * pi * m_ * delta_x)\n",
      "r = delta_v2 / delta_v1\n",
      "\n",
      "#Result\n",
      "print \"Ratio of uncertainty in velocity of a proton and an electron is %.2e\"%r"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of uncertainty in velocity of a proton and an electron is 5.45e-04\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.14, Page 15.29"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "delta_x = 1e-10 # width of box in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "n = 1 # for n=1\n",
      "\n",
      "#Calculations\n",
      "E = (n**2 * h**2) / (8 * m * delta_x**2)\n",
      "n = 2 # for n=2\n",
      "E_ = (n**2 * h**2) / (8 * m * delta_x**2)\n",
      "\n",
      "#Result\n",
      "print \"Energy of electron - \\nFor (n=1) energy is %.2e J\\nFor (n=2) energy is %.2e J\"%(E,E_)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electron - \n",
        "For (n=1) energy is 6.02e-18 J\n",
        "For (n=2) energy is 2.41e-17 J\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.15, Page 15.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Given \n",
      "l = 1e-10 # width of box in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "n = 1 # for n=1\n",
      "\n",
      "#Calculations\n",
      "E = (n**2 * h**2) / (8 * m * l**2)\n",
      "n = 2 # for n=2\n",
      "E_ = (n**2 * h**2) / (8 * m * l**2)\n",
      "d = E_ - E\n",
      "\n",
      "#Result\n",
      "print \"Energy difference is %.2e J\"%d"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy difference is 1.81e-17 J\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.16, Page 15.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "l = 3e-10 # width of box in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "n = 1 # For n=1\n",
      "\n",
      "#Calculations\n",
      "E = (n**2 * h**2) / (8 * m * l**2)\n",
      "n = 2 # For n=2\n",
      "E_ = (n**2 * h**2) / (8 * m * l**2)\n",
      "n = 3 # For n=3\n",
      "E__ = (n**2 * h**2) / (8 * m * l**2)\n",
      "\n",
      "#Result\n",
      "print \"Energy of electron -\\nFor (n=1) is %.1e J\\nFor (n=2) is %.2e J\\nFor (n=3) is %.2e J\"%(E,E_,E__)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electron -\n",
        "For (n=1) is 6.7e-19 J\n",
        "For (n=2) is 2.68e-18 J\n",
        "For (n=3) is 6.02e-18 J\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.17, Page 15.30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "l = 2.5e-10 # width of box in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "n = 1 # for n=1\n",
      "E = (n**2 * h**2) / (8 * m * l**2)\n",
      "n = 2 # for n=2\n",
      "E_ = (n**2 * h**2) / (8 * m * l**2)\n",
      "\n",
      "#Result\n",
      "print \"Energy of electron -\\nFor (n=1) is %.2e J\\nFor (n=2) is %.3e J\"%(E,E_)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electron -\n",
        "For (n=1) is 9.63e-19 J\n",
        "For (n=2) is 3.853e-18 J\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.18, Page 15.31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "l = 1e-14 # width of box in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 1.67e-27 # mass of neutron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "n = 1 # for n=1\n",
      "E = (h**2) / (8 * m * l**2)\n",
      "\n",
      "#Result\n",
      "print \"Lowest energy of neutron confined in the nucleus is %.2e J\"%E"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Lowest energy of neutron confined in the nucleus is 3.28e-13 J\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.19, Page 15.31"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "l = 1e-10 # width of box in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.63e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "n = 1 # for n=1\n",
      "p1 = (n * h) / (2 * l)\n",
      "E = (n**2 * h**2) / (8 * m * l**2)\n",
      "n = 2 # for n=2\n",
      "p2 = (n * h) / (2 * l)\n",
      "E_ = (n**2 * h**2) / (8 * m * l**2)\n",
      "\n",
      "#Result\n",
      "print \"Energy of electron -\\nFor (n=1) is %.2e J\\nFor (n=2) is %.2e J\"%(E,E_)\n",
      "print \"\\nMomentum of electron -\\nFor (n=1) is %.3e kg-m/sec\\nFor (n=2) is %.2e kg-m/sec\"%(p1,p2)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy of electron -\n",
        "For (n=1) is 6.04e-18 J\n",
        "For (n=2) is 2.42e-17 J\n",
        "\n",
        "Momentum of electron -\n",
        "For (n=1) is 3.315e-24 kg-m/sec\n",
        "For (n=2) is 6.63e-24 kg-m/sec\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.20, Page 15.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "l = 1e-10 # length of box in m\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "n = 1 # for n=1\n",
      "E1 = (n**2 * h**2) / (8 * m * l**2)\n",
      "lambda1 =2*l\n",
      "n = 2 # for n=2\n",
      "E2 = (n**2 * h**2) / (8 * m * l**2)\n",
      "lambda2 =2*l/2\n",
      "n = 3 # for n=3\n",
      "E3 = (n**2 * h**2) / (8 * m * l**2)\n",
      "lambda3 =2*l/3\n",
      "\n",
      "#Results\n",
      "print \"Energy Eigen value of electron -\\nFor (n=1) is %.2e J\\nFor (n=2) is %.2e J\\nFor (n=3) is %.2e J\"%(E1,E2,E3)\n",
      "print \"\\nde-Broglie wavelength of electron -\\nFor (n=1) is %.f A\\nFor (n=2) is %.f A \\nFor (n=3) is %.3f A\"%(lambda1*1e10,lambda2*1e10,lambda3*1e10)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy Eigen value of electron -\n",
        "For (n=1) is 6.02e-18 J\n",
        "For (n=2) is 2.41e-17 J\n",
        "For (n=3) is 5.42e-17 J\n",
        "\n",
        "de-Broglie wavelength of electron -\n",
        "For (n=1) is 2 A\n",
        "For (n=2) is 1 A \n",
        "For (n=3) is 0.667 A\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.21, Page 15.32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "E1 = 3.2e-18 # minimum energy possible for a particle entrapped in a one dimensional box in J\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "E1 = E1 / e # in eV\n",
      "n = 2 # for n=2\n",
      "E2 = n**2 * E1\n",
      "n = 3 # for n=3\n",
      "E3 = n**2 * E1\n",
      "n = 4 # for n=4\n",
      "E4 = n**2 * E1\n",
      "\n",
      "#Result\n",
      "print \"Energy Eigen values -\\nFor (n=2) for %.f eV\\nFor (n=3) is %.f eV\\nFor (n=4) is %.f eV\"%(E2,E3,E4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Energy Eigen values -\n",
        "For (n=2) for 80 eV\n",
        "For (n=3) is 180 eV\n",
        "For (n=4) is 320 eV\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.22, Page 15.33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import *\n",
      "\n",
      "# Given \n",
      "l = 4e-10 # width of box in m\n",
      "E = 9.664e-17 # energy of electron in J\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "n = 1 # for n=1\n",
      "E1 = (n**2 * h**2) / (8 * m * l**2)\n",
      "N = sqrt(E / E1)\n",
      "p = ((N) * h) / (2 * l)\n",
      "\n",
      "#Result\n",
      "print \"Order of exited state is %d\\nMomentum of electron is %.2e kg-m/sec\"%(N,p)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Order of exited state is 16\n",
        "Momentum of electron is 1.33e-23 kg-m/sec\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15.23, Page 15.33"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "# Given \n",
      "l = 10e-10 # width of box containing electron in m\n",
      "E = 9.664e-17 # energy of electron in J\n",
      "M = 0.001 # mass of glass marble in kg\n",
      "l_ = 0.2 # width of box containing marble in m\n",
      "e = 1.6e-19 # charge on an electron in C\n",
      "m = 9.1e-31 # mass of electron in kg\n",
      "c = 3e8 # speed of light in m/sec\n",
      "h = 6.62e-34 # Planck constant in J-sec\n",
      "\n",
      "#Calculations\n",
      "# For electron\n",
      "n = 1 # for n=1\n",
      "E1 = (n**2 * h**2) / (8 * m * l**2)\n",
      "E2 = 2**2* E1\n",
      "E3 = 3**2 * E1\n",
      "# For glass marble\n",
      "E1_ = h**2/(8*M*l_**2)\n",
      "E2_ = 2**2 * E1_\n",
      "E3_ = 3**2 *E1_\n",
      "\n",
      "#Result\n",
      "print \"\\nEnergy levels of electron- \\nFor (n=1) is %.2e J\\nFor (n=2) is %.2e J\\n For (n=3) is %.2e J\"%(E1,E2,E3)\n",
      "print \"\\nEnergy levels of marble- \\nFor (n=1) is %.2e J\\nFor (n=2) is %.2e J\\nFor (n=3) is %.2e J\"%(E1_,E2_,E3_)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "\n",
        "Energy levels of electron- \n",
        "For (n=1) is 6.02e-20 J\n",
        "For (n=2) is 2.41e-19 J\n",
        " For (n=3) is 5.42e-19 J\n",
        "\n",
        "Energy levels of marble- \n",
        "For (n=1) is 1.37e-63 J\n",
        "For (n=2) is 5.48e-63 J\n",
        "For (n=3) is 1.23e-62 J\n"
       ]
      }
     ],
     "prompt_number": 25
    }
   ],
   "metadata": {}
  }
 ]
}