{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9:Statistical Mechanics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:9.1,Page no:299"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "k= 8.617*10**(-5)  #Boltzmann constant, eV/K\n",
      "To=273.0  #initial temperature, K\n",
      "E1= -13.6  #energy of ground state, eV\n",
      "E2= -3.4  #energy of first excited state, eV\n",
      "dE= E2-E1  #difference in energy levels\n",
      "g1=2.0  #number of energy states for E1\n",
      "g2=8.0  #number of energy states for E2\n",
      "\n",
      "#Calculation\n",
      "J= dE/(k*To) \n",
      "Nratio1= (g2/g1)*math.exp(-J)  #ratio of number of atoms in level 2 and level 1 at To\n",
      "T1=10273.0  #K\n",
      "J1= J*To/T1  \n",
      "Nratio2= (g2/g1)*math.exp(-J1)  #at T1\n",
      "\n",
      "#Result\n",
      "print\"(a).The ratio at 273 K is:%.3g\"%Nratio1,\"(Approx)\"\n",
      "print\"(b).The ratio at 10273 k is:%.g \"%Nratio2"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a).The ratio at 273 K is:1.97e-188 (Approx)\n",
        "(b).The ratio at 10273 k is:4e-05 \n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:9.4,Page no:305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration \n",
      "Moxygen= 16.0  #atomic mass,u\n",
      "Mo2= 32.0  #Molecular mass, u\n",
      "u= 1.66*(10**(-27))  #atomic mass unit, kg\n",
      "Moxygen= Mo2*u  #mass, kg\n",
      "t= 273  #temperature, K\n",
      "k= 1.38*10**(-23)  #Boltzmann constant, J/K\n",
      "\n",
      "#Calculation\n",
      "Vrms= math.sqrt(3*k*t/Moxygen)  # m/s\n",
      "\n",
      "#Result\n",
      "print\"The rms velocity of oxygen is: \",round(Vrms),\"m/s\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rms velocity of oxygen is:  461.0 m/s\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:9.5,Page no:314"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration \n",
      "V= 1.00  #volume, cm**3\n",
      "V= V*10**(-6)  #converting to m**3\n",
      "dI= 2.404  #standard value of definite Integral used\n",
      "k= 8.617*10**(-5)  #Boltzmann constant, eV/K\n",
      "h= 4.13*(10**(-15))  #Planck's constant, eV.s\n",
      "T= 1000  #temperature, K\n",
      "c= 3 *(10**8)  #speed of light, m/s\n",
      "\n",
      "#Calculation\n",
      "#Part (a)\n",
      "N= 8*(math.pi)*V*dI*((k*T/(h*c))**3)\n",
      "#Part(b)\n",
      "Sig= 5.670*10**(-8)  #Stefan's constant, W/m**2.K**4 , refer to Page 317\n",
      "Ephoton= Sig*(c**2)*(h**3)*T/(2.405*(2*(math.pi)*(k**3)))  #J\n",
      "e_to_J=6.23*10**18*Ephoton             #Converting to eV \n",
      "\n",
      "#Result\n",
      "print\"(a),The number of photons is:%.3g\"%N\n",
      "print\"(b)The average energy of the photons is:%.3g\"%Ephoton,\"J=\",round(e_to_J,3),\"eV\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a),The number of photons is:2.03e+10\n",
        "(b)The average energy of the photons is:3.72e-20 J= 0.232 eV\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:9.6,Page no:317"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration \n",
      "T= 2.7  #blackbody temperature, K\n",
      "Lambda= 2.898*10**(-3)/T  #using wein's displacement law, Eqn 9.40, m\n",
      "\n",
      "#Calculation\n",
      "Lambda= Lambda*10**(3)  #converting to mm\n",
      "\n",
      "#Result\n",
      "print\"The wavelength for maximum radiation is: \",Lambda,\"mm\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wavelength for maximum radiation is:  1.07333333333 mm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:9.7,Page no:317"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration \n",
      "Rearth= 1.5*10**(11)  #radius of earth, m\n",
      "r= 1.4  #rate of arrival of sunlight, kW/m**2\n",
      "\n",
      "#Calculation\n",
      "P= (r*10**3)*4*(math.pi)*(Rearth**2)  #total power reaching Earth\n",
      "Rsun= 7*10**(8)  #radius of Sun, m\n",
      "r2= P/(4*(math.pi)*(Rsun**2))  #radiation rate of Sun, W/m**2\n",
      "emissivity=1  #for blackbody\n",
      "Sig= 5.670*10**(-8)  #Stefan's constant, W/m**2.K**4\n",
      "T= (r2/(emissivity*Sig))**(1.0/4.0) \n",
      "\n",
      "#Result\n",
      "print\"The surface temperature of Sun  is:%.2g\"%T,\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The surface temperature of Sun  is:5.8e+03 K\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example no:9.8,Page no:325"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "u= 1.66*(10**(-27))  #atomic mass unit, kg\n",
      "density= 8.94*10**(3)  # kg/m**3\n",
      "M= 63.5  #atomic mass of copper, u\n",
      "\n",
      "#Calculation\n",
      "Edensity= density/(M*u)  #electron density, electrons/m**3\n",
      "h= 6.63*(10**(-34))  #Planck's constant, J.s\n",
      "Me= 9.1*(10**(-31))  #mass of electron, kg\n",
      "Efermi= h**2/(2*Me)*((3*Edensity)/(8*(math.pi)))**(2.0/3.0)  # J\n",
      "e_to_J=6.23*10**18*Efermi             #Converting to eV \n",
      "\n",
      "#Result\n",
      "print\"The fermi energy is:%.3g\"%Efermi,\"J or\",round(e_to_J,2),\"eV\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The fermi energy is:1.13e-18 J or 7.04 eV\n"
       ]
      }
     ],
     "prompt_number": 6
    }
   ],
   "metadata": {}
  }
 ]
}