{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 8: Semiconductor Physics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.1, Page number 229"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ratio of density of electrons is 0.227\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ni=2.5*10**19;     #concentration(per m**3)\n",
    "d=4.4*10**28;    #density(per m**3)\n",
    "n=4*10**8;      #number of Ge atoms\n",
    "\n",
    "#Calculation\n",
    "Na=d/n;     #density of acceptor atoms\n",
    "np=ni**2/Na;     \n",
    "npbyni=np/ni;     #ratio of density of electrons\n",
    "\n",
    "#Result\n",
    "print \"ratio of density of electrons is\",round(npbyni,3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.2, Page number 230"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hole concentration is 1.44e+16 holes/m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "ni=2.4*10**19;     #concentration(per m**3)\n",
    "d=4*10**28;    #density(per m**3)\n",
    "n=10**6;      #number of Ge atoms\n",
    "\n",
    "#Calculation\n",
    "Nd=d/n;     #density of acceptor atoms\n",
    "np=ni**2/Nd;     #hole concentration(holes/m**3)\n",
    "\n",
    "#Result\n",
    "print \"hole concentration is\",np,\"holes/m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.3, Page number 230"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "density of holes and electrons is 3.352 *10**19 per m**3\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "me=9.1*10**-31;          #mass of electron(kg)\n",
    "kb=1.38*10**-23;      #boltzmann constant\n",
    "T=300;      #temperature(K)\n",
    "h=6.62*10**-34;      #planck's constant\n",
    "Eg=0.7;     #band gap(eV)\n",
    "e=1.6*10**-19;      #charge(c)\n",
    "\n",
    "#Calculation\n",
    "x=2*math.pi*me*kb*T/(h**2);  \n",
    "n=2*(x**(3/2))*math.exp(-Eg*e/(2*kb*T));       #density of holes and electrons(per m**3)\n",
    "\n",
    "#Result\n",
    "print \"density of holes and electrons is\",round(n/10**19,3),\"*10**19 per m**3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.4, Page number 231"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "position of Fermi level is 0.35 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",
    "kb=1.38*10**-23;      #boltzmann constant\n",
    "T=300;      #temperature(K)\n",
    "m=6;\n",
    "Eg=0.7;     #band gap(eV)\n",
    "\n",
    "#Calculation\n",
    "x=3*kb*T*math.log(m)/4;\n",
    "EF=(Eg/2)+x;            #position of Fermi level(eV)\n",
    "\n",
    "#Result\n",
    "print \"position of Fermi level is\",EF,\"eV\"\n",
    "print \"answer in the book is wrong\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.5, Page number 231"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "position of Fermi level is 0.33 eV\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "T1=300;      #temperature(K)\n",
    "T2=330;      #temperature(K)\n",
    "E=0.3;     #band gap(eV)\n",
    "\n",
    "#Calculation\n",
    "Ec_Ef=T2*E/T1;     #position of Fermi level(eV)\n",
    "\n",
    "#Result\n",
    "print \"position of Fermi level is\",Ec_Ef,\"eV\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.6, Page number 239"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall coefficient is 3.045 *10**-4 m**3/C\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=2.05*10**22;           #charge carrier density\n",
    "e=1.602*10**-19;         #charge of electron\n",
    "\n",
    "#Calculation\n",
    "RH=1/(n*e);     #hall coefficient(m**3/C)\n",
    "\n",
    "#Result\n",
    "print \"hall coefficient is\",round(RH*10**4,3),\"*10**-4 m**3/C\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.7, Page number 239"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall coefficient is -0.125 *10**-9 m**3/C\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "n=5*10**28;           #charge carrier density\n",
    "e=1.6*10**-19;         #charge of electron\n",
    "\n",
    "#Calculation\n",
    "RH=-1/(n*e);     #hall coefficient(m**3/C)\n",
    "\n",
    "#Result\n",
    "print \"hall coefficient is\",round(RH*10**9,3),\"*10**-9 m**3/C\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.8, Page number 240"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall coefficient is -0.245 *10**-9 m**3/C\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "a=4.28*10**-10;           #side(m)\n",
    "e=1.6*10**-19;         #charge of electron\n",
    "\n",
    "#Calculation\n",
    "n=2/(a**3);\n",
    "RH=-1/(n*e);     #hall coefficient(m**3/C)\n",
    "\n",
    "#Result\n",
    "print \"hall coefficient is\",round(RH*10**9,3),\"*10**-9 m**3/C\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.9, Page number 240"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall coefficient is 2.7 *10**-4 m**3/C\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "rho=9*10**-3;       #resistivity(ohm m)\n",
    "mew=0.03;     #mobility(m**2/Vs)\n",
    "\n",
    "#Calculation\n",
    "sigma=1/rho;\n",
    "RH=mew/sigma;     #hall coefficient(m**3/C)\n",
    "\n",
    "#Result\n",
    "print \"hall coefficient is\",RH*10**4,\"*10**-4 m**3/C\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.10, Page number 240"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "density of charge carrier is 1.73611 *10**22 per m**3\n",
      "mobility is 0.04 m**2/Vs\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "rho=9*10**-3;       #resistivity(ohm m)\n",
    "RH=3.6*10**-4;      #hall coefficient(m**3/C)\n",
    "e=1.6*10**-19;         #charge of electron\n",
    "\n",
    "#Calculation\n",
    "sigma=1/rho;\n",
    "rho=1/RH;   \n",
    "n=rho/e;        #density of charge carrier(per m**3)\n",
    "mew=sigma*RH;      #mobility(m**2/Vs)\n",
    "\n",
    "#Result\n",
    "print \"density of charge carrier is\",round(n/10**22,5),\"*10**22 per m**3\"\n",
    "print \"mobility is\",mew,\"m**2/Vs\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.11, Page number 241"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "charge carrier concentration is 6.25e+22 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 of electron\n",
    "z=0.3*10**-3;     #thickness(m)\n",
    "VH=1*10**-3;      #hall voltage(V)\n",
    "Ix=10*10**-3;     #current(A)\n",
    "Bz=0.3;           #magnetic field(T)\n",
    "\n",
    "#Calculation\n",
    "n=Ix*Bz/(VH*z*e);      #charge carrier concentration(m**-3)\n",
    "\n",
    "#Result\n",
    "print \"charge carrier concentration is\",n,\"m**-3\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Example number 8.12, Page number 241"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall angle is 1.0704 degrees\n"
     ]
    }
   ],
   "source": [
    "#importing modules\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "rho=0.00912;       #resistivity(ohm m)\n",
    "RH=3.55*10**-4;      #hall coefficient(m**3/C)\n",
    "B=0.48;        #flux density(Wb/m**2)\n",
    "\n",
    "#Calculation\n",
    "sigma=1/rho;\n",
    "theta_H=math.atan(sigma*B*RH);      #hall angle(radian)\n",
    "theta_H=theta_H*180/math.pi;       #hall angle(degrees)\n",
    "\n",
    "#Result\n",
    "print \"hall angle is\",round(theta_H,4),\"degrees\""
   ]
  }
 ],
 "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
}