{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#5: Principles of Quantum Mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.1, Page number 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 0.0275 nm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "E=2000;            #energy(eV)\n",
    "\n",
    "#Calculation\n",
    "lamda=h/math.sqrt(2*m*E*e);    #wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",round(lamda*10**9,4),\"nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.2, Page number 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 0.30675 angstrom\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=1600;      #potential energy of electron(V)\n",
    "\n",
    "#Calculation\n",
    "lamda=12.27/math.sqrt(V);      #wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",lamda,\"angstrom\"\n",
    "print \"answer given in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.3, Page number 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 2.8 *10**-4 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "me=9.1*10**-31;    #mass(kg)\n",
    "h=6.62*10**-34;   #plank constant\n",
    "mn=1.676*10**-27;    #mass(kg)\n",
    "c=3*10**8;     #velocity of light(m/s)\n",
    "\n",
    "#Calculation\n",
    "lamda=h*10**10/math.sqrt(4*mn*me*c**2);     #de broglie wavelength(angstrom)  \n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda*10**4,1),\"*10**-4 angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.4, Page number 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy of second state is 0.11377 *10**26 eV\n",
      "energy of second state is 0.45508 *10**26 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=2*10**-10;    #length(m)\n",
    "n1=2;\n",
    "n2=4;\n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "\n",
    "#Calculation\n",
    "E2=n1**2*h/(8*m*e*a);      #energy of second state(eV)\n",
    "E4=n2**2*h/(8*m*e*a);      #energy of fourth state(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy of second state is\",round(E2*10**-26,5),\"*10**26 eV\"\n",
    "print \"energy of second state is\",round(E4*10**-26,5),\"*10**26 eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.5, Page number 86"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "spacing of crystal is 0.3819 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=344;    #accelerated voltage(V)\n",
    "n=1;\n",
    "theta=60;   #glancing angle(degrees)\n",
    "\n",
    "#Calculation\n",
    "theta=theta*math.pi/180;    #glancing angle(radian)\n",
    "lamda=12.27/math.sqrt(V);\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 5.6, Page number 86"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "kinetic energy is 273.57 eV\n",
      "velocity is 43.86 *10**5 m/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=1.66*10**-10;    #wavelength(m)\n",
    "m=9.1*10**-32;    #mass(kg)\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "\n",
    "#Calculation\n",
    "E=h**2/(4*m*e*lamda**2);   #kinetic energy(eV)\n",
    "v=h/(m*lamda);      #velocity(m/s)\n",
    "\n",
    "#Result\n",
    "print \"kinetic energy is\",round(E,2),\"eV\"\n",
    "print \"velocity is\",round(v*10**-6,2),\"*10**5 m/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.7, Page number 87"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ground state energy is 37.69 eV\n",
      "energy of 1st excited state is 150.77 eV\n",
      "energy of 2nd excited state is 339.23 eV\n",
      "answer in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=1*10**-10;    #length(m)\n",
    "n2=2;\n",
    "n3=3;\n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "\n",
    "#Calculation\n",
    "E1=h**2/(8*m*e*a**2);\n",
    "E2=n2**2*E1;      #energy of 1st excited state(eV)\n",
    "E3=n3**2*E1;      #energy of 2nd excited state(eV)\n",
    "\n",
    "#Result\n",
    "print \"ground state energy is\",round(E1,2),\"eV\"\n",
    "print \"energy of 1st excited state is\",round(E2,2),\"eV\"\n",
    "print \"energy of 2nd excited state is\",round(E3,2),\"eV\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.8, Page number 88"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum energy is 2.3558 *n**2 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "from sympy import Symbol\n",
    "\n",
    "#Variable declaration\n",
    "n=Symbol('n');\n",
    "a=4*10**-10;    #width of potential well(m)\n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*a**2);     #maximum energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"maximum energy is\",round(E1/n**2,4),\"*n**2 eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.10, Page number 88"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "uncertainity in velocity is 72.8 km/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "delta_x=10**-8;     #length of box(m)\n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "\n",
    "#Calculation\n",
    "delta_v=h/(m*delta_x);     #uncertainity in velocity(m/s)\n",
    "\n",
    "#Result\n",
    "print \"uncertainity in velocity is\",round(delta_v/10**3,1),\"km/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.11, Page number 89"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 0.40929 *10**-5 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "me=9.1*10**-31;    #mass(kg)\n",
    "mp=1.6*10**-27;    #mass(kg)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "c=3*10**10;    #velocity of light(m/s)\n",
    "\n",
    "#Calculation\n",
    "lamda=h/math.sqrt(2*mp*me*c**2);    #de broglie wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",round(lamda*10**10*10**5,5),\"*10**-5 angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.12, Page number 89"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "glancing angle is 13 degrees 10 minutes\n",
      "answer given in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "m=1.675*10**-27;    #mass(kg)\n",
    "h=6.626*10**-34;   #plank constant\n",
    "E=0.04;     #kinetic energy(eV)\n",
    "e=1.6*10**-19;    #charge(c)\n",
    "n=1;\n",
    "d110=0.314*10**-9;   #spacing(m)\n",
    "\n",
    "#Calculation\n",
    "E=E*e;       #energy(J)\n",
    "lamda=h/math.sqrt(2*m*E);\n",
    "theta=math.asin(n*lamda/(2*d110));     #glancing angle(radian)\n",
    "theta=theta*180/math.pi;        #glancing angle(degrees)\n",
    "theta_m=60*(theta-int(theta));\n",
    "\n",
    "#Result\n",
    "print \"glancing angle is\",int(theta),\"degrees\",int(theta_m),\"minutes\"\n",
    "print \"answer given in the book is wrong\""
   ]
  }
 ],
 "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
}
