{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#8: Semiconductors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.1, Page number 8.55"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity is 0.41667 ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ni=2.5*10**19;     #intrinsic concentration(per m**3)\n",
    "mewn=0.4;     #mobility of electrons(m**2/Vs)\n",
    "mewp=0.2;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "\n",
    "#Calculation\n",
    "sigma_i=ni*e*(mewn+mewp);\n",
    "rhoi=1/sigma_i;     #resistivity(ohm m)\n",
    "\n",
    "#Result\n",
    "print \"resistivity is\",round(rhoi,5),\"ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.2, Page number 8.56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number of donor atoms is 8.333 *10**19 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewn=0.3;     #mobility of electrons(m**2/Vs)\n",
    "rho=0.25;     #resistivity(ohm m)\n",
    "e=1.6*10**-19;\n",
    "\n",
    "#Calculation\n",
    "n=1/(rho*e*mewn);    #number of donor atoms(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"number of donor atoms is\",round(n/10**19,3),\"*10**19 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.3, Page number 8.56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diffusion coefficient of electrons is 54.34 *10**-4 m**2/s\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewn=0.21;     #mobility of electrons(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "Kb=1.38*10**-23;    #boltzmann constant\n",
    "T=300;    #temperature(K)\n",
    "\n",
    "#Calculation\n",
    "Dn=mewn*Kb*T/e;     #diffusion coefficient of electrons(m**2/s)\n",
    "\n",
    "#Result\n",
    "print \"diffusion coefficient of electrons is\",round(Dn*10**4,2),\"*10**-4 m**2/s\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.4, Page number 8.56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "carrier concentration is 19.4 *10**21 per m**3\n",
      "#mobility of holes is 0.03788 m**2/Vs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Rh=3.22*10**-4;    #hall coefficient(m**3/C)\n",
    "e=1.6*10**-19;\n",
    "rho=8.5*10**-3;    #resistivity(ohm m)\n",
    "\n",
    "#Calculation\n",
    "p=1/(Rh*e);      #carrier concentration(per m**3)\n",
    "mewp=Rh/rho;     #mobility of holes(m**2/Vs)\n",
    "\n",
    "#Result\n",
    "print \"carrier concentration is\",round(p/10**21,1),\"*10**21 per m**3\"\n",
    "print \"#mobility of holes is\",round(mewp,5),\"m**2/Vs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.5, Page number 8.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "intrinsic concentration is 556.25 *10**16 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewe=0.36;     #mobility of electrons(m**2/Vs)\n",
    "mewh=0.17;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "rhoi=2.12;    #resistivity(ohm m)\n",
    "\n",
    "#Calculation\n",
    "ni=1/(rhoi*e*(mewe+mewh));     #intrinsic concentration(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"intrinsic concentration is\",round(ni/10**16,2),\"*10**16 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.6, Page number 8.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity is 0.449 ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewe=0.39;     #mobility of electrons(m**2/Vs)\n",
    "mewh=0.19;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "ni=2.4*10**19;     #intrinsic concentration(per m**3)  \n",
    "\n",
    "#Calculation\n",
    "rhoi=1/(ni*e*(mewe+mewh));           #resistivity(ohm m)     \n",
    "\n",
    "#Result\n",
    "print \"resistivity is\",round(rhoi,3),\"ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.7, Page number 8.57"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity is 0.439 *10**-3 per ohm m\n",
      "hole concentration is 2.25 *10**9 per m**3\n",
      "conductivity is 2.16 *10**3 per ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewe=0.135;     #mobility of electrons(m**2/Vs)\n",
    "mewh=0.048;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "ni=1.5*10**16;     #intrinsic concentration(per m**3)\n",
    "Nd=10**23;         #doping concentration(per m**3)\n",
    "\n",
    "#Calculation\n",
    "sigma=ni*e*(mewe+mewh);     #conductivity(per ohm m)    \n",
    "p=ni**2/Nd;      #hole concentration(per m**3)\n",
    "sigman=Nd*e*mewe;     #conductivity(per ohm m)  \n",
    "\n",
    "#Result\n",
    "print \"conductivity is\",round(sigma*10**3,3),\"*10**-3 per ohm m\"\n",
    "print \"hole concentration is\",p/10**9,\"*10**9 per m**3\"\n",
    "print \"conductivity is\",sigman/10**3,\"*10**3 per ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.8, Page number 8.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "carrier concentration is 1.7 *10**22 per m**3\n",
      "#mobility of holes is 4.099 *10**-2 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",
    "e=1.6*10**-19;\n",
    "rhoh=8.93*10**-3;    #resistivity(ohm m)\n",
    "\n",
    "#Calculation\n",
    "p=1/(Rh*e);      #carrier concentration(per m**3)\n",
    "mewp=Rh/rhoh;     #mobility of holes(m**2/Vs)\n",
    "\n",
    "#Result\n",
    "print \"carrier concentration is\",round(p/10**22,1),\"*10**22 per m**3\"\n",
    "print \"#mobility of holes is\",round(mewp*10**2,3),\"*10**-2 m**2/Vs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.9, Page number 8.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity is 4.32 *10**-4 per ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewe=0.13;     #mobility of electrons(m**2/Vs)\n",
    "mewh=0.05;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "ni=1.5*10**16;     #intrinsic concentration(per m**3)\n",
    "\n",
    "#Calculation\n",
    "sigma=ni*e*(mewe+mewh);     #conductivity(per ohm m)  \n",
    "\n",
    "#Result\n",
    "print \"conductivity is\",sigma*10**4,\"*10**-4 per ohm m\"  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.10, Page number 8.58"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity is 11.2 per ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewe=0.14;     #mobility of electrons(m**2/Vs)\n",
    "mewh=0.05;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "ni=1.5*10**16;     #intrinsic concentration(per m**3)\n",
    "A=28.09;     #atomic weight\n",
    "D=2.33*10**3;    #density(kg/m**3)\n",
    "Na=6.025*10**26;    #avagadro number\n",
    "\n",
    "#Calculation\n",
    "N=Na*D/A;    #number of atoms(per m**3)\n",
    "n=N/10**8;    #electron concentration(per m**3)\n",
    "p=ni**2/n;    #hole concentration(per m**3)\n",
    "sigma=e*((n*mewe)+(p*mewh));     #conductivity(per ohm m)  \n",
    "\n",
    "#Result\n",
    "print \"conductivity is\",round(sigma,1),\"per ohm m\"  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.11, Page number 8.59"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity is 4.13 *10**-4 per ohm m\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewe=0.36;     #mobility of electrons(m**2/Vs)\n",
    "mewh=0.18;    #mobility of holes(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "ni=2.5*10**19;     #intrinsic concentration(per m**3)\n",
    "N=4.2*10**28;    #avagadro number\n",
    "\n",
    "#Calculation\n",
    "n=N/10**6;    #electron concentration(per m**3)\n",
    "p=ni**2/n;    #hole concentration(per m**3)\n",
    "rhoi=1/(e*((n*mewe)+(p*mewh)));     #resistivity(per ohm m)  \n",
    "\n",
    "#Result\n",
    "print \"resistivity is\",round(rhoi*10**4,2),\"*10**-4 per ohm m\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.12, Page number 8.60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hole concentration is 1.2 *10**9 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "np=2.4*10**9;    #carrier concentration(per m**3)\n",
    "N=4.2*10**28;    #avagadro number\n",
    "\n",
    "#Calculation\n",
    "p=np/2;     #hole concentration(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"hole concentration is\",p/10**9,\"*10**9 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.13, Page number 8.60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "density of donor atoms is 8.92 *10**19 electrons/m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "mewn=0.35;     #mobility of electrons(m**2/Vs)\n",
    "e=1.602*10**-19;\n",
    "rho=0.2;    #resistivity(ohm m)\n",
    "\n",
    "#Calculation\n",
    "n=1/(rho*e*mewn);      #density of donor atoms\n",
    "\n",
    "#Result\n",
    "print \"density of donor atoms is\",round(n/10**19,2),\"*10**19 electrons/m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.14, Page number 8.60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy gap is 0.573 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Kb=1.38*10**-23;    #boltzmann constant\n",
    "T1=300;    #temperature(K)\n",
    "T2=320;    #temperature(K)\n",
    "rho1=5;    #resistivity(ohm m)\n",
    "rho2=2.5;    #resistivity(ohm m)\n",
    "\n",
    "#Calculation\n",
    "Eg=2*Kb*math.log(rho1/rho2)/((1/T1)-(1/T2));     #energy gap(J)\n",
    "\n",
    "#Result\n",
    "print \"energy gap is\",round(Eg/e,3),\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.15, Page number 8.61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diffusion coefficient is 4.92 *10**-3 m**2/sec\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Kb=1.38*10**-23;    #boltzmann constant\n",
    "T=300;    #temperature(K)\n",
    "mewe=0.19;     #mobility of electrons(m**2/Vs)\n",
    "e=1.6*10**-19;\n",
    "\n",
    "#Calculation\n",
    "Dn=mewe*Kb*T/e;      #diffusion coefficient(m**2/sec)\n",
    "\n",
    "#Result\n",
    "print \"diffusion coefficient is\",round(Dn*10**3,2),\"*10**-3 m**2/sec\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example number 8.16, Page number 8.61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "energy gap is 1.04 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "Kb=1.38*10**-23;    #boltzmann constant\n",
    "T1=293;    #temperature(K)\n",
    "T2=305;    #temperature(K)\n",
    "rho1=4.5;    #resistivity(ohm m)\n",
    "rho2=2.0;    #resistivity(ohm m)\n",
    "\n",
    "#Calculation\n",
    "Eg=2*Kb*math.log(rho1/rho2)/((1/T1)-(1/T2));     #energy gap(J)\n",
    "\n",
    "#Result\n",
    "print \"energy gap is\",round(Eg/e,2),\"eV\""
   ]
  }
 ],
 "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
}