{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 5: Elements of Statistical Mechanics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.1, Page number 129"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature is 5959 K\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "b=2.92*10**-3;      #value of b(mK)\n",
    "lamda=4900*10**-10;      #wavelength(m)\n",
    "\n",
    "#Calculations\n",
    "T=b/lamda;          #temperature(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature is\",int(T),\"K\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.2, Page number 129"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature is 5454 K\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "T=1500;    #temperature(K)\n",
    "lamda=5500;      #wavelength(m)\n",
    "lamda_m=20000;      #wavelength(m)\n",
    "\n",
    "#Calculations\n",
    "T_dash=lamda_m*T/lamda;          #temperature of sun(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature is\",int(T_dash),\"K\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.3, Page number 130"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 48283 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "T=327+273;    #temperature(K)\n",
    "b=2.897*10**-3;      #value of b(mK)\n",
    "\n",
    "#Calculations\n",
    "lamda_m=b/T;          #wavelength(m)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",int(lamda_m*10**10),\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.4, Page number 130"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "wavelength is 2.92 angstrom\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "T=10**7;    #temperature(K)\n",
    "b=0.292;      #value of b(cmK)\n",
    "\n",
    "#Calculations\n",
    "lamda_m=b/T;          #wavelength(cm)\n",
    "\n",
    "#Result\n",
    "print \"wavelength is\",lamda_m*10**8,\"angstrom\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.5, Page number 130"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature of moon is 200 K\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "T=1127+273;    #temperature(K)\n",
    "lamda_m=2*10**-6;      #wavelength(m)\n",
    "lamda=14*10**-6;      #wavelength(m)\n",
    "\n",
    "#Calculations\n",
    "Tm=lamda_m*T/lamda;     #temperature of moon(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature of moon is\",int(Tm),\"K\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.6, Page number 131"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature of sun is 6097 K\n",
      "temperature of moon is 207 K\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "lamda_m=4753*10**-10;      #wavelength(m)\n",
    "lamda=14*10**-6;      #wavelength(m)\n",
    "b=0.2898*10**-2;      #value of constant(mK)\n",
    "\n",
    "#Calculations\n",
    "Ts=b/lamda_m;     #temperature of sun(K)    \n",
    "Tm=b/lamda;       #temperature of moon(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature of sun is\",int(Ts),\"K\"\n",
    "print \"temperature of moon is\",int(Tm),\"K\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.7, Page number 140"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum kinetic energy is 6.48 *10**4 K\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration    \n",
    "e=1.6*10**-19;     #charge(coulomb)\n",
    "m=9*10**-31;       #mass(kg)\n",
    "h=6.624*10**-34;    #plank's constant(Js)\n",
    "n=5.86*10**28;      #density(electrons/m**3)\n",
    "k=8.6*10**-5;\n",
    "\n",
    "#Calculations\n",
    "ef=(h**2/(8*m))*(3*n/math.pi)**(2/3);     #energy(J)\n",
    "ef=ef/e;           #energy(eV)\n",
    "theta_f=ef/k;      #maximum kinetic energy(K)\n",
    "\n",
    "#Result\n",
    "print \"maximum kinetic energy is\",round(theta_f/10**4,2),\"*10**4 K\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5.8, Page number 140"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fermi energy is 3.187 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",
    "e=1.6*10**-19;     #charge(coulomb)\n",
    "m=9*10**-31;       #mass(kg)\n",
    "h=6.62*10**-34;    #plank's constant(Js)\n",
    "rho=970;     #density(kg/m**3)\n",
    "N0=6.02*10**26;   #avagadro number\n",
    "A=23;      #atomic weight\n",
    "\n",
    "#Calculations\n",
    "n=rho*N0/A;       #concentration(electrons/m**3)\n",
    "ef=(h**2/(8*m))*(3*n/math.pi)**(2/3);     #fermi energy(J)\n",
    "ef=ef/e;           #fermi energy(eV)\n",
    "\n",
    "#Result\n",
    "print \"fermi energy is\",round(ef,3),\"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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}