{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 6: Principles of quantum mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.1, Page number 6.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 1.323 *10**-14 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "c=3*10**8;     #velocity of light(m/s)\n",
    "m=1.67*10**-27;     #mass of proton(kg)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "\n",
    "#Calculation\n",
    "lamda=h*10/(m*c);     #de broglie wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda*10**14,3),\"*10**-14 m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.2, Page number 6.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.613 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=400;    #voltage(V)\n",
    "\n",
    "#Calculation\n",
    "lamda=12.26/math.sqrt(V);      #de broglie wavelength(angstrom)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",lamda,\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.3, Page number 6.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.181 nm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=1.674*10**-27;     #mass of proton(kg)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "E=0.025*1.6*10**-19;    #energy(J)\n",
    "\n",
    "#Calculation\n",
    "lamda=h/math.sqrt(2*m*E);     #de broglie wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda*10**9,3),\"nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.4, Page number 6.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.3065 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=1600;    #voltage(V)\n",
    "\n",
    "#Calculation\n",
    "lamda=12.26/math.sqrt(V);      #de broglie wavelength(angstrom)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",lamda,\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.5, Page number 6.14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in momentum is 5.27 *10**-24 kg m/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "deltax=0.2*10**-10;      #distance(m)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "\n",
    "#Calculation\n",
    "deltap=h/(2*math.pi*deltax);    #uncertainity in momentum(kg m/s)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in momentum is\",round(deltap*10**24,2),\"*10**-24 kg m/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.6, Page number 6.21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lowest energy of electron is 112.9 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=n2=n3=1;\n",
    "h=6.62*10**-34;    #planck's constant\n",
    "m=9.1*10**-31;     #mass(kg)\n",
    "L=0.1*10**-9;      #side(m) \n",
    "\n",
    "#Calculation\n",
    "E1=h**2*(n1**2+n2**2+n3**2)/(8*m*1.6*10**-19*L**2);    #lowest energy of electron(eV)\n",
    "\n",
    "#Result\n",
    "print \"lowest energy of electron is\",round(E1,1),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.7, Page number 6.22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lowest energy of electron is 1.208 *10**4 eV\n",
      "value of E112, E121, E211 is 2.4168 *10**4 eV\n",
      "value of E122, E212, E221 is 3.625 *10**4 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n1=n2=n3=1;\n",
    "h=6.62*10**-34;    #planck's constant\n",
    "m=8.5*10**-31;     #mass(kg)\n",
    "L=10**-11;      #side(m) \n",
    "\n",
    "#Calculation\n",
    "E111=h**2*(n1**2+n2**2+n3**2)/(8*m*1.6*10**-19*L**2);    #lowest energy of electron(eV)\n",
    "E112=6*h**2/(8*m*1.6*10**-19*L**2);      #value of E112(eV)\n",
    "E121=E112;      #value of E121(eV)\n",
    "E211=E112;      #value of E211(eV)\n",
    "E122=9*h**2/(8*m*1.6*10**-19*L**2);     #value of E122(eV)\n",
    "E212=E122;      #value of E212(eV)\n",
    "E221=E122;      #value of E221(eV)\n",
    "\n",
    "#Result\n",
    "print \"lowest energy of electron is\",round(E111/10**4,3),\"*10**4 eV\"\n",
    "print \"value of E112, E121, E211 is\",round(E121/10**4,4),\"*10**4 eV\"\n",
    "print \"value of E122, E212, E221 is\",round(E122/10**4,3),\"*10**4 eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.8, Page number 6.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.0275 nm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=9.1*10**-31;     #mass of electron(kg)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "E=2000*1.6*10**-19;    #energy(J)\n",
    "\n",
    "#Calculation\n",
    "lamda=h/math.sqrt(2*m*E);     #de broglie wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda*10**9,4),\"nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.9, Page number 6.23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lowest energy of electron is 0.377 *10**-18 joule\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=9.1*10**-31;     #mass of electron(kg)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "n=1;\n",
    "L=4*10**-10;      #side(m) \n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*L**2);    #lowest energy of electron(joule)\n",
    "\n",
    "\n",
    "#Result\n",
    "print \"lowest energy of electron is\",round(E1*10**18,3),\"*10**-18 joule\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.10, Page number 6.24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "lowest energy of electron is 0.6031 *10**-17 joule\n",
      "energy of electron in 1st state is 2.412 *10**-17 joule\n",
      "energy of electron in 2nd state is 5.428 *10**-17 joule\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=9.1*10**-31;     #mass of electron(kg)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "n1=1;\n",
    "n2=2;\n",
    "n3=3;\n",
    "L=1*10**-10;      #side(m) \n",
    "\n",
    "#Calculation\n",
    "E1=n1**2*h**2/(8*m*L**2);    #lowest energy of electron(joule)\n",
    "E2=n2**2*h**2/(8*m*L**2);    #energy of electron in 1st state(joule)\n",
    "E3=n3**2*h**2/(8*m*L**2);    #energy of electron in 2nd state(joule)\n",
    "\n",
    "#Result\n",
    "print \"lowest energy of electron is\",round(E1*10**17,4),\"*10**-17 joule\"\n",
    "print \"energy of electron in 1st state is\",round(E2*10**17,3),\"*10**-17 joule\"\n",
    "print \"energy of electron in 2nd state is\",round(E3*10**17,3),\"*10**-17 joule\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.11, Page number 6.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "velocity is 4386 km/s\n",
      "kinetic energy is 54.71 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=9.1*10**-31;     #mass of electron(kg)\n",
    "h=6.626*10**-34;    #planck's constant\n",
    "lamda=1.66*10**-10;    #wavelength(m)\n",
    "\n",
    "#Calculation\n",
    "v=h/(m*lamda);    #velocity(m/s)\n",
    "KE=(1/2)*m*v**2;    #kinetic energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"velocity is\",int(v/10**3),\"km/s\"\n",
    "print \"kinetic energy is\",round(KE/(1.6*10**-19),2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.12, Page number 6.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.1 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=15000;    #voltage(V)\n",
    "\n",
    "#Calculation\n",
    "lamda=12.26/math.sqrt(V);      #de broglie wavelength(angstrom)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda,1),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.13, Page number 6.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "spacing of crystal is 0.3816 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=344;    #voltage(V)\n",
    "n=1;\n",
    "theta=60*math.pi/180;    #angle(radian)\n",
    "\n",
    "#Calculation\n",
    "lamda=round(12.26/math.sqrt(V),3);      #de broglie wavelength(angstrom)\n",
    "d=n*lamda/(2*math.sin(theta));    #spacing of crystal(angstrom)\n",
    "\n",
    "#Result\n",
    "print \"spacing of crystal is\",round(d,4),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 6.14, Page number 6.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 9.787 *10**-6 m\n",
      "answer varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "E=1.5*9.1*10**-31;    #energy(joule)\n",
    "m=1.676*10**-27;     #mass(kg)\n",
    "h=6.62*10**-34;    #planck's constant\n",
    "\n",
    "#Calculation\n",
    "v=math.sqrt(2*E/m);    \n",
    "lamda=h/(m*v);       #wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",round(lamda*10**6,3),\"*10**-6 m\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  }
 ],
 "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
}