{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#4: Principles of quantum mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.1, Page number 4.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "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;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's 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 4.2, Page number 4.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "velocity is 438.6 *10**4 m/s\n",
      "answer varies due to rounding off errors\n",
      "kinetic energy is 54.71 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(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",
    "E=h**2/(2*m*e*lamda**2);    #kinetic energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"velocity is\",round(v/10**4,1),\"*10**4 m/s\"\n",
    "print \"answer varies due to rounding off errors\"\n",
    "print \"kinetic energy is\",round(E,2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.3, Page number 4.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy value in ground state is 37.7377 eV\n",
      "energy value in 1st state is 150.95 eV\n",
      "energy value in 2nd state is 339.6395 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=1*10**-10;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "E2=4*E1;      #energy value in 1st state(eV)\n",
    "E3=9*E1;      #energy value in 2nd state(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy value in ground state is\",round(E1,4),\"eV\"\n",
    "print \"energy value in 1st state is\",round(E2,2),\"eV\"\n",
    "print \"energy value in 2nd state is\",round(E3,4),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.4, Page number 4.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum energy is 2.3586 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=4*10**-10;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "\n",
    "#Result\n",
    "print \"minimum energy is\",round(E1,4),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.5, Page number 4.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 0.01 nm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "V=15*10**3;    #voltage(V)\n",
    "\n",
    "#Calculation\n",
    "lamda=1.227/math.sqrt(V);     #wavelength(nm)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",round(lamda,2),\"nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.6, Page number 4.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum energy is 150.95 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=0.05*10**-9;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "\n",
    "#Result\n",
    "print \"minimum energy is\",round(E1,2),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.8, Page number 4.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum energy is 4.2 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=3*10**-10;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "\n",
    "#Result\n",
    "print \"minimum energy is\",round(E1,1),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.9, Page number 4.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "de broglie wavelength is 8488 nm\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "me=1.676*10**-27;    #mass(kg)  \n",
    "mn=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "\n",
    "#Calculation\n",
    "lamda_n=h/math.sqrt(4*mn*me);      #de broglie wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"de broglie wavelength is\",int(lamda_n*10**9),\"nm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.10, Page number 4.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy value in 2nd quantum state is 37.738 eV\n",
      "energy value in 4th quantum state is 150.95 eV\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",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=2*10**-10;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "E2=2**2*E1;      #energy value in 2nd quantum state(eV)\n",
    "E4=4**2*E1;      #energy value in 2nd quantum state(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy value in 2nd quantum state is\",round(E2,3),\"eV\"\n",
    "print \"energy value in 4th quantum state is\",round(E4,2),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.11, Page number 4.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "interplanar spacing is 0.382 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;  \n",
    "m=9.1*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "V=344;          #potemtial(V)\n",
    "n=1;\n",
    "theta=60;     #angle(degrees)\n",
    "\n",
    "#Calculation\n",
    "theta=theta*math.pi/180;      #angle(radian)\n",
    "d=n*h/(2*math.sin(theta)*math.sqrt(2*m*V*e));     #interplanar spacing(m)\n",
    "\n",
    "#Result\n",
    "print \"interplanar spacing is\",round(d*10**10,3),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.12, Page number 4.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy required to pump an electron is 301.57 eV\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",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.11*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=1*10**-10;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "E3=3**2*E1;      #energy value in 2nd quantum state(eV)\n",
    "E=E3-E1;       #energy required to pump an electron(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy required to pump an electron is\",round(E,2),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.13, Page number 4.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minimum energy is 9.424 eV\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",
    "n=1;\n",
    "e=1.6*10**-19;  \n",
    "m=9.11*10**-31;    #mass(kg)\n",
    "h=6.63*10**-34;    #planck's constant\n",
    "L=2*10**-10;       #width(m)\n",
    "\n",
    "#Calculation\n",
    "E1=n**2*h**2/(8*m*e*L**2);      #energy value in ground state(eV)\n",
    "\n",
    "#Result\n",
    "print \"minimum energy is\",round(E1,3),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 4.14, Page number 4.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 0.31 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=1.227/math.sqrt(V);     #wavelength(nm)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",round(lamda*10,2),\"angstrom\""
   ]
  }
 ],
 "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
}