{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1 - Semiconductor Physics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 24 example 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "minority concentration   =   2.25e+12 per metre square\n",
      "shift in fermi   =   0.23 volt\n",
      "minority concentration when n doubled   =   9.00e+12 per cubic metre\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "incaco=1.5*10**16##cubic metre\n",
    "resist=2*10**3##ohm metre\n",
    "dopcon=10**20##metre\n",
    "q=26*10**-3##electron volt\n",
    "#(1)\n",
    "w=2.25*10**32/dopcon#\n",
    "#(3)\n",
    "shifer=q*log(dopcon/incaco)##shift in fermi level\n",
    "ni=9*10**32#\n",
    "#(3)\n",
    "w1=ni/dopcon#\n",
    "print \"minority concentration   =   %0.2e\"%((w)),\"per metre square\"#\n",
    "print \"shift in fermi   =   %0.2f\"%((shifer)),\"volt\"#\n",
    "print \"minority concentration when n doubled   =   %0.2e\"%((w1)),\"per cubic metre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 25 example 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity   =   7.12e+24 second per metre\n",
      "drift velocity   =   10.44 metre per second\n",
      "density   =   2.14e+28 ampere per cubic metre\n"
     ]
    }
   ],
   "source": [
    "numfre=7.87*10**28##per cubic metre\n",
    "molity=34.8##square centimetre/velocity second\n",
    "e=30##volt per centimetre\n",
    "#(1)\n",
    "molity=molity*10**-4#q=1.6*10**-19#\n",
    "conduc=numfre*q*molity#\n",
    "#(2)\n",
    "e=e*10**2#\n",
    "veloci=(molity*e)#\n",
    "curden=conduc*e#\n",
    "print \"conductivity   =   %0.2e\"%((conduc)),\"second per metre\"#\n",
    "print \"drift velocity   =   %0.2f\"%((veloci)),\"metre per second\"#\n",
    "print \"density   =   %0.2e\"%((curden)),\"ampere per cubic metre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 26 example 3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity   =   0.0224 second per centimetre\n",
      "conductivity at extent of 1 impurity   =   0.30 second per centimetre\n",
      "conductivity  acceptor to extent of 1 impurity   =   1.30 second per centimetre\n"
     ]
    }
   ],
   "source": [
    "ni=2.5*10**13##per square centimetre\n",
    "moe=3800#square centimetre/velocity second\n",
    "mo1=1800##square centimetre/velocity second\n",
    "num=4.51*10**22##number of atoms\n",
    "q=1.6*10**-19#\n",
    "conduc=ni*q*(moe+mo1)#\n",
    "num=num/10**7#\n",
    "impura=(ni**2)/num#\n",
    "ni=5*10**14#\n",
    "condu1=ni*q*moe#\n",
    "print \"conductivity   =   %0.4f\"%((conduc)),\"second per centimetre\"#\n",
    "print \"conductivity at extent of 1 impurity   =   %0.2f\"%((condu1)),\"second per centimetre\"##there is mistake in book as 3.04s/cm\n",
    "conduc=num*q*mo1#\n",
    "print \"conductivity  acceptor to extent of 1 impurity   =   %0.2f\"%((conduc)),\"second per centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 27 example 4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity intrinisc at 300kelvin   =   4.32e-06 second per centimetre\n",
      "conductivity when donor atom added to extent of 1 impurity   =   0.104 second per centimetre\n",
      "conductivity when acceptor added to extent of 1 impurity   =   0.040 second per centimetre\n"
     ]
    }
   ],
   "source": [
    "ni=1.5*10**10##per cubic centimetre\n",
    "moe=1300##square centimetre/velocity second\n",
    "mo1=500##square centimetre/velocity second\n",
    "w=5*10**22##atoms per cubic centimetre\n",
    "q=1.6*10**-19#\n",
    "#(a) conductivity intrinisc at 300kelvin\n",
    "conduc=ni*q*(moe+mo1)##conductivity\n",
    "u=((ni)/(5*10**14))#\n",
    "ni=5*10**14#\n",
    "#(b)conductivity when donor atom added to extent of 1 impurity\n",
    "condu1=ni*q*moe#\n",
    "print \"conductivity intrinisc at 300kelvin   =   %0.2e\"%((conduc)),\"second per centimetre\"#\n",
    "print \"conductivity when donor atom added to extent of 1 impurity   =   %0.3f\"%((condu1)),\"second per centimetre\"#\n",
    "#conductivity when acceptor added to extent of 1 impurity\n",
    "conduc=ni*q*mo1#\n",
    "print \"conductivity when acceptor added to extent of 1 impurity   =   %0.3f\"%((conduc)),\"second per centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 28 example 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conductivity intrinisc at 300kelvin   =   0.022 second per centimetre\n",
      "conductivity with donor impurity 1   =   27.36 second per centimetre\n",
      "conductivity with acceptor impurity 1   =   2.88e-09 second per centimetre\n",
      "conductivity on both   =   24.62 second per centimetre\n"
     ]
    }
   ],
   "source": [
    "ni=2.5*10**13##per cubic centimetre\n",
    "moe=3800##square centimetre/velocity second\n",
    "mo1=1800##square centimetre/velocity second\n",
    "w=4.5*10**22##atoms per cubic centimetre\n",
    "q=1.6*10**-19#\n",
    "#(1) conductivity intrinisc at 300kelvin\n",
    "conduc=ni*q*(moe+mo1)#\n",
    "u=10**6#\n",
    "u=((w)/(u))#\n",
    "#(2) conductivity with donor impurity 1\n",
    "condu1=u*q*moe#\n",
    "print \"conductivity intrinisc at 300kelvin   =   %0.3f\"%((conduc)),\"second per centimetre\"#\n",
    "print \"conductivity with donor impurity 1   =   %0.2f\"%((condu1)),\"second per centimetre\"#\n",
    "u=10**7#u=w/u#\n",
    "#(3) conductivity with acceptor impurity 1\n",
    "conduc=u*q*mo1#\n",
    "print \"conductivity with acceptor impurity 1   =   %0.2e\"%((conduc)),\"second per centimetre\"#\n",
    "u=0.9*(w/10**6)#\n",
    "#(4) conductivity on both\n",
    "conduc=u*q*moe#\n",
    "print \"conductivity on both   =   %0.2f\"%((conduc)),\"second per centimetre\"#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 29 example 6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fermi   =   0.33 electron volt\n",
      "fermi below the conduction band\n"
     ]
    }
   ],
   "source": [
    "ferlev=0.3##electron volt\n",
    "u=300##kelvin\n",
    "u1=330##kelvin\n",
    "ferlev=ferlev*u1/u#\n",
    "print \"fermi   =   %0.2f\"%((ferlev)),\"electron volt\"#\n",
    "print \"fermi below the conduction band\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 29 example 7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fermi   =   0.17 electron volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "ferlev=0.02##electron volt\n",
    "q=4##donor impurity added\n",
    "w=0.025##electron volt\n",
    "ferlev=-((log(q)-8))/40#\n",
    "print \"fermi   =   %0.2f\"%((ferlev)),\"electron volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 30 example 8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistance   =   1570.39 ohm\n"
     ]
    }
   ],
   "source": [
    "from sympy import symbols, solve\n",
    "area=1.5*10**-2##centimetre square\n",
    "w=1.6##centimetre\n",
    "resist=20##ohm centimetre\n",
    "durati=60*10**-6##second in book given as mili\n",
    "quanti=8*10**15##photons per second\n",
    "\n",
    "\n",
    "#(1) resistance at each photon gives a electron hole pair\n",
    "up=1800##centimetre square per velocity second\n",
    "un=3800##centimetre square per velocity second\n",
    "q=1.6*10**-19##coulomb\n",
    "ni=2.5*10**13##per cubic centimetre\n",
    "sigma1=1/resist#\n",
    "z1=3800#\n",
    "z=-sigma1/q#\n",
    "u=ni**2/up#\n",
    "#n=poly([(z1) z u],'n')#\n",
    "n=symbols('n')\n",
    "expr=z1*n**2+z*n+u\n",
    "n=solve(expr,n)[1]\n",
    "n=7.847*10**13##n>ni taken so it is admissible\n",
    "p1=ni**2/n#\n",
    "volume=w*area#\n",
    "nchang=quanti*durati/volume#\n",
    "pchang=nchang#\n",
    "sigm11=q*((n+nchang)*un+(pchang+p1)*up)#\n",
    "resis1=1/sigm11#\n",
    "r1=resis1*w/area#\n",
    "print \"resistance   =   %0.2f\"%((r1)),\"ohm\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 31 example 9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "concentration of electron   =   8660254037.84 per cubic centimetre\n",
      "concentration of holes   =   25980762113.53 per cubic centimetre\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt\n",
    "moe=1350##square centimetre/velocity second\n",
    "mo1=450##square centimetre/velocity second\n",
    "ni=1.5*10**10##per cubic centimetre\n",
    "concn1=ni*((sqrt(mo1/moe)))##concentration\n",
    "concne=((ni**2)/(concn1))\n",
    "\n",
    "print \"concentration of electron   =   %0.2f\"%((concn1)),\"per cubic centimetre\"#\n",
    "print \"concentration of holes   =   %0.2f\"%((concne)),\"per cubic centimetre\"#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 32 example 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "concentration of hole   =   1.09e+21 per cubic centimetre\n",
      "concentration of electron   =   2.07e+11 per cubic centimetre\n"
     ]
    }
   ],
   "source": [
    "resist=0.12##ohm metre\n",
    "q=1.6*10**-19#\n",
    "concn1=((1/resist)/(0.048*q))##concentration of hole\n",
    "concne=((1.5*10**16)**(2))/concn1##concentration of electron\n",
    "print \"concentration of hole   =   %0.2e\"%((concn1)),\"per cubic centimetre\"#\n",
    "print \"concentration of electron   =   %0.2e\"%((concne)),\"per cubic centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 32 example 11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "concentration of acceptor atoms   =   6.25e+19 per cubic metre\n"
     ]
    }
   ],
   "source": [
    "resist=1*10**3##ohm\n",
    "w=20*10**-6##wide metre\n",
    "w1=400*10**-6##long metre\n",
    "mo1=500##square centimetre/velocity second\n",
    "q=1.6*10**-19#\n",
    "conduc=(resist*w*4*10**-6)/w1#\n",
    "concentration=((1)/(conduc*mo1*q))#\n",
    "print \"concentration of acceptor atoms   =   %0.2e\"%((concentration)),\"per cubic metre\"##correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 32 example 12"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "dn constants   =   98.80 square metre per second\n",
      "dp constants   =   33.80 square metre per second\n"
     ]
    }
   ],
   "source": [
    "w=0.026#\n",
    "moe=3800##square centimetre/velocitysecond\n",
    "mo1=1300##square centimetre/velocitysecond\n",
    "u=(moe*w)#\n",
    "u1=(mo1*w)#\n",
    "print \"dn constants   =   %0.2f\"%((u)),\"square metre per second\"##correction in the book\n",
    "print \"dp constants   =   %0.2f\"%((u1)),\"square metre per second\"##correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 33 example 13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "distance of fermi level from center   =   0.021    electron volt\n"
     ]
    }
   ],
   "source": [
    "from math import log\n",
    "w=0.026*(3/2)*log(3)/2#\n",
    "print \"distance of fermi level from center   =   %0.3f\"%((w)),\"   electron volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 33 example 14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity   =   44.64    ohm centimetre\n",
      "resistivity equal to 45\n",
      "resistivity   =   32.42    ohm centimetre\n",
      "resistivity equal to 32.4\n"
     ]
    }
   ],
   "source": [
    "up=1800##centimetre square per velocity second\n",
    "un=3800##centimetre square per velocity second\n",
    "\n",
    "#(1) resistivity is 45 ohm\n",
    "q=1.6*10**-19##coulomb\n",
    "ni=2.5*10**13#\n",
    "sigma1=(un+up)*q*ni#\n",
    "resist=1/sigma1#\n",
    "print \"resistivity   =   %0.2f\"%((resist)),\"   ohm centimetre\"#\n",
    "print \"resistivity equal to 45\"#\n",
    "#(2) impurity added to extent of 1 atom per 10**9\n",
    "n=4.4*10**22/10**9\n",
    "p1=ni**2/n#\n",
    "sigma1=(n*un+p1*up)*q#\n",
    "resist=1/sigma1\n",
    "print \"resistivity   =   %0.2f\"%((resist)),\"   ohm centimetre\"#\n",
    "print \"resistivity equal to 32.4\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 34 example 15"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "concentration of the a free electrons   =   1.05e+04\n",
      "concentration of the a free holes   =   1.00e+14\n",
      "sample p\n",
      "n   =   1.00e+15 electrons per cubic centimetre\n",
      "p   =   1.10e+15 holes per cubic centimetre\n",
      "essentially intrinsic\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "from sympy import symbols, solve, exp\n",
    "nd=4*10**14##atoms per cubic centimetre\n",
    "na=5*10**14##atoms per cubic centimetre\n",
    "#(1) concentration\n",
    "ni=2.5*10**13#\n",
    "np=ni**2#\n",
    "#p1=n+10**14\n",
    "z=1#\n",
    "z1=10**14#\n",
    "u=-ni**2#\n",
    "#n=poly([z z1 u],'q')#\n",
    "n=symbols('n')\n",
    "expr = z*n**2+z1*n+u\n",
    "n = solve(expr,n)[1]\n",
    "n=1.05*10**4#\n",
    "print \"concentration of the a free electrons   =   %0.2e\"%((n))\n",
    "p1=n+10**14#\n",
    "print \"concentration of the a free holes   =   %0.2e\"%((p1))\n",
    "#(2)\n",
    "print \"sample p\"#\n",
    "a=ni**2/(300**3*exp(-(0.785/0.026)))#\n",
    "w=400##kelvin\n",
    "ni=sqrt(a*w**3*exp(-0.786/(8.62*10**-5*w)))#\n",
    "ni=((n)*(n+10**14))/10**3#\n",
    "n=ni-0.05*10**15#\n",
    "print \"n   =   %0.2e\"%((n)),\"electrons per cubic centimetre\"\n",
    "p1=n+10**14#\n",
    "print \"p   =   %0.2e\"%((p1)),\"holes per cubic centimetre\"\n",
    "\n",
    "print \"essentially intrinsic\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 35 example 16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "concentration of n   =   6.00e+08 electrons per cubic centimetre\n",
      "concentration of holes   =   1.04e+18 holes per cubic centimetre\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "w=300##kelvin\n",
    "conduc=300##ohm centimetre inverse\n",
    "u=1800#\n",
    "p=conduc/(u*1.6*10**-19)##concentration holes\n",
    "n=(2.5*10**13)**2/(p)#\n",
    "print \"concentration of n   =   %0.2e\"%((n)),\"electrons per cubic centimetre\"\n",
    "print \"concentration of holes   =   %0.2e\"%((p)),\"holes per cubic centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 35 example 17"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "current density   =   0.17 ampere per square centimetre\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from sympy import symbols, solve\n",
    "nd=10**14##atoms per cubic centimetre\n",
    "na=5*10**13##atoms per cubic centimetre\n",
    "un=3800#\n",
    "up=1800#\n",
    "q=1.6*10**-19##coulomb\n",
    "resist=80##ohm metre\n",
    "e1=5##volt per metre\n",
    "w=nd-na#\n",
    "ni=(un+up)*q*resist#\n",
    "n=symbols('n')\n",
    "#p1=oly([1 w -ni**2],'q')#\n",
    "expr = n**2+w*n-ni**2\n",
    "##p1=taken as 3.65*19**12\n",
    "p1=solve(expr, p1)\n",
    "p1=3.65*10**12#\n",
    "n=p1+w#\n",
    "j=(n*un+p1*up)*q*e1#\n",
    "print \"current density   =   %0.2f\"%((j)),\"ampere per square centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 36 example 18"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity   =   1.25 ohm centimetre\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "na=1*10**16##per cubic centimetre            correction in the book\n",
    "ni=1.48*10**10##per cubic centimetre\n",
    "un=0.13*10**4##centimetre square per velocity second\n",
    "u=0.05*10**4##centimetre square per velocity second\n",
    "n=ni**2/na#\n",
    "q=1/(1.6*10**-19*(un*n+(u*na)))#\n",
    "print \"resistivity   =   %0.2f\"%((q)),\"ohm centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 37 example 19"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "voltage across sample   =   9.38 volt\n",
      "drift velocity   =   37.50 metre per second\n",
      "transverse force per  coulomb   =   1.88 newton per coulomb\n",
      "transverse electric field   =   1.88 volt per metre\n",
      "hall voltage   =   0.02 volt\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "e1=750##volt per metre\n",
    "b=0.05##metre square per velocity second\n",
    "un=0.05##metre square per velocity second\n",
    "up=0.14##metre square per velocity second\n",
    "#(1) voltage\n",
    "w=1.25*10**-2##metre\n",
    "v1=e1*w#\n",
    "print \"voltage across sample   =   %0.2f\"%((v1)),\"volt\"#\n",
    "#(2) drift velocity\n",
    "vd=un*e1#\n",
    "print \"drift velocity   =   %0.2f\"%((vd)),\"metre per second\"#\n",
    "#transverse force per  coulomb\n",
    "f1=vd*b#\n",
    "print \"transverse force per  coulomb   =   %0.2f\"%((f1)),\"newton per coulomb\"#\n",
    "#(4) transverse electric field\n",
    "e1=vd*b#\n",
    "print \"transverse electric field   =   %0.2f\"%((e1)),\"volt per metre\"#\n",
    "#(5) hall voltage\n",
    "q=0.9*10**-2#\n",
    "vh=e1*q\n",
    "print \"hall voltage   =   %0.2f\"%((vh)),\"volt\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 37 example 20"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "resistivity at 300kelvin   =   2.31e+05 ohm centimetre\n",
      "resistivity at impurity of 1 atom included per 10**5 atoms   =   0.010 ohm centimetre\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "un=1300##centimetre square per velocity second\n",
    "#at 300kelvin\n",
    "ni=1.5*10**10#\n",
    "u=500##centimetre square per velocity second\n",
    "conduc=1.6*10**-19*1.5*10**10*(un+u)#\n",
    "q=1/conduc#\n",
    "#impurity of 1 atom included per 10**5 atoms\n",
    "print \"resistivity at 300kelvin   =   %0.2e\"%((q)),\"ohm centimetre\"#\n",
    "n=5*10**22/10**5#\n",
    "p=ni**2/n#\n",
    "q=1/(1.6*10**-19*(un*n+(u*p)))\n",
    "\n",
    "print \"resistivity at impurity of 1 atom included per 10**5 atoms   =   %0.3f\"%((q)),\"ohm centimetre\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 38 example 21"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ec-ef   =   -0.20\n",
      "ec-ef   =   0.04 electron volt   ef above ec\n",
      "impurities included per germanium atoms   =   0.0002\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import sqrt, log, log10\n",
    "n=4.4*10**22#\n",
    "nd=n/10**7#\n",
    "w=300##kelvin\n",
    "nc=4.82*10**15*w**(3/2)/1/sqrt(8)#\n",
    "ec_ef1=-0.026*log((nc/(nd)))#\n",
    "print \"ec-ef   =   %0.2f\"%((ec_ef1))\n",
    "#(2) impurities included inratio 1 to 10**3\n",
    "n=4.4*10**22#\n",
    "nd=n/(10**3)#\n",
    "ec_ef1=-0.026*log(nc/nd)#\n",
    "print \"ec-ef   =   %0.2f\"%((ec_ef1)),\"electron volt   ef above ec\"#\n",
    "q=log10(nd/nc)/log10(10)#\n",
    "print \"impurities included per germanium atoms   =   0.0002\"#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 39 example 22"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ef-ec   =   0.15 electron volt\n",
      "ef-ec   =   0.03 electron volt\n",
      "temperature   =   240.33 kelvin\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import log\n",
    "n=5*10**22##atoms per cubic centimetre\n",
    "#(1) 1 atom per 10**6\n",
    "m=0.8##metre\n",
    "na=n/10**6#\n",
    "w=300##kelvin\n",
    "nv=4.82*10**15*(m)**(3/2)*w**(3/2)#\n",
    "ef_ec=0.026*log(nv/na)#\n",
    "print \"ef-ec   =   %0.2f\"%((ef_ec)),\"electron volt\"#\n",
    "#(2) impurity included 10*10**3 per atom\n",
    "na=n/(10*10**3)#\n",
    "ef_ec=0.026*log(nv/na)#\n",
    "print \"ef-ec   =   %0.2f\"%((ef_ec)),\"electron volt\"#\n",
    "#(3) condition to concide ec=ef\n",
    "na=4.81*10**15#\n",
    "w=(nv/na)**(2/3)#\n",
    "print \"temperature   =   %0.2f\"%((w)),\"kelvin\"##correction in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 40 example 23 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hall voltage   =   0.17 volt\n",
      "remains the same but there change in polarity\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#figure is not given in the book\n",
    "nd=10**7##per cubic centimetre\n",
    "na=10**17##per cubic centimetre\n",
    "voltag=0.1*3800*10**-4*1500*3*10**-3#\n",
    "print \"hall voltage   =   %0.2f\"%((voltag)),\"volt\"#\n",
    "print \"remains the same but there change in polarity\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## PageNumber 40 example 24"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "mobilty   =   0.12 metre square per velocity second\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "vh=60*10**-3##volt\n",
    "w=6*10**-3##metre\n",
    "bz=0.1##weber per metre square\n",
    "i1=10*10**-6##ampere\n",
    "resist=300000*10**-2##ohm metre\n",
    "#(1)\n",
    "#mobility\n",
    "rh=vh*w/(bz*i1)#\n",
    "u1=rh/resist#\n",
    "print \"mobilty   =   %0.2f\"%((u1)),\"metre square per velocity second\""
   ]
  }
 ],
 "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
}