{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 8:Mechanism of Conduction in Semiconductors"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.1,Page No:8.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Kinetic Energy = 0.1 eV\n",
      "Momentum of electrons = 4.5e-26 kg m/s\n",
      "Momentum of holes = 4.4e-26 kg m/s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Ephoton = 1.5;               # energy of photon in eV\n",
    "Eg      = 1.4;               # energy gap in eV\n",
    "m       = 9.1*10**-31;       # mass of electron in kg\n",
    "e       = 1.6*10**-19;       #charge of electron in coulombs\n",
    "me_GaAs = 0.07;              #times of electro mass in kilograms\n",
    "mh_GaAs = 0.068;             #times of electro mass in kilograms\n",
    "\n",
    "# Calculations\n",
    "Eke     = Ephoton - Eg;                    #energy on eV\n",
    "pe      = math.sqrt(2*m*me_GaAs*Eke*e)     # momentum of electrons  in kg m/s\n",
    "ph      = math.sqrt(2*m*mh_GaAs*Eke*e)     # momentum of electrons in kg m/s\n",
    "\n",
    "# Result\n",
    "print'Kinetic Energy = %3.1f'%Eke,'eV';\n",
    "print'Momentum of electrons = %3.1e'%pe,'kg m/s';\n",
    "print'Momentum of holes = %3.1e'%ph,'kg m/s';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.2,Page No:8.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Thermal equilibrium hole concentration = 1.15e+16  cm**-3\n",
      "Note: Calculation mistake in textbook Nv is not multiplied by exponentiation\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "T1  = 300;               # temperature in kelvin\n",
    "nv  = 1.04*10**19;       #in cm**-3\n",
    "T2  = 400;               #temperature in K\n",
    "fl  = 0.25;              #fermi level position in eV\n",
    "\n",
    "#Calculations\n",
    "Nv  = (1.04*10**19)*(T2/float(T1))**(3/float(2));           #Nv at 400 k in cm**-3\n",
    "kT  = (0.0259)*(T2/float(T1));                              #kT in eV\n",
    "po  = Nv*math.exp(-(fl)/float(kT));                         #hole oncentration in cm**-3\n",
    "\n",
    "\n",
    "# Result\n",
    "print'Thermal equilibrium hole concentration = %3.2e '%po,'cm**-3';\n",
    "print'Note: Calculation mistake in textbook Nv is not multiplied by exponentiation';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.3,Page No:8.27"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Intrinsic Carrier Concentration at 300K = 1.95e+06 cm**-3\n",
      "Intrinsic Carrier Concentration at 300K = 3.34e+10 cm**-3\n",
      " Note : Calculation mistake in textbook in finding carrier conc. at 450K\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Nc  = 3.8*10**17;            #constant in cm**-3\n",
    "Nv  = 6.5*10**18;            #constant in cm**-3\n",
    "Eg  = 1.42;                  # band gap energy in eV\n",
    "KT1 = 0.03885;               # kt value at 450K\n",
    "T1  = 300;                   #temperature in K\n",
    "T2  = 450;                   #temperature in K\n",
    "\n",
    "# calculation\n",
    "n1i  = math.sqrt(Nc*Nv*math.exp(-Eg/float(0.0259)));               #intrinsic carrier concentration in cm**-3\n",
    "n2i  = math.sqrt(Nc*Nv*((T2/float(T1))**3) *math.exp(-Eg/float(KT1)));     # intrinsic carrier conc at 450K in cm**-3\n",
    "\n",
    "# Result\n",
    "print'Intrinsic Carrier Concentration at 300K = %3.2e'%n1i,'cm**-3';\n",
    "print'Intrinsic Carrier Concentration at 300K = %3.2e'%n2i,'cm**-3';\n",
    "print' Note : Calculation mistake in textbook in finding carrier conc. at 450K';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.4,Page No:8.28"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The position of Fermi level with respect to middle of the bandgap is -12.7 meV\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "mh  = 0.56;             #masses interms of m0\n",
    "me  = 1.08;             #masses interms of m0\n",
    "t   = 27;               #temperature in °C\n",
    "k   = 8.62*10**-5;\n",
    "\n",
    "\n",
    "# Calculations\n",
    "T   = t+273;                                         #temperature in K\n",
    "fl  = (3/float(4))*k*T*math.log(mh/float(me));          #position of fermi level in eV\n",
    "\n",
    "#result\n",
    "print'The position of Fermi level with respect to middle of the bandgap is %3.1f'%(fl*10**3),'meV';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.5,Page No:8.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Donor binding energy = 0.0052 eV\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "mo  = 9.11*10**-31;          #mass of electron inkilograms\n",
    "e   = 1.6*10**-19;           # charge of electron in coulombs\n",
    "er  = 13.2;                  #relative permitivity in F/m\n",
    "eo  = 8.85*10**-12;          # permitivity in F/m\n",
    "h   = 6.63*10**-34;          # plancks constant J.s\n",
    "         \n",
    "\n",
    "# Calculations\n",
    "me  = 0.067*mo;  \n",
    "E   = (me*(e**4))/float((8*(eo*er)**2)*(h**2)*e);         #energy in eV    \n",
    "\n",
    "# Result\n",
    "print'Donor binding energy = %3.4f'%E,'eV';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.6,Page No:8.30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Equlibrium hole concentration = 2.25e+03 cm**-3\n",
      "Position of fermi energy level = 0.177 eV\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "no      = 10**17;            # doping carrier conc\n",
    "ni      = 1.5*10**10;        #intrinsic concentration\n",
    "kT      = 0.0259\n",
    "\n",
    "#Calculations\n",
    "po      = (ni**2)/float(no);             #Equlibrium hole concentration in cm**-3\n",
    "fl      = kT*math.log10(no/float(ni));   #Position of fermi energy level in eV\n",
    "\n",
    "#Result\n",
    "print'Equlibrium hole concentration = %3.2e'%po,'cm**-3';\n",
    "print'Position of fermi energy level = %3.3f'%fl,'eV';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.7,Page No:8.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "electrical conductivity of pure silicon =2.39e+03 ohm**-1.m**-1\n",
      "Note:calculation mistake in electrical conductivity,and units of conductivity\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "k   = 8.62*10**-5;            #in eV/K\n",
    "Eg  = 1.10;                   #energy in eV\n",
    "t1 = 200;                     #temperature in °C\n",
    "t2 = 27;                      #temperature in °C\n",
    "psi = 2.3*10**3;\n",
    "\n",
    "# Calculations\n",
    "# sigma = sigmao*exp(-Eg/(2kT))\n",
    "# k     = sigma_473/sigma_300;\n",
    "\n",
    "t3        = t1+273;                                 #temperature in K\n",
    "t4        = t2+273;                                 #temperature in K\n",
    "k1        = math.exp((-Eg)/float(2*k*t3));          #electrical conductivity in cm**-1.m**-1\n",
    "k2        = math.exp((-Eg)/float(2*k*t4));          #lectrical conductivity in cm**-1.m**-1\n",
    "k         = k1/float(k2);\n",
    "pm        = k/float(psi);\n",
    "\n",
    "#Result\n",
    "\n",
    "print'electrical conductivity of pure silicon =%3.2e'%k,'ohm**-1.m**-1';\n",
    "print'Note:calculation mistake in electrical conductivity,and units of conductivity';\n",
    " "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.8,Page No:8.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resistivity = 0.5 Ω-m\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "ni  = 2.5*10**19;            # carrier density in per m**3\n",
    "q   = 1.6*10**-19;           # charge of electron in coulombs\n",
    "un  = 0.35;                 #mobility of electrons in m**2/V-s\n",
    "up  = 0.15;                 #mobility of electrons in m**2/V-s\n",
    "\n",
    "# Calculations\n",
    "sigma = ni*q*(un + up);         #conductivity in per Ω-m\n",
    "p     = 1/float(sigma);                #resistivity in Ω-m\n",
    "\n",
    "\n",
    "# Result\n",
    "print'Resistivity = %3.1f'%p,'Ω-m';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.9,Page No:8.33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Intrinsic Carrier Concentration = 1.04e+16 m**-3\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p  = 3.16*10**3;            # resistivity Ω-m\n",
    "e  = 1.6*10**-19;           # charge of electron in coulombs\n",
    "ue = 0.14;                 #mobility of electrons in m**2/V-s\n",
    "uh = 0.05;                  #mobility of holes in m**2/V-s\n",
    "\n",
    "# Calculations\n",
    "\n",
    "n  = 1/float((p*e)*(ue + uh));           #carrier density  in m**-3\n",
    "\n",
    "# Result\n",
    "print'Intrinsic Carrier Concentration = %3.2e'%n,'m**-3';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.10,Page No:8.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The factor by which the majority conc. is more than the intrinsic carrier conc = 2942\n",
      "Hole concentration = 5.1e+15 m**-3\n",
      "Conductivity = 2542 ohm**-1 m**-1\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p   = 5.32*10**3;        #density of germanium\n",
    "Nav = 6.023*10**26;      # Avagadros number\n",
    "AW  = 72.59;            # atomic wt\n",
    "ni  = 1.5*10**19;        # carrier density\n",
    "ue  = 0.36;\n",
    "uh  = 0.18;\n",
    "e   = 1.6*10**-19;\n",
    "\n",
    "# calculations\n",
    "N   = (p*Nav)/float(AW);            # no of germanium atoms per unit volume\n",
    "Nd  = N*10**-6 ;                   # no of pentavalent impurity atoms/m**3\n",
    "f   = Nd/float(ni);\n",
    "nh  = (ni**2)/float(Nd);           # hole concentration\n",
    "sigma = e*((Nd*ue)+(nh*uh));\n",
    "\n",
    "#Result\n",
    "print'The factor by which the majority conc. is more than the intrinsic carrier conc = %d'%f;\n",
    "print'Hole concentration = %3.1e'%nh,'m**-3';\n",
    "print'Conductivity = %d'%sigma,'ohm**-1 m**-1';\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.11,Page No:8.34"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Carrier Density = 3.1e+21 m**-3\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p   = 5*10**-3;          # resistivity in Ω-m\n",
    "ue  = 0.3;              # electron mobility m**2/volt-s\n",
    "uh  = 0.1;              # hole mobility m**2/volt-s\n",
    "e   = 1.6*10**-19        # charge of electron in coulombs\n",
    "\n",
    "# calculations\n",
    "sigma   = 1/float(p);                        # conductivity in per Ω -m\n",
    "n       = sigma/float(e*(ue + uh));          # carrier density per m**3\n",
    "\n",
    "#Result\n",
    "print'Carrier Density = %3.1e'%n,'m**-3';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.12,Page No:8.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Drift velocity = 10 m/s\n",
      " time = 1e-05 s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Jd  = 500;                   # current density A/m**2\n",
    "p   = 0.05;                  # resistivity in Ω-m\n",
    "l   = 100*10**-6;            #  travel length m\n",
    "ue  = 0.4;                   # electron mobility m**2/Vs\n",
    "e   = 1.6*10**-19;            # charge of electron in coulombs\n",
    "\n",
    "\n",
    "# Calculations\n",
    "ne  = 1/float(p*e*ue);            #in per m**3\n",
    "vd  = Jd/float(ne*e);            #drift velocity in m/s\n",
    "t   = l/float(vd);                 #time teken in s\n",
    "\n",
    "#result\n",
    "print'Drift velocity = %d'%vd,'m/s';\n",
    "print' time = %3.0e'%t,'s';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.13,Page No:8.35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "temperature rise is of = 5.91 K\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "\n",
    "#psi1 is increased by 30%, psi1/ps2 is 130/100\n",
    "a    = 1.3;                  #ratio of psi1/psi2\n",
    "K    = 8.82*10**-5;              #constant in eV/K\n",
    "Eg   = 0.719;                  #band gap in eV/K\n",
    "T    = 300;                      #temperature in K\n",
    "\n",
    "#calculation\n",
    "d=1/float((1/float(T))-((2*K/float(Eg))*math.log(1.3)));\n",
    "dT=d-T;                                             #temperature rise in  K\n",
    "\n",
    "\n",
    "#result\n",
    "print'temperature rise is of = %3.2f'%dT,'K';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.14,Page No:8.39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Conductivity of the compensated p-type semiconductor is 0.492\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "v   = 5;            # voltage in volts\n",
    "r   = 10;           # resistance in k-ohm\n",
    "J   = 60;           # current density in A/cm**2\n",
    "E   = 100;          # electric field in V.m**-1\n",
    "Nd  = 5*10**15;      # in cm**-3\n",
    "up  = 410;          # approx hole mobility cm**2/V-s\n",
    "Na  = 1.25*10**16;   # approx in cm**-3\n",
    "e   = 1.6*10**-19;   # charge of electron in coulombs\n",
    "\n",
    "#Calculations\n",
    "I       = v/float(r);              # total current A\n",
    "A       = I/float(J);               # cross sectional area cm**2\n",
    "L       = v/float(E)                 # length of resistor cm\n",
    "sigma   = L/float(r*A);        #conductivity in (Ω-cm)**-1\n",
    "sigma_comp = e*up*(Na - Nd);        #conductivity in (Ω-cm)**-1\n",
    "\n",
    "# Result\n",
    "print'Conductivity of the compensated p-type semiconductor is %3.3f'%sigma_comp;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.15,Page No:8.39"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Diffusion Current Density = 120  A/cm**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "e   = 1.6*10**-19;       # charge of electron in coulombs\n",
    "Dn  = 250;              # electron diffusion co-efficient cm**2/s\n",
    "n1  = 10**18;             # electron conc. in cm**-3\n",
    "n2  = 7*10**17;         # electron conc. in cm**-3\n",
    "dx  = 0.10;              # distance in cm\n",
    "\n",
    "# Calculations\n",
    "Jdiff   = e*Dn*((n1-n2)/float(dx));    #diffusion current density A/cm**2\n",
    "\n",
    "#Result\n",
    "print'Diffusion Current Density = %d '%Jdiff,'A/cm**2';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.16,Page No:8.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wavelength at which Ge starts to absorb light = 16550  Å\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "# Variable declaration\n",
    "e   = 1.6*10**-19;         # charge of electron in coulombs\n",
    "Eg  = 0.75;                #bandgap energy eV\n",
    "c   = 3*10**8;             # velocity of light in m\n",
    "h   = 6.62*10**-34;        # plancks constant in J.s\n",
    "\n",
    "# Calculations\n",
    "lamda   = (h*c)/float(Eg*e);     # wavelength in Å\n",
    "\n",
    "#Result\n",
    "print'Wavelength at which Ge starts to absorb light = %d '%(lamda*10**10),'Å';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.17,Page No:8.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "cutoff wavelength =0.92  um\n"
     ]
    }
   ],
   "source": [
    "# import math\n",
    "\n",
    "#variable declaration\n",
    "Eg        = 1.35*1.6*10**-19;           #energy in eV\n",
    "h         = 6.63*10**-34;               #plancks constant in J.s\n",
    "c         = 3*10**8;                    #velocity in m\n",
    "  \n",
    "#calculation\n",
    "lamda     = (h*c)/float(Eg);             #wavelength in m\n",
    "  \n",
    "#result\n",
    "print'cutoff wavelength =%3.2f '%(lamda*10**6),'um';\n",
    "  "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.18,Page No:8.43"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "bandgap energy = 0.701 eV\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "h     = 6.62*10**-34            # plancks constant J.s\n",
    "c     = 3*10**8;                # velocity of light in m\n",
    "lamda = 1771*10**-9;            # wavelengthg in m\n",
    "e     = 1.6*10**-19             # charge of electron in coulombs\n",
    "\n",
    "# Calculations\n",
    "Eg  = (h*c)/float(lamda*e);      #bandgap energy eV\n",
    "\n",
    "#Result\n",
    "print'bandgap energy = %3.3f'%Eg,'eV';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.19,Page No:8.45"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hall Voltage = 5.6  mV\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "Nd  = 10**21;             # donar density per in  m**3\n",
    "H   = 0.6;                # magnetic field in T\n",
    "J   = 500;                # current density A/m**2\n",
    "d   = 3*10**-3;           # width in m\n",
    "e   = 1.6*10**-19         # charge of electron coulombs\n",
    "\n",
    "#Calculations\n",
    "Ey  = (J*H)/float(Nd*e);      # field in V/m \n",
    "vh  = Ey*d;                   # hall voltage V\n",
    "\n",
    "#Result\n",
    "print'Hall Voltage = %3.1f '%(vh*10**3),'mV';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.20,Page No:8.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Current density = 2304  Ampere/m**2\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "e   = 1.6*10**-19;        # charge of electron in coulomb\n",
    "Rh  = -0.0125;          # hall co-efficient\n",
    "ue  = 0.36;             # electron mobility\n",
    "E   = 80;               # electric field\n",
    "\n",
    "# Calculations\n",
    "n   = -1/float(Rh*e);\n",
    "J   = n*e*ue*E          # current density in Ampere/m**2\n",
    "\n",
    "# Result\n",
    "print'Current density = %d '%J,'Ampere/m**2';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8.21,Page No:8.46"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Hall angle = 1.1740  °\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "p   = 0.00893;                # resistivity  in ohm-m  \n",
    "Hz  = 0.5;                    # field in weber/m**2\n",
    "Rh  = 3.66*10**-4;             # hall co-efficient hall coefficient in m**3\n",
    "\n",
    "# Calculations\n",
    "\n",
    "u      = Rh/float(p);                                   #mobility of charge cerrier in m**2*(V**-1)*s**-1\n",
    "theta_h = (math.atan(u*Hz))*(180/float(math.pi));      # hall angle in degrees\n",
    "\n",
    "# Result\n",
    "print'Hall angle = %3.4f '%theta_h,'°';"
   ]
  }
 ],
 "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.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}