{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#8: Quantum Physics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.1, Page number 204"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The energy of photon is 12412.5 eV\n",
      "The momentum of the photon is 6.62e-24 Kg m s^-1\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "W=0.1*10**-9;   #wavelength of photon(m)\n",
    "h=6.62*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "c=3*10**8;      #velocity of light(m/s)\n",
    "e=1.6*10**-19;   #charge of electron(c)\n",
    "\n",
    "#Calculation\n",
    "E=h*c/(W*e);    #energy of photon(eV)\n",
    "P=h/W;       #momentum of the photon(Kgms^-1)\n",
    "\n",
    "#Result\n",
    "print \"The energy of photon is\",E,\"eV\"\n",
    "print \"The momentum of the photon is\",P,\"Kg m s^-1\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.2, Page number 205"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The total number of photons emitted per second is 2.965 *10**20 per sec\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",
    "w=5893*10**-10;      #wavelength of emitted light(m)\n",
    "e=100;     #total energy emitted per sec\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "c=3*10**8;     #velocity of light(m/s)\n",
    "\n",
    "#Calculation\n",
    "E=h*c/w;    #energy of one photon(J)\n",
    "N=e/E;      #The total numberof photons emitted(sec)\n",
    "\n",
    "#Result\n",
    "print \"The total number of photons emitted per second is\",round(N/10**20,3),\"*10**20 per sec\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.3, Page number 205"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The energy density per unit wavelength in a black body cavity is 0.018349 J/m^4\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",
    "w=4000*10**-10;    #wavelength in black body(m)\n",
    "t=1500;     #temperature of black body(K)\n",
    "h=6.625*10**-34;   #Planck's constant(m^2 Kg/sec)\n",
    "c=3*10**8;    #velocity of light(m/s)\n",
    "Kb=1.38*10**-23;   #Boltzmann's constant(m^2 Kg s^-2 k^-1)\n",
    "\n",
    "#Calculation\n",
    "Edw=(8*math.pi*h*c/w**5)*(1/(math.exp(h*c/(w*Kb*t))-1));    #The energy density per unit wavelength in a black body cavity(J/m^4)\n",
    "\n",
    "#Result\n",
    "print \"The energy density per unit wavelength in a black body cavity is\",round(Edw,6),\"J/m^4\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.4, Page number 211"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The compton wavelength for an electron is 0.0242 Angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "h=6.625*10**-34;     #Planck's constant(m^2 Kg/sec)\n",
    "c=3*10**8;     #velocity of light(m/s)\n",
    "m=9.11*10**-31;    #mass of electron(Kg)\n",
    "\n",
    "#Calculation\n",
    "w=h/(c*m)*10**10;     #The compton wavelength for an electron(Armstrong)\n",
    "\n",
    "#Result\n",
    "print \"The compton wavelength for an electron is\",round(w,4),\"Angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.5, Page number 212"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The change in wavelength for X ray photon is 0.0242 Angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "theta=90;    #x ray photon scattered at a angle(degrees)\n",
    "h=6.625*10**-34;   #Planck's constant(J-sec)\n",
    "c=3*10**8;    #velocity of light(m/s)\n",
    "m=9.11*10**-31;   #mass of electron(Kg)\n",
    "\n",
    "#Calculation\n",
    "theta=theta*math.pi/180;     #angle(radian)\n",
    "deltalamda=((h/(c*m))*(1-math.cos(x)))/10**-10;    #The change in wavelength for Xray photon(Angstrom)\n",
    "\n",
    "#Result\n",
    "print \"The change in wavelength for X ray photon is\",round(deltalamda,4),\"Angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.6, Page number 212"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The wavelength of X-rays carbon is 1.72 Angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "theta=180;     #x ray carbon scattered at a angle(degrees)\n",
    "h=6.625*10**-34;   #Planck's constant(m^2 Kg/sec)\n",
    "c=3*10**8;    #velocity of light(m/s)\n",
    "m=9.11*10**-31;   #mass of electron(kg)\n",
    "v=1.8*10**18;     #frequency of incident rays(s^-1)\n",
    "\n",
    "#Calculation\n",
    "theta=theta*math.pi/180;    #angle(radian)\n",
    "w=c/v;    #wavelength(m)\n",
    "tw=(h/(c*m))*(1-math.cos(theta));    #The change wavelength for Xray carbon(m)\n",
    "lamda_dash=(w+tw)/10**-10;       #The wavelength of X-rays carbon(Angstrom)\n",
    "\n",
    "#Result\n",
    "print \"The wavelength of X-rays carbon is\",round(lamda_dash,2),\"Angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.7, Page number 212"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The wavelength of scattered photons is 3.012 Angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "w=3*10**-10;    #wavelength of incident photons(m)\n",
    "theta=60;     #angle of view(degrees)\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "c=3*10**8;    #velocity of light(m/sec)\n",
    "m=9.11*10**-31;   #mass of electron(Kg)\n",
    "\n",
    "#Calculation\n",
    "theta=theta*math.pi/180;    #angle(radian)\n",
    "lamda_dash=(w+((h/(c*m))*(1-math.cos(theta))))/10**-10;    #The wavelength of scattered photons(Angstrom)\n",
    "\n",
    "#Result\n",
    "print \"The wavelength of scattered photons is\",round(lamda_dash,3),\"Angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.8, Page number 213"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Velocity of moving electron is 2.9047 *10**8 m/sec\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "x=4;     #Total energy increase to 4 times of its initial rest energy\n",
    "c=3*10**8;    #velocity of light(m/sec)\n",
    "\n",
    "#Calculation\n",
    "v=math.sqrt(c**2*(1-(1/x**2)));    #The Velocity of moving electron(m/sec)\n",
    "\n",
    "#Result\n",
    "print \"The Velocity of moving electron is\",round(v/10**8,4),\"*10**8 m/sec\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.9, Page number 224"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The least energy of the particle can be obtained is 37.639 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",
    "a=0.1*10**-9;    #width of high potential box(m)\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "m=9.11*10**-31;     #mass of electron(Kg)\n",
    "e=1.6*10**-19;      #charge of electron(c)\n",
    "n=1;    #take n equal to one\n",
    "\n",
    "#Calculation\n",
    "E=(n**2*h**2)/(8*m*a**2*e);     #The least energy of the particle can be obtained(eV)\n",
    "\n",
    "#Result\n",
    "print \"The least energy of the particle can be obtained is\",round(E,3),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.10, Page number 224"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The least energy of the neutron can be obtained is 2.053 MeV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=10**-14;    #length of impenerable box(m)\n",
    "m=1.67*10**-27;    #mass of neutron(Kg)\n",
    "n=1;    #for lowest energy\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "\n",
    "#Calculation\n",
    "E=(n**2*h**2)/(8*m*a**2);     #The least energy of the neutron can be obtained(J)\n",
    "\n",
    "#Result\n",
    "print \"The least energy of the neutron can be obtained is\",round(E/(1.6*10**-19*10**6),3),\"MeV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.11, Page number 225"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The first permitted energy level by taking n=1 is 2.352 eV\n",
      "The second permitted energy level by taking n=2 is 9.41 eV\n",
      "The third permitted energy level by taking n=3 is 21.172 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",
    "a=4*10**-10;    #width of electron box(m)\n",
    "h=6.625*10**-34;   #Planck's constant(m^2 Kg/sec)\n",
    "m=9.11*10**-31;    #mass of electron(kg)\n",
    "e=1.6*10**-19;     #charge of electron(c)\n",
    "n=1;     #first permitted level\n",
    "\n",
    "#Calculation\n",
    "E1=((n**2*h**2)/(8*m*a**2*e));    #The first permitted energy level by taking n=1(eV)\n",
    "E2=4*E1;    #The second permitted energy level by taking n=2(eV)\n",
    "E3=9*E1;    #The third permitted energy level by taking n=3(eV)\n",
    "\n",
    "#Result\n",
    "print \"The first permitted energy level by taking n=1 is\",round(E1,3),\"eV\"\n",
    "print \"The second permitted energy level by taking n=2 is\",round(E2,2),\"eV\"\n",
    "print \"The third permitted energy level by taking n=3 is\",round(E3,3),\"eV\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.12, Page number 226"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The lowest energy of electron in a cubical box is 50.186 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=1.5*10**-10;     #each side of cubical box(m)\n",
    "n1=1;    #for lowest energy\n",
    "n2=1;    #for lowest energy\n",
    "n3=1;    #for lowest energy\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "m=9.11*10**-31;    #mass of electron(Kg)\n",
    "e=1.6*10**-19;     #charge of electron(c)\n",
    "\n",
    "#Calculation\n",
    "n=(n1**2+n2**2+n3**2);     #total value of n\n",
    "E=((n*h**2)/(8*m*a**2*e));    #The lowest energy of electron ina cubical box(eV)\n",
    "\n",
    "#Result\n",
    "print \"The lowest energy of electron in a cubical box is\",round(E,3),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.13, Page number 226"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The lowest energy of electron in deep potential well is 0.02352 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=4*10**-9;    #width of potential well(m)\n",
    "n=1;    #For minimum energy n value\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "m=9.11*10**-31;     #mass of electron(Kg)\n",
    "e=1.6*10**-19;      #charge of electron(c)\n",
    "\n",
    "#Calculation\n",
    "E=((n**2*h**2)/(8*m*a**2*e));     #The lowest energy of electron in deep potential well(eV)\n",
    "\n",
    "#Result\n",
    "print \"The lowest energy of electron in deep potential well is\",round(E,5),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.14, Page number 227"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The energy required the electron from its ground state to the fifth exited state is 1317 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=0.1*10**-9;    #length of one dimensional box(m)\n",
    "n=1;        #first permitted level\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "m=9.11*10**-31;     #mass of electron(kg)\n",
    "e=1.6*10**-19;      #charge of electron(c)\n",
    "\n",
    "#Calculation\n",
    "E1=((n**2*h**2)/(8*m*a**2*e));     #The ground state of electron in an one dimensional box(eV)\n",
    "E6=36*E1;    #The fifth exited state of electron(eV)\n",
    "E=E6-E1;     #The energy required the electron from its ground state to the fifth exited state(eV)\n",
    "\n",
    "#Result\n",
    "print \"The energy required the electron from its ground state to the fifth exited state is\",int(E),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.15, Page number 227"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The lowest energy of the system consisting of three electron ia a one dimensional box is 112.9184 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",
    "a=0.1*10**-9;    #length of one dimensional box(m)\n",
    "n=1;     #first permitted level\n",
    "h=6.625*10**-34;    #Planck's constant(m^2 Kg/sec)\n",
    "m=9.11*10**-31;     #mass of electron(Kg)\n",
    "e=1.6*10**-19;      #charge of electron(c)\n",
    "ne=3;      #the number of electrons\n",
    "\n",
    "#Calculation\n",
    "E=((n**2*h**2)/(8*m*a**2*e))*ne;    #The lowest energy of the system consisting of three electron ia a one dimensional box(eV)\n",
    "\n",
    "#Result\n",
    "print \"The lowest energy of the system consisting of three electron ia a one dimensional box is\",round(E,4),\"eV\"\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
}