{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#9: Semiconductors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.1, Page number 202"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity is 0.44899 ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "ni=2.4*10**19;    #particle density(per m**3)\n",
    "mew_e=0.39;        #electron mobility(m**2/Vs)\n",
    "mew_h=0.19;       #hole mobility(m**2/Vs)\n",
    "\n",
    "#Calculation\n",
    "rho=1/(ni*e*(mew_e+mew_h));       #resistivity(ohm m)\n",
    "\n",
    "#Result\n",
    "print \"resistivity is\",round(rho,5),\"ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.2, Page number 203"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity is 0.43 *10**-3 s\n",
      "conductivity is 2.08 *10**3 s\n",
      "answer in the book varies due to rounding off errors\n",
      "equilibrium hole concentration is 2.25 *10**9 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "ni=1.5*10**16;    #particle density(per m**3)\n",
    "mew_e=0.13;        #electron mobility(m**2/Vs)\n",
    "mew_h=0.048;       #hole mobility(m**2/Vs)\n",
    "ND=10**23;     #density(per m**3)\n",
    "\n",
    "#Calculation\n",
    "sigma_i=ni*e*(mew_e+mew_h);          #conductivity(s)\n",
    "sigma=ND*mew_e*e;       #conductivity(s)\n",
    "P=ni**2/ND;            #equilibrium hole concentration(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"conductivity is\",round(sigma_i*10**3,2),\"*10**-3 s\"\n",
    "print \"conductivity is\",sigma/10**3,\"*10**3 s\"\n",
    "print \"answer in the book varies due to rounding off errors\"\n",
    "print \"equilibrium hole concentration is\",P/10**9,\"*10**9 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.3, Page number 203"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "intrinsic conductivity is 0.432 *10**-3 ohm-1 m-1\n",
      "conductivity during donor impurity is 10.4 ohm-1 m-1\n",
      "conductivity during donor impurity is 4.0 ohm-1 m-1\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "ni=1.5*10**16;    #particle density(per m**3)\n",
    "mew_e=0.13;        #electron mobility(m**2/Vs)\n",
    "mew_h=0.05;       #hole mobility(m**2/Vs)\n",
    "ND=5*10**20;     #density(per m**3)\n",
    "\n",
    "#Calculation\n",
    "sigma=ni*e*(mew_e+mew_h);          #intrinsic conductivity(s)\n",
    "sigma_d=ND*e*mew_e;       #conductivity during donor impurity(ohm-1 m-1)\n",
    "sigma_a=ND*e*mew_h;       #conductivity during acceptor impurity(ohm-1 m-1)\n",
    "\n",
    "#Result\n",
    "print \"intrinsic conductivity is\",sigma*10**3,\"*10**-3 ohm-1 m-1\"\n",
    "print \"conductivity during donor impurity is\",sigma_d,\"ohm-1 m-1\"\n",
    "print \"conductivity during donor impurity is\",sigma_a,\"ohm-1 m-1\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.4, Page number 204"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mobility is 0.04099 m**2/Vs\n",
      "answer in the book varies due to rounding off errors\n",
      "density of atoms is 1.7 *10**22 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "RH=3.66*10**-4;     #hall coefficient(m**3/c)\n",
    "rho=8.93*10**-3;    #resistivity(m)\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "\n",
    "#Calculation\n",
    "mew=RH/rho;        #mobility(m**2/Vs)\n",
    "n=1/(RH*e);      #density of atoms(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"mobility is\",round(mew,5),\"m**2/Vs\"\n",
    "print \"answer in the book varies due to rounding off errors\"\n",
    "print \"density of atoms is\",round(n/10**22,1),\"*10**22 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.5, Page number 204"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "carrier density is 3.58 *10**19 per m**3\n",
      "conductivity is 3.43 ohm-1 m-1\n",
      "answer in the book varies due to rounding off errors\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "w=72.6;       #atomic weight\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "mew_e=0.4;        #electron mobility(m**2/Vs)\n",
    "mew_h=0.2;       #hole mobility(m**2/Vs)\n",
    "T=300;         #temperature(K)\n",
    "x=4.83*10**21;\n",
    "Eg=0.7;      #band gap(eV)\n",
    "y=0.052;\n",
    "\n",
    "#Calculation\n",
    "ni=x*(T**(3/2))*math.exp(-Eg/y);     #carrier density(per m**3)\n",
    "sigma=ni*e*(mew_e+mew_h);         #conductivity(ohm-1 m-1)\n",
    "\n",
    "#Result\n",
    "print \"carrier density is\",round(ni/10**19,2),\"*10**19 per m**3\"\n",
    "print \"conductivity is\",round(sigma,2),\"ohm-1 m-1\"\n",
    "print \"answer in the book varies due to rounding off errors\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.6, Page number 205"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy band gap is 1.12 eV\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "T1=293;     #temperature(K)\n",
    "T2=305;     #temperature(K)\n",
    "sigma1=2;    \n",
    "sigma2=4.5; \n",
    "KB=1.38*10**-23;   #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "x=((1/T1)-(1/T2));\n",
    "y=math.log(sigma2/sigma1);\n",
    "z=3*math.log(T2/T1)/2;\n",
    "Eg=2*KB*(y+z)/(e*x);    #energy band gap(eV)\n",
    "\n",
    "#Result\n",
    "print \"energy band gap is\",round(Eg,2),\"eV\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.7, Page number 205"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diffusion coefficient is 4.9 *10**-3 m**2/sec\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "mew_e=0.19;        #electron mobility(m**2/Vs)\n",
    "T=300;         #temperature(K)\n",
    "KB=1.38*10**-23;   #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "Dn=mew_e*KB*T/e;    #diffusion coefficient(m**2/sec)\n",
    "\n",
    "#Result\n",
    "print \"diffusion coefficient is\",round(Dn*10**3,1),\"*10**-3 m**2/sec\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.8, Page number 206"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "carrier density is 1.25e+19 per m**3\n",
      "energy gap is 0.75 eV\n",
      "answer in the book is wrong\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "sigma=2.12;     #conductivity(ohm-1 m-1)\n",
    "T=300;      #temperature(K)\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "mew_e=0.36;        #electron mobility(m**2/Vs)\n",
    "mew_h=0.7;       #hole mobility(m**2/Vs)\n",
    "C=4.83*10**21;\n",
    "KB=1.38*10**-23;   #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "ni=sigma/(e*(mew_e+mew_h));     #carrier density(per m**3)\n",
    "x=C*T**(3/2)/ni;\n",
    "Eg=2*KB*T*math.log(x)/e;      #energy gap(eV)\n",
    "\n",
    "#Result\n",
    "print \"carrier density is\",ni,\"per m**3\"\n",
    "print \"energy gap is\",round(Eg,2),\"eV\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.9, Page number 206"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "probability of occupation at 0C is 2.025 *10**-4 eV\n",
      "probability of occupation at 50C is 7.55 *10**-4 eV\n",
      "probability of occupation at 100C is 19.76 *10**-4 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Eg=6.408*10**-20;    #energy gap of semiconductor(J)\n",
    "T1=273;    #temperature(K)\n",
    "T2=323;    #temperature(K)\n",
    "T3=373;    #temperature(K)\n",
    "KB=1.38*10**-23;   #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "FE1=1/(1+math.exp(Eg/(2*KB*T1)));     #probability of occupation at 0C(eV)\n",
    "FE2=1/(1+math.exp(Eg/(2*KB*T2)));     #probability of occupation at 50C(eV)\n",
    "FE3=1/(1+math.exp(Eg/(2*KB*T3)));     #probability of occupation at 100C(eV)\n",
    "\n",
    "#Result\n",
    "print \"probability of occupation at 0C is\",round(FE1*10**4,3),\"*10**-4 eV\"\n",
    "print \"probability of occupation at 50C is\",round(FE2*10**4,2),\"*10**-4 eV\"\n",
    "print \"probability of occupation at 100C is\",round(FE3*10**4,2),\"*10**-4 eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.10, Page number 207"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio between conductivity is 1.095 *10**5\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Eg=1.9224*10**-19;    #energy gap of semiconductor(J)\n",
    "T1=600;    #temperature(K)\n",
    "T2=300;    #temperature(K)\n",
    "x=-1.666*10**-3;\n",
    "KB=1.38*10**-23;   #boltzmann constant\n",
    "\n",
    "#Calculation\n",
    "T=(1/T1)-(1/T2);\n",
    "r=math.exp(x*(-Eg/(2*KB)));     #ratio between conductivity\n",
    "\n",
    "#Result\n",
    "print \"ratio between conductivity is\",round(r/10**5,3),\"*10**5\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.11, Page number 207"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity of material is 4.1336 *10**-4 ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ni=2.5*10**19;      #charge carriers(per m**3)\n",
    "r=10**-6;    #ratio\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "mew_e=0.36;        #electron mobility(m**2/Vs)\n",
    "mew_h=0.18;       #hole mobility(m**2/Vs)\n",
    "N=4.2*10**28;     #number of atoms(per m**3)\n",
    "\n",
    "#Calculation\n",
    "Ne=r*N;       #number of impurity atoms(per m**3)\n",
    "Nh=ni**2/Ne;    \n",
    "sigma=(Ne*e*mew_e)+(Nh*e*mew_h);      #conductivity(ohm m)\n",
    "rho=1/sigma;     #resistivity of material(per ohm m)\n",
    "\n",
    "#Result\n",
    "print \"resistivity of material is\",round(rho*10**4,4),\"*10**-4 ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.12, Page number 208"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity is 0.028 per ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=5*10**17;     #concentration(m**3)\n",
    "vd=350;    #drift velocity(m/s)\n",
    "E=1000;    #electric field(V/m)\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "\n",
    "#Calculation\n",
    "sigma=n*e*vd/E;    #conductivity(per ohm m)\n",
    "\n",
    "#Result\n",
    "print \"conductivity is\",sigma,\"per ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.13, Page number 208"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "concentration is 1.1 *10**16 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "sigmae=2.2*10**-4;       #conductivity(ohm/m)\n",
    "mew_e=125*10**-3;       #electron mobility(m**2/Vs)\n",
    "e=1.602*10**-19;     #charge(c)\n",
    "\n",
    "#Calculation\n",
    "ne=sigmae/(e*mew_e);     #concentration(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"concentration is\",round(ne/10**16,1),\"*10**16 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.14, Page number 209"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "density of charge carriers is 1.7055 *10**22 per m**3\n",
      "mobility of charge carriers is 0.041 m**2/Vs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "RH=3.66*10**-4;      #hall coefficient(m*3/c)\n",
    "rho_i=8.93*10**-3;    #resistivity(ohm m)\n",
    "e=1.602*10**-19;     #charge(c)\n",
    "\n",
    "#Calculation\n",
    "nh=1/(RH*e);      #density of charge carriers(per m**3)\n",
    "mewh=1/(rho_i*nh*e);     #mobility of charge carriers(m**2/Vs)\n",
    "\n",
    "#Result\n",
    "print \"density of charge carriers is\",round(nh/10**22,4),\"*10**22 per m**3\"\n",
    "print \"mobility of charge carriers is\",round(mewh,3),\"m**2/Vs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 9.15, Page number 209"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall voltage is 1.1 mV\n",
      "charge carrier concentration is 1.71 *10**22 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "I=3*10**-3;    #current(A)\n",
    "RH=3.66*10**-4;    #hall coefficient(m**3/C)\n",
    "e=1.6*10**-19;     #charge(c)\n",
    "d=2*10**-2;\n",
    "z=1*10**-3;\n",
    "B=1;        #magnetic field(wb/m**2)\n",
    "\n",
    "#Calculation\n",
    "w=d*z;     #width(m**2)\n",
    "A=w;     #area(m**2)\n",
    "EH=RH*I*B/A;    \n",
    "VH=EH*d*10**3;     #hall voltage(mV)\n",
    "n=1/(RH*e);     #charge carrier concentration(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"hall voltage is\",round(VH,1),\"mV\"\n",
    "print \"charge carrier concentration is\",round(n/10**22,2),\"*10**22 per m**3\""
   ]
  }
 ],
 "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
}
