{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#3(B):Principles of Quantum Mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.1, Page number 3.41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Velocity = 1.38 *10**6 m/s\n",
      "Wavelength = 0.00286 Angstorm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "KE=10             #Kinetic Energy of neutron in keV\n",
    "m=1.675*10**-27\n",
    "h=6.625*10**-34\n",
    "#Calculations\n",
    "KE=10**4*1.6*10**-19      #in joule\n",
    "v=((2*KE)/m)**(1/2)       #derived from KE=1/2*m*v**2\n",
    "lamda=h/(m*v)\n",
    "#Results\n",
    "print\"Velocity =\",round(v/10**6,2),\"*10**6 m/s\"\n",
    "print\"Wavelength =\",round(lamda*10**10,5),\"Angstorm\"\n",
    "                        "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.2, Page number 3.41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Momentum 2.4133\n",
      "de Brolie wavelength = 2.73 *10**-11 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "E=2*1000*1.6*10**-19       #in joules\n",
    "m=9.1*10**-31\n",
    "h=6.6*10*10**-34\n",
    "\n",
    "#Calculations\n",
    "p=math.sqrt(2*m*E)\n",
    "lamda= h/p\n",
    "\n",
    "#Result\n",
    "print\"Momentum\",round(p*10**23,4)\n",
    "print\"de Brolie wavelength =\",round(lamda*10**10,2),\"*10**-11 m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.3, Page number 3.41"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength = 1.807 Angstorm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "M=1.676*10**-27             #Mass of neutron\n",
    "m=0.025\n",
    "v=1.602*10**-19\n",
    "h=6.62*10**-34\n",
    "\n",
    "#Calculations\n",
    "mv=(2*m*v)**(1/2)\n",
    "lamda=h/(mv*M**(1/2))\n",
    "\n",
    "#Result\n",
    "print\"wavelength =\",round(lamda*10**10,3),\"Angstorm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.4, Page number 3.42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wavelength = 0.1226 Angstorm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=10000\n",
    "\n",
    "#Calculation\n",
    "lamda=12.26/math.sqrt(V)\n",
    "\n",
    "#Result\n",
    "print\"Wavelength =\",lamda,\"Angstorm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.5, Page number 3.42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The permitted electron energies = 38.0 *n**2 eV\n",
      "E1= 38.0 eV\n",
      "E2= 151.0 eV\n",
      "E3= 339.0 eV\n",
      "#Answer varies due to rounding of numbers\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;   #charge of electron(coulomb)\n",
    "L=10**-10            #1Angstrom=10**-10 m\n",
    "n1=1;\n",
    "n2=2;\n",
    "n3=3;\n",
    "h=6.626*10**-34\n",
    "m=9.1*10**-31\n",
    "L=10**-10\n",
    "\n",
    "#Calculations\n",
    "E1=(h**2)/(8*m*L**2*e)\n",
    "E2=4*E1\n",
    "E3=9*E1\n",
    "#Result\n",
    "print\"The permitted electron energies =\",round(E1),\"*n**2 eV\"\n",
    "print\"E1=\",round(E1),\"eV\"\n",
    "print\"E2=\",round(E2),\"eV\"\n",
    "print\"E3=\",round(E3),\"eV\"\n",
    "print\"#Answer varies due to rounding of numbers\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.6, Page number 3.42"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "si**2 delta(x)= 0.2\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "i=1*10**-10;    #interval\n",
    "L=10*10**-10;   #width\n",
    "\n",
    "#Calculations\n",
    "si2=2*i/L;\n",
    "\n",
    "#Result\n",
    "print\"si**2 delta(x)=\",si2"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.7, Page number 3.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " E1 = 1.81 *10**-37 Joule\n",
      "E2 = 3.62 *10**-37 Joule\n",
      "E2-E1 = 1.81 *10**-37 J\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "nx=1\n",
    "ny=1\n",
    "nz=1\n",
    "a=1\n",
    "h=6.63*10**-34\n",
    "m=9.1*10**-31\n",
    "\n",
    "#Calculations\n",
    "E1=h**2*(nx**2+ny**2+nz**2)/(8*m*a**2)\n",
    "E2=(h**2*6)/(8*m*a**2)             #nx**2+ny**2+nz**2=6\n",
    "diff=E2-E1\n",
    "#Result\n",
    "print\"E1 =\",round(E1*10**37,2),\"*10**-37 Joule\"\n",
    "print\"E2 =\",round(E2*10**37,2),\"*10**-37 Joule\"\n",
    "print\"E2-E1 =\",round(diff*10**37,2),\"*10**-37 J\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 3.8, Page number 3.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "E1 = 3.28 *10**-13 J\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=1.67*10**-27\n",
    "a=10**-14\n",
    "h=1.054*10**-34\n",
    "\n",
    "#Calculations\n",
    "E1=(1*math.pi*h)**2/(2*m*a**2)\n",
    "\n",
    "#Result\n",
    "print\"E1 =\",round(E1*10**13,2),\"*10**-13 J\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "#Example number 3.9, Page number 3.44"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a= 0.0158\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "from scipy.integrate import quad\n",
    "#Variable declarations\n",
    "k=1;\n",
    "\n",
    "#Calculations\n",
    "def zintg(x):\n",
    "    return 2*k*math.exp(-2*k*x)\n",
    "a=quad(zintg,2/k,3/k)[0]\n",
    "\n",
    "#Result\n",
    "print \"a=\",round(a,4)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}