{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#5: Electron theory of metals"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.1, Page number 5.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature is 1260.84 K\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",
    "fE=1/100;    #probability(%)\n",
    "E_EF=0.5;    #fermi energy(eV)\n",
    "Kb=1.38*10**-23;    #boltzmann constant\n",
    "e=6.24*10**18;      #conversion faction from J to eV\n",
    "\n",
    "#Calculation\n",
    "x=E_EF/(Kb*e);\n",
    "y=math.log(1/fE);\n",
    "T=x/y;        #temperature(K)\n",
    "\n",
    "#Result\n",
    "print \"temperature is\",round(T,2),\"K\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.2, Page number 5.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "total number of free electrons is 8.3954 **10**28 per m**3\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",
    "Ef=7*1.602*10**-19;     #fermi energy(J)\n",
    "h=6.63*10**-34;     #planck's constant\n",
    "m=9.11*10**-31;     #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "x=h**2/(8*m);\n",
    "y=(3/math.pi)**(2/3);\n",
    "n23=Ef/(x*y);\n",
    "n=n23**(3/2);       #total number of free electrons(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"total number of free electrons is\",round(n/10**28,4),\"**10**28 per m**3\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.3, Page number 5.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relaxation time is 39.742 *10**-15 s\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",
    "rho=1.54*10**-8;     #resistivity of metal(ohm m)\n",
    "n=5.8*10**28;     #number of free electrons(per m**3)\n",
    "e=1.602*10**-19;     #charge(c)\n",
    "m=9.11*10**-31;     #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "tow=m/(n*e**2*rho);       #relaxation time(s)\n",
    "\n",
    "#Result\n",
    "print \"relaxation time is\",round(tow*10**15,3),\"*10**-15 s\"\n",
    "print \"answer varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.4, Page number 5.29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relaxation time is 3.82 *10**-14 s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "rho=1.43*10**-8;     #resistivity of metal(ohm m)\n",
    "n=6.5*10**28;     #number of free electrons(per m**3)\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "m=9.1*10**-31;     #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "tow=m/(n*e**2*rho);       #relaxation time(s)\n",
    "\n",
    "#Result\n",
    "print \"relaxation time is\",round(tow*10**14,2),\"*10**-14 s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.5, Page number 5.29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number of conduction electrons is 1.8088 *10**29 per m**3\n",
      "mobility of electrons is 0.00128 m**2/Vs\n",
      "drift velocity is 2.3 *10**-4 m/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "L=5;    #length(m)\n",
    "R=0.06;    #resistance(ohm)\n",
    "I=15;      #current(A)\n",
    "ne=3;    #number of electrons\n",
    "rho=2.7*10**-8;   #resistivity(ohm m)\n",
    "w=26.98;   #atomic weight\n",
    "D=2.7*10**3;   #density(kg/m**3)\n",
    "Na=6.025*10**26;   #avagadro number(per k mol)\n",
    "\n",
    "#Calculation\n",
    "n=ne*Na*D/w;       #number of conduction electrons(per m**3)\n",
    "mew=1/(n*e*rho);    #mobility of electrons(m**2/Vs)\n",
    "vd=I*R/(L*rho*n*e);     #drift velocity(m/s)\n",
    "\n",
    "#Result\n",
    "print \"number of conduction electrons is\",round(n/10**29,4),\"*10**29 per m**3\"\n",
    "print \"mobility of electrons is\",round(mew,5),\"m**2/Vs\"\n",
    "print \"drift velocity is\",round(vd*10**4,1),\"*10**-4 m/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.6, Page number 5.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mobility of electrons is 0.00427 m**2/Vs\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ne=1;    #number of electrons\n",
    "rho=1.73*10**-8;   #resistivity(ohm m)\n",
    "w=63.5;   #atomic weight\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "D=8.92*10**3;   #density(kg/m**3)\n",
    "Na=6.02*10**26;   #avagadro number(per k mol)\n",
    "\n",
    "#Calculation\n",
    "n=ne*Na*D/w;\n",
    "mew=1/(n*e*rho);     #mobility of electrons(m**2/Vs)\n",
    "\n",
    "#Result\n",
    "print \"mobility of electrons is\",round(mew,5),\"m**2/Vs\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.7, Page number 5.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mobility of electrons is 0.00428 m**2/Vs\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ne=1;    #number of electrons\n",
    "rho=1.721*10**-8;   #resistivity(ohm m)\n",
    "w=63.54;   #atomic weight\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "D=8.95*10**3;   #density(kg/m**3)\n",
    "Na=6.025*10**26;   #avagadro number(per k mol)\n",
    "\n",
    "#Calculation\n",
    "n=ne*Na*D/w;\n",
    "mew=1/(n*e*rho);     #mobility of electrons(m**2/Vs)\n",
    "\n",
    "#Result\n",
    "print \"mobility of electrons is\",round(mew,5),\"m**2/Vs\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.8, Page number 5.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relaxation time is 3.64 *10**-14 s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "rho=1.5*10**-8;     #resistivity of metal(ohm m)\n",
    "n=6.5*10**28;     #number of free electrons(per m**3)\n",
    "e=1.602*10**-19;     #charge(c)\n",
    "m=9.11*10**-31;     #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "tow=m/(n*e**2*rho);       #relaxation time(s)\n",
    "\n",
    "#Result\n",
    "print \"relaxation time is\",round(tow*10**14,2),\"*10**-14 s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.9, Page number 5.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "relaxation time is 3.97 *10**-14 s\n",
      "drift velocity is 0.7 m/s\n",
      "mobility is 0.7 *10**-2 m**2/Vs\n",
      "thermal velocity is 1.17 *10**5 m/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "rho=1.54*10**-8;     #resistivity of metal(ohm m)\n",
    "n=5.8*10**28;     #number of free electrons(per m**3)\n",
    "e=1.602*10**-19;     #charge(c)\n",
    "m=9.11*10**-31;     #mass(kg)\n",
    "E=1*10**2;   #electric field(V/m)\n",
    "Kb=1.381*10**-23;    #boltzmann constant\n",
    "T=300;    #temperature(K)\n",
    "\n",
    "#Calculation\n",
    "tow=m/(n*e**2*rho);       #relaxation time(s)\n",
    "vd=e*E*tow/m;    #drift velocity(m/s)\n",
    "mew=vd/E;        #mobility(m**2/Vs)\n",
    "Vth=math.sqrt(3*Kb*T/m);    #thermal velocity(m/s)\n",
    "\n",
    "#Result\n",
    "print \"relaxation time is\",round(tow*10**14,2),\"*10**-14 s\"\n",
    "print \"drift velocity is\",round(vd,1),\"m/s\"\n",
    "print \"mobility is\",round(mew*10**2,1),\"*10**-2 m**2/Vs\"\n",
    "print \"thermal velocity is\",round(Vth/10**5,2),\"*10**5 m/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.10, Page number 5.32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fermi velocity is 1.39 *10**6 m/s\n",
      "mean free path is 5.52 *10**-8 m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "EF=5.5*1.602*10**-19;     #fermi energy of silver(J)\n",
    "tow=3.97*10**-14;    #relaxation time(s)\n",
    "m=9.11*10**-31;     #mass(kg)\n",
    "\n",
    "#Calculation\n",
    "vf=math.sqrt(2*EF/m);      #fermi velocity(m/s)\n",
    "lamda=vf*tow;      #mean free path(m)\n",
    "\n",
    "#Result\n",
    "print \"fermi velocity is\",round(vf/10**6,2),\"*10**6 m/s\"\n",
    "print \"mean free path is\",round(lamda*10**8,2),\"*10**-8 m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.11, Page number 5.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fermi energy is 8.83 *10**-19 J\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ne=1;    #number of electrons\n",
    "M=107.9;   #atomic weight\n",
    "D=10500;   #density(kg/m**3)\n",
    "Na=6.025*10**26;   #avagadro number(per k mol)\n",
    "m=9.11*10**-31;     #mass(kg)\n",
    "h=6.63*10**-34;     #planck's constant\n",
    "\n",
    "#Calculation\n",
    "n=ne*Na*D/M;    \n",
    "x=h**2/(8*m);\n",
    "y=(3/math.pi)**(2/3);\n",
    "Ef=x*y*n**(2/3);       #fermi energy(eV)   \n",
    "\n",
    "#Result\n",
    "print \"fermi energy is\",round(Ef*10**19,2),\"*10**-19 J\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 5.12, Page number 5.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "drift velocity of free electrons is 0.7391 *10**-3 m/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "A=10*10**-6;     #area(m**2)\n",
    "ne=1;    #number of electrons\n",
    "I=100;    #current(amperes)\n",
    "w=63.5;   #atomic weight\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "D=8.92*10**3;   #density(kg/m**3)\n",
    "Na=6.02*10**26;   #avagadro number(per k mol)\n",
    "\n",
    "#Calculation\n",
    "n=ne*Na*D/w;\n",
    "J=I/A;\n",
    "vd=J/(n*e);      #drift velocity of free electrons(m/s)\n",
    "\n",
    "#Result\n",
    "print \"drift velocity of free electrons is\",round(vd*10**3,4),\"*10**-3 m/s\""
   ]
  }
 ],
 "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
}