{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 , Semiconductor Physics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.1 , Page Number 54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Velocity of electron at fermi level is  859007.52  m/s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "m = 9.107 * 10**-31               #Mass of electron (in kilogram)\n",
    "E = 2.1                           #Energy associated (in electon-volt)\n",
    "e = 1.6 * 10**-19                 #Charge on electron (in Coulomb)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "E = E * e                         #Energy associated (in Joules)\n",
    "v = (2 * E / m)**0.5              #Velocity of electron (in meter per second)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Velocity of electron at fermi level is \",round(v,2),\" m/s.\"\n",
    "\n",
    "#Slight variation due to higher precision."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.2 , Page Number 63 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drift velocity is  0.0003  m/s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "J = 2.4 * 10**6                 #Current Density (in Ampere per meter-square)               \n",
    "n = 5.0 * 10**28                #Electron density     \n",
    "e = 1.6 * 10**-19               #Charge on electron (in Coulomb)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "v = J / (e * n)                 #Drift velocity (in meter per second) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Drift velocity is \",v,\" m/s.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.3 , Page Number 64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Magnitude of current is  0.24  A.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "n = 10**24                     #Electron density           \n",
    "e = 1.6 * 10**-19              #Charge on electron (in Coulomb)\n",
    "v = 1.5 * 10**-2               #Drift velocity (in meter per second)\n",
    "A = 1.0 * 10**-4               #Area of cross-section (in meter-square)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "I = e * n * v * A              #Current (in Ampere) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Magnitude of current is \",I,\" A.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.4 , Page Number 64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Concentration of electrons is  4.44600943977e+16  /cm**3.\n",
      "Concentration of holes is  14057550000.0   \\cm**3.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "p = 0.039                       #Resistivity of doped material (in ohm-centimeter)\n",
    "e = 1.602 * 10**-19             #Charge on electron (in Coulomb)\n",
    "ue = 3600.0                     #Carrier mobility (in centimeter-square per volt-second)\n",
    "ni = 2.5 * 10**13               #Intrinsic concentration (in per cubic-centimeter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "\n",
    "sign = 1/p                      #Conductivity (in per ohm-centimeter)\n",
    "ND = sign /(e * ue)             #Concentration of donor atoms (in per cubic-centimeter)\n",
    "n = ND                          #Concentration of electron (per cubic-centimeter)\n",
    "p = ni**2 / n                   #Concentration of hole (per cubic-centimeter)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Concentration of electrons is \",n,\" /cm**3.\\nConcentration of holes is \",p,\"  \\cm**3.\"\n",
    "\n",
    "#Slight variation due to higher precision."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5 , Page Number 64 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resulting donor concentration is  50000000000000000  /cm**3.\n",
      "Resulting mobile electron concentration is  50000000000000000  /cm**3.\n",
      "Resulting hole concentration is  4205.0  /cm**3.\n",
      "Conductivity of doped silicon sample is  10.413  (ohm-cm)**-1.\n",
      "Resistivity is  0.096033803899  ohm-cm and Resistance is  1920.67607798  ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "N = 5.0 * 10**22                #Number of silicon atoms (per cubic-centimeter)\n",
    "N1 = 10**-6                     #Donor impurity \n",
    "ni = 1.45 * 10**10              #Intrinsic concentration (in per cubic-centimeter)  \n",
    "l = 0.5                         #Length (in centimeter)\n",
    "A = (50.0 * 10**-4)**2          #Area of cross-section (in centimeter-square)\n",
    "ue = 1300.0                     #Mobility of electron (in ) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "ND = 5 * 10**16                 #Donor concentration (in per cubic-centimeter)\n",
    "n = ND                          #Mobile electron concentration (in per cubic-centimeter)\n",
    "p = ni**2 / ND                  #Hole concentration (in centimeter-square per volt-second)\n",
    "sig = n * e * ue                #Conductivity of doped silicon sample (in per ohm-cetimeter)\n",
    "p1 = 1/sig                      #Resistivity (in ohm-centimeter)\n",
    "R = p1 * l / A                  #Resistance (in ohm)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Resulting donor concentration is \",ND,\" /cm**3.\\nResulting mobile electron concentration is \",n,\" /cm**3.\\nResulting hole concentration is \",p,\" /cm**3.\"\n",
    "print \"Conductivity of doped silicon sample is \",sig,\" (ohm-cm)**-1.\\nResistivity is \",p1,\" ohm-cm and Resistance is \",R,\" ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.6 , Page Number 65 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ratio of electron to hole concentration is  1e+12 .\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ni = 1.4 * 10**18                   #intrinsic concentration (in per cubic-centimeter)\n",
    "ND = 1.4 * 10**24                   #Donor concentration (in per cubic-centimeter)\n",
    "n = ND                              #Concentration of electrons (in per cubic-centimeter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "p = ni**2 / ND                      #Concentration of holes (in per cubic-centime) \n",
    "ratio = n / p                       #Ratio of electron to hole concentration \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Ratio of electron to hole concentration is \",ratio,\".\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.7 , Page Number 65"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Relaxation time is  4.004e-14  s.\n",
      "Resistivity of conductor is  1.53066222571e-08 ohm-meter.\n",
      "Velocity of electrons with fermi energy is  1390706.99073  m/s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Ef = 5.5                             #Fermi energy (in electron-volt)\n",
    "ue = 7.04 * 10**-3                   #Mobility of electrons (in meter-square per volt-second)\n",
    "n = 5.8 * 10**28                     #Concentration of electrons (in per cubic-centimeter)\n",
    "e = 1.6 * 10**-19                    #Charge on electron (in Coulomb)\n",
    "m = 9.1 * 10**-31                    #Mass of electron (in kilogram)  \n",
    "\n",
    "#Calculation\n",
    "\n",
    "tau = ue * m / e                     #Relaxation time (in seconds)\n",
    "p = 1 / (n * e * ue)                 #Resistivity (in ohm-meter) \n",
    "vf = (2 * Ef * e / m)**0.5           #Velocity of electron with fermi energy (in meter per second)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Relaxation time is \",tau,\" s.\\nResistivity of conductor is \",p,\"ohm-meter.\\nVelocity of electrons with fermi energy is \",vf,\" m/s.\"\n",
    "\n",
    "#Slight variation due to higher precision."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.8 , Page Number 68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Conductivity is  0.0224  (ohm-cm)**-1.\n",
      "Resistivity is  44.64  ohm-cm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ni = 2.5 * 10**13                 #Intrinsic concentration (in per cubic-centimeter)\n",
    "e = 1.6 * 10**-19                 #Charge on electron (in Coulomb)\n",
    "uh = 1800.0                       #Mobility of holes (in per cubic-centimeter)\n",
    "ue = 3800.0                       #Mobility of electrons (in per cubic-centimeter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "sigi = ni * e * (ue + uh)         #Conductivity (in per ohm-centimeter)\n",
    "pi = 1/sigi                       #Resistivity (in ohm-centimeter)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Conductivity is \",sigi,\" (ohm-cm)**-1.\\nResistivity is \",round(pi,2),\" ohm-cm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.9 , Page Number 68 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Density of electrons is  2.29273661042e+19  /m**3.\n",
      "Drift velocity of electrons is  3900.0  m/s.\n",
      "Drift velocity of holes is  1900.0  m/s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "pi = 0.47                        #intrinsic resistivity (in ohm-meter)\n",
    "ue = 0.39                        #Electron mobility (in meter-square per volt-second)\n",
    "uh = 0.19                        #Hole mobility (in meter-square per volt-second)\n",
    "e = 1.6 * 10**-19                #Charge on electron (in Coulomb)\n",
    "E = 10**4                        #Electric field (in volt per meter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "sigi = 1 / pi                    #Conductivity (in per ohm-meter)\n",
    "ni = sigi/(e * (ue + uh))        #Intrinsic concentration (in per cubic-meter)\n",
    "vn = ue * E                      #Drift velocity of electrons (in meter per second)\n",
    "vh = uh * E                      #Drift velocity of holes (in meter per second) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Density of electrons is \",ni,\" /m**3.\\nDrift velocity of electrons is \",vn,\" m/s.\\nDrift velocity of holes is \",vh,\" m/s.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.10 , Page Number 69 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Conductivity of intrinsic silicon is  4.2e-06  /ohm-cm.\n",
      "Conductivity of P type silicon is  72.0  ohm-cm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ni = 1.5 * 10**10                #Intrinsic concentration (in per cubic-centimeter)\n",
    "uh = 450.0                       #mobility of holes (in centimeter-square per volt-second)\n",
    "ue = 1300.0                      #mobility of electrons (in centimeter-square per volt-second)\n",
    "NA = 10**18                      #Doping level (in per cubic-centimeter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "sigi = ni * e * (ue + uh)        #Conductivity of silicon (in per ohm-centimeter)\n",
    "sigp = e * NA * uh               #COnductivity of P-type silicon (in per ohm-centimeter)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Conductivity of intrinsic silicon is \",sigi,\" /ohm-cm.\\nConductivity of P type silicon is \",sigp,\" ohm-cm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.11 , Page Number 69 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Conductivity of intrinsic semiconductor is  0.0224  /ohm-cm.\n",
      "Conductivity of N-type semiconductor is  2.68  /ohm-cm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ni = 2.5 * 10**13                          #Intrinsic concentration (in per cubic-centimeter)\n",
    "e = 1.6 * 10**-19                          #Charge on electron (in Coulomb)\n",
    "uh = 1800.0                                #mobility of holes (in centimeter-square per volt-second)\n",
    "ue = 3800.0                                #mobility of electrons (in centimeter-square per volt-second)\n",
    "ND = 4.41 * 10**22 * 10**-7                #Number of Germanium atoms (in per cubic-centimeter)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "sigi = ni * e * (uh + ue)                  #Intrinsic concentration (in per ohm-centimeter)\n",
    "n = ND                                     #Concentration of electrons (in per cubic-centimeter)\n",
    "p = ni**2 / ND                             #Concentration of holes (in per cubic-centimeter)\n",
    "sign = e * ND * ue                         #Conductivity of N-type germanium semiconductor (in per ohm-meter)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Conductivity of intrinsic semiconductor is \",sigi,\" /ohm-cm.\\nConductivity of N-type semiconductor is \",round(sign,2),\" /ohm-cm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.12 , Page Number 69"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Electron drift velocity is  152.0  m/s.\n",
      "Holes drift velocity is  72.0  m/s.\n",
      "Intrinsic conductivity of Ge is  2.24  /ohm-m.\n",
      "Total current is  5.376  mA.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "V = 10.0                              #Voltage (in volts)\n",
    "l = 0.025                             #Length (in meter)\n",
    "uh = 0.18                             #mobility of holes (in meter-square per volt-second)\n",
    "ue = 0.38                             #mobility of electrons (in meter-square per volt-second)\n",
    "ni = 2.5 * 10**19                     #Intrinsic concentration (in per cubic-imeter)\n",
    "a = 4.0 * 1.5 *10**-6                 #Area of cross-section (in meter-square)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "E = V / l                             #Electric field (in volt per meter)\n",
    "ve = ue * E                           #Drift velocity of electrons (in meter per second)\n",
    "vh = uh * E                           #Drift velocity of holes (in meter per second)\n",
    "sigi = ni * e * (ue + uh)             #Conductivity of intrinsic semiconductor (in per ohm-meter)\n",
    "I = sigi * E * a                      #Total current (in Ampere) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Electron drift velocity is \",ve,\" m/s.\\nHoles drift velocity is \",vh,\" m/s.\\nIntrinsic conductivity of Ge is \",sigi,\" /ohm-m.\\nTotal current is \",I * 10**3,\" mA.\" "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.13 , Page Number 70 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Diffusion constant of electron is  93.0  cm**2/s.\n",
      "Diffusion constant of holes is  43.9875  cm**2/s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ni = 2.5 * 10**13                          #Intrinsic concentration (in per cubic-centimeter)\n",
    "e = 1.6 * 10**-19                          #Charge on electron (in Coulomb)\n",
    "uh = 1700.0                                #mobility of holes (in centimeter-square per volt-second)\n",
    "ue = 3600.0                                #mobility of electrons (in centimeter-square per volt-second)\n",
    "k = 1.38 * 10**-23                         #Boltzmann constant (in Joule per kelvin)\n",
    "T = 300.0                                  #Temperature (in kelvin)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "De = ue * k * T / e                        #Diffusion constant of electrons (in centimeter-square per second)\n",
    "Dh = uh * k * T / e                        #Diffusion constant of holes (in centimeter-square per second)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Diffusion constant of electron is \",round(De),\" cm**2/s.\\nDiffusion constant of holes is \",Dh,\" cm**2/s.\"\n",
    "\n",
    "#Slight variation in Dh due to higher precision."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.14 , Page Number 72"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mobility of charge carriers is  4e-08  m**2/V-s.\n",
      "Density of charge carriers is  1.73611111111e+22  /m**3.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "p = 9.0 * 10**3                   #Resistivity (in ohm-meter)\n",
    "RH = 3.6 * 10**-4                 #Hall coefficient (in cubic-meter per Coulomb) \n",
    "e = 1.6 * 10**-19                 #Charge on electron (in Coulomb)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "sig = 1/p                         #Conductivity (in per ohm-meter)\n",
    "P = 1/ RH                         #Charge density (in Coulomb per cubic meter)\n",
    "n = P / e                         #Density of charge carriers (in per cubic-meter)\n",
    "u = sig * RH                      #Mobility (in meter-square per volt-second)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Mobility of charge carriers is \",u,\" m**2/V-s.\\nDensity of charge carriers is \",n,\" /m**3.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.15 , Page Number 73"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The current density in the specimen is  2482.76  A/m**2\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "E = 100.0                           #Electric field (in volt per meter)\n",
    "RH = 0.0145                         #Hall coefficient (in cubic-meter per Coulomb)\n",
    "un = 0.36                           #Mobility of electrons (in meter-square per volt-second)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "n = 1/(e * RH)                      #Concentration (in per cubic-meter)\n",
    "J = n * e * un * E                  #Current density (in Ampere per cubic-meter)  \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"The current density in the specimen is \",round(J,2),\" A/m**2\"\n",
    "\n",
    "#Slight variation due to higher precision."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.16 , Page Number 73"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hall coefficient is  0.00027  m**3/C.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "p = 9.0 * 10**-3                  #Resistivity (in ohm-meter)\n",
    "e = 1.6 * 10**-19                 #Charge on electron (in Coulomb)\n",
    "u = 0.03                          #Mobility of carrier ion (in meter-square per volt-second)\n",
    "\n",
    "\n",
    "#Calculation\n",
    "\n",
    "sig = 1/p                         #Conductivity (in per ohm-meter)\n",
    "RH = u / sig                      #Hall coefficient (in cubic-meter per Coulomb)             \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Hall coefficient is \",RH,\" m**3/C.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.17 , Page Number 73"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Hall coefficient is  0.0003049  m**3/C.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "p = 9.0 * 10**3                   #Resistivity (in ohm-meter)\n",
    "e = 1.6 * 10**-19                 #Charge on electron (in Coulomb)\n",
    "n = 2.05 * 10**22                 #Charge carrier density (in per cubic-meter)  \n",
    "\n",
    "#Calculation\n",
    "\n",
    "RH = 1/(n * e)                    #Hall coefficient (in cubic-meter per Coulomb) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Hall coefficient is \",round(RH,7),\" m**3/C.\"\n",
    "\n",
    "#Slight variation due to higher precision."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.18 , Page Number 73"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hall voltage is  76.0  mV.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "Ex = 5.0 * 10**2                     #Applied Electric field (in volt per meter)\n",
    "ue = 3800.0 * 10**-4                 #Mobility of electron (in meter-square per volt-second) \n",
    "Bz = 0.1                             #Magnetic flux density (in Weber per meter-square) \n",
    "d = 4.0 * 10**-3                     #width (in meter) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "v = ue * Ex                          #Drift velocity (in meter per second)\n",
    "VH = Bz * v * d                      #Hall voltage (in volts)  \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Hall voltage is \",VH * 10**3,\" mV.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.19 , Page Number 74"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Mobility of holes is  0.075  m**2/V-s.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "p = 200.0 * 10                      #Bar resistivity (in ohm-meter) \n",
    "VH = 50.0 * 10**-3                  #Hall voltage (in volts)\n",
    "BZ = 0.1                            #Magnetic flux density (in Weber per meter-square) \n",
    "w = 3.0 * 10**-3                    #width (in meter)\n",
    "d = w                               #length (in meter)\n",
    "I = 10.0 * 10**-6                   #Current (in Ampere)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "RH = VH * w / (BZ * I)              #Hall coefficient (in cubic-meter per Coulomb)\n",
    "uh = RH / p                         #Mobility of holes (in meter-square per volt-second)  \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Mobility of holes is \",uh,\" m**2/V-s.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.20 , Page Number 74"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hall voltage is  3.0  mV.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ND = 1.0 * 10**21                       #Concentration of donor atoms (in per cubic-meter)\n",
    "BZ = 0.2                                #Magnetic field density (in Tesla)\n",
    "J = 600.0                               #Current density (in Ampere per meter-square)\n",
    "n = ND                                  #Concentration of electrons (in per cubic-meter)\n",
    "d = 4.0 * 10**-3                        #Length (in meter) \n",
    "e = 1.6 * 10**-19                       #Charge on electron (in Coulomb)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "VH = BZ * J * d / (n * e)               #Hall voltage (in volts) \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Hall voltage is \",VH * 10**3,\" mV.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.21 , Page Number 82 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "New position of Fermi level is  0.328  eV\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "T = 300.0                                #Temperature (in kelvin)\n",
    "Ec_Ef = 0.3                              #Energy level (in electron-volt)  \n",
    "T1 = 273 + 55                            #New temperature (in kelvin)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "logencbyND = Ec_Ef/T                     #Value of loge(nc / ND)\n",
    "Ec_Ef1 = T1 * logencbyND                 #New position of Fermi level (in electron-volt)    \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"New position of Fermi level is \",Ec_Ef1,\" eV\"\n",
    "\n",
    "#Unit in the book should be eV instead of V."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.22 , Page Number 83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Potential barrier is  0.19  eV.\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variables\n",
    "\n",
    "ND = NA = 8.0 * 10**14                     #Concentration (in per cubic-meter)\n",
    "ni = 2.0 * 10**13                          #Intrinsic concentration (in per cubic-meter)\n",
    "k = 8.61 * 10**-5                          #Boltzmann constant (in electron-volt per kelvin)\n",
    "T = 300.0                                  #Temperature (in kelvin)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "Vo = k * T * math.log(ND * NA/ni**2)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Potential barrier is \",round(Vo,2),\" eV.\"\n",
    "\n",
    "#Unit in the book should be eV instead of V."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.23 , Page Number 83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "R1 is  250.0  ohm.\n",
      "R2 is  40.0  ohm.\n",
      "R3 is  10.0  Mega-ohm.\n"
     ]
    }
   ],
   "source": [
    "#Variables\n",
    "\n",
    "ID1 = 2.0 * 10**-3                     #Diode current1 (in Ampere)\n",
    "VD1 = 0.5                              #Diode voltage1 (in volts)\n",
    "ID2 = 20.0 * 10**-3                    #Diode current2 (in Ampere)\n",
    "VD2 = 0.8                              #Diode voltage2 (in volts)\n",
    "ID3 = -1.0 * 10**-6                    #Diode current3 (in Ampere)\n",
    "VD3 = -10.0                            #Diode voltage3 (in volts)\n",
    "\n",
    "#Calculation\n",
    "\n",
    "R1 = VD1 / ID1                         #Resistance1 (in ohm)\n",
    "R2 = VD2 / ID2                         #Resistance2 (in ohm)\n",
    "R3 = VD3 / ID3                         #Resistance3 (in ohm)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"R1 is \",R1,\" ohm.\\nR2 is \",R2,\" ohm.\\nR3 is \",R3 * 10**-6,\" Mega-ohm.\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.24 , Page Number 83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Fraction of the total number of electrons in the conduction band at 300 K is  8.85 e-7 .\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variables\n",
    "\n",
    "k = 8.61 * 10**-5                          #Boltzmann constant (in electron-volt per kelvin)\n",
    "T = 300.0                                  #Temperature (in kelvin)\n",
    "EG = 0.72                                  #Energy band gap (in electron-volt) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "EF = 1.0/2 * EG                            #Fermi level (in electron-volt)\n",
    "ncbyn = 1/(1 + math.exp((EG-EF)/(k*T)))    #Ratio\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Fraction of the total number of electrons in the conduction band at 300 K is \",round(ncbyn*pow(10,7),2),\"e-7 .\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.25 , Page Number 83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Since electron concentration 5.32 e+16 is more than hole concentration  1.33 e+16 .Therefore , Si is of n-type.\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#Variables\n",
    "\n",
    "Ao = 4.83 * 10**21                         #Constant\n",
    "T = 300.0                                  #Temperature (in kelvin)\n",
    "EG = 1.1                                   #Energy level (in electron-volt)\n",
    "kT = 0.026                                 #Product of k and T (in electron-volt)\n",
    "ND = 5.0 * 10**15                          #Donor concentration (in per cubic-meter)  \n",
    "NA = 2.0 * 10**16                          #Acceptor concentration (in per cubic-meter) \n",
    "\n",
    "#Calculation\n",
    "\n",
    "ni = Ao * T**1.5 * math.exp(-EG/(2*kT))    #Intrinsic concentration (in per cubic-meter)\n",
    "h = ni**2 / NA                             #Hole concentration (in per cubic-meter)\n",
    "n = ni**2 / ND                             #Electron concentration (in per cubic-meter)\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Since electron concentration\",round(n*10**-16,2),\"e+16 is more than hole concentration \",round(h*10**-16,2),\"e+16 .Therefore , Si is of n-type.\"\n",
    "\n",
    "#Slight variations due to higher precision."
   ]
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}