{
 "metadata": {
  "name": "",
  "signature": "sha256:8884b20a8f08880d4a94501a9f3a466664f30ca1f04c541fe7d3a232f87a24bc"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "6: Quantum mechanics of simple systems"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.1, Page number 90"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from scipy.integrate import quad\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "a=2*10**-10;    #length of square well(m)\n",
      "\n",
      "#Calculation\n",
      "def intg(x):\n",
      "    return (2/a)*(math.sin(math.pi*x/a))**2\n",
      "\n",
      "S=quad(intg,0,0.25*10**-10)[0]     #probability of finding the electron\n",
      "\n",
      "#Result\n",
      "print \"probability of finding the electron is\",round(S,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "probability of finding the electron is 0.0125\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.2, Page number 96"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "h=6.626*10**-34;    #planck's constant(Js)\n",
      "new0=6.43*10**13;   #frequency(Hz)\n",
      "e=1.6*10**-19;   #conversion factor from J to eV\n",
      "mew=1.1385*10**-26;     #reduced mass(kg)\n",
      "\n",
      "#Calculation\n",
      "E0=h*new0/2;   #zero point energy(J)\n",
      "E0=E0/e;   #zero point energy(eV)\n",
      "k=4*math.pi**2*new0**2*mew;   #force constane(N/m)\n",
      "\n",
      "#Result\n",
      "print \"zero point energy is\",round(E0,3),\"eV\"\n",
      "print \"force constane is\",round(k),\"N/m\"\n",
      "print \"answer varies due to rounding off errors\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "zero point energy is 0.133 eV\n",
        "force constane is 1858.0 N/m\n",
        "answer varies due to rounding off errors\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.6, Page number 104"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "m1=19.9217*10**-27;    #mass of carbon atom(kg)\n",
      "m2=26.5614*10**-27;    #mass of oxygen atom(kg)\n",
      "r=1.131*10**-10;   #separation(m)\n",
      "hbar=1.054*10**-34;\n",
      "e=1.6*10**-19;   #conversion factor from J to eV\n",
      "\n",
      "#Calculation\n",
      "mew=(m1*m2)/(m1+m2);    #reduced mass(kg)\n",
      "I=mew*r**2;    \n",
      "deltaE=hbar**2/I;    #energy difference(J)\n",
      "deltaE=deltaE/e;     #energy difference(eV)\n",
      "\n",
      "#Result\n",
      "print \"energy difference is\",round(deltaE*10**4,2),\"*10**-4 eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "energy difference is 4.77 *10**-4 eV\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 6.7, Page number 105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "m1=1;\n",
      "m2=0;\n",
      "m3=-1;     #m-components\n",
      "l=1;\n",
      "\n",
      "#Calculation\n",
      "L=math.sqrt(l*(l+1));    #length of vector\n",
      "theta1=math.acos(m1/L);   #orientation for m=1(radian)\n",
      "theta1=theta1*180/math.pi;   #orientation for m=1(degrees)\n",
      "theta2=math.acos(m2/L);   #orientation for m=0(radian)\n",
      "theta2=theta2*180/math.pi;   #orientation for m=0(degrees)\n",
      "theta3=math.acos(m3/L);   #orientation for m=-1(radian)\n",
      "theta3=theta3*180/math.pi;   #orientation for m=-1(degrees)\n",
      "\n",
      "#Result\n",
      "print \"orientation for m=1 is\",theta1,\"degrees\"\n",
      "print \"orientation for m=0 is\",theta2,\"degrees\"\n",
      "print \"orientation for m=-1 is\",theta3,\"degrees\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "orientation for m=1 is 45.0 degrees\n",
        "orientation for m=0 is 90.0 degrees\n",
        "orientation for m=-1 is 135.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 22
    }
   ],
   "metadata": {}
  }
 ]
}