{
 "metadata": {
  "name": "",
  "signature": "sha256:b26f0e8151a54ecdc596868a34547e181ac6dce2c5aea4a02c15b80e1401fd4f"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Semiconductors"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.1, Page number 251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "T1=300;    #temp in K\n",
      "T2=310;    #temp in K\n",
      "ni1=2.5*10**19;   #per cubic metre\n",
      "EgeV1=0.72;       #value of Eg in eV\n",
      "EgeV2=1.12;       #value of Eg in eV\n",
      "\n",
      "#Calculation\n",
      "Eg1=EgeV1*1.6*10**-19;    #Eg in J\n",
      "Eg2=EgeV2*1.6*10**-19;    #Eg in J\n",
      "KB=1.38*10**-23;          #boltzmann constant in J/k\n",
      "#density of electron hole pair is ni = A*(T**(3/2))*exp(-Eg/(2*KB*T))\n",
      "#let (T**(3/2))*exp(-Eg/(2*KB*T)) be X\n",
      "X1=(T1**(3/2))*math.exp(-Eg1/(2*KB*T1));\n",
      "X2=(T2**(3/2))*math.exp(-Eg2/(2*KB*T2));\n",
      "#therefore ni1=A*X1 and ni2=A*X2. dividing ni2/ni1 we get X2/X1\n",
      "ni2=ni1*(X2/X1);\n",
      "\n",
      "#Result\n",
      "print(\"the number of electron hole pairs per cubic metre is\",ni2);\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the number of electron hole pairs per cubic metre is', 2.3207901206362184e+16)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.2, Page number 251"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "RH=3.66*10**-4;   #hall coefficient in m^3/coulomb\n",
      "sigma=112;    #conductivity in ohm-1 m-1\n",
      "e=1.6*10**-19;\n",
      "\n",
      "#Calculation\n",
      "ne=1/(RH*e);\n",
      "#sigma = e*ne*(mew_e+mew_h)\n",
      "#assuming mew_h = 0\n",
      "mew_e=sigma/(e*ne);\n",
      "\n",
      "#Result\n",
      "print(\"the charge carrier density per m^3 is\",ne);\n",
      "print(\"electron mobility in m^2/Vs is\",mew_e);\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the charge carrier density per m^3 is', 1.7076502732240434e+22)\n",
        "('electron mobility in m^2/Vs is', 0.040992)\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.3, Page number 252"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "ni=1.5*10**16;   #intrinsic concentration per m^3\n",
      "e=1.6*10**-19;\n",
      "mew_e=0.13;    #mobility of electrons in m^2/Vs\n",
      "mew_h=0.05;    #mobility of holes in m^2/Vs\n",
      "ND=5*10**20;    #conductivity in atoms/m^3\n",
      "\n",
      "#Calculation\n",
      "sigma1=ni*e*(mew_e+mew_h);\n",
      "nd=(ni**2)/ND;\n",
      "sigma2=ND*e*mew_e;\n",
      "NA=5*10**20;\n",
      "na=(ni**2)/NA;\n",
      "sigma3=NA*e*mew_h;\n",
      "sigma1=math.ceil(sigma1*10**7)/10**7;   #rounding off to 7 decimals\n",
      "sigma2=math.ceil(sigma2*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print(\"intrinsic conductivity of Si in ohm-1 m-1 is\",sigma1);\n",
      "print(\"conductivity of Si during donor impurity in ohm-1 m-1 is\",sigma2);\n",
      "print(\"conductivity of Si during acceptor impurity in ohm-1 m-1 is\",round(sigma3));"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('intrinsic conductivity of Si in ohm-1 m-1 is', 0.000432)\n",
        "('conductivity of Si during donor impurity in ohm-1 m-1 is', 10.41)\n",
        "('conductivity of Si during acceptor impurity in ohm-1 m-1 is', 4.0)\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.4, Page number 253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "sigma1=2;    #conductivity in ohm-1 m-1\n",
      "EgeV=0.72;    #band gap in eV\n",
      "KB=1.38*10**-23;    #boltzmann constant\n",
      "T1=20;    #temp in C\n",
      "T2=40;    #temp in C\n",
      "\n",
      "#Calculation\n",
      "Eg=EgeV*1.6*10**-19;    #in J\n",
      "T1=T1+273;   #temp in K\n",
      "T2=T2+273;   #temp in K\n",
      "#sigma2/sigma1 = exp((-Eg/(2*KB))*((1/T2)-(1/T1)))\n",
      "#by taking log on both sides we get 2.303*log10(sigma2/sigma1) = (Eg/(2*KB))*((1/T1)-(1/T2))\n",
      "#let (Eg/(2*KB))*((1/T1)-(1/T2)) be X\n",
      "X=(Eg/(2*KB))*((1/T1)-(1/T2));\n",
      "#let log10(sigma2/sigma1) be Y\n",
      "Y=X/2.303;\n",
      "#log10(sigma2/sigma1) = log10(sigma2)-log10(sigma1)\n",
      "#let log10(sigma2) be A\n",
      "A=Y+math.log10(sigma1);\n",
      "sigma2=10**A;\n",
      "sigma2=math.ceil(sigma2*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print(\"the conductivity in mho m-1 is\",sigma2);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the conductivity in mho m-1 is', 4.97)\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.5, Page number 253"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "mew_n=1300*10**-4;   #in m^2/Vs\n",
      "mew_p=500*10**-4;   #in m^2/Vs\n",
      "sigma=3*10**4;   #conductivity in ohm-1 m-1\n",
      "e=1.6*10**-19;\n",
      "\n",
      "#Calculation\n",
      "N=sigma/(e*mew_n);\n",
      "ni=1.5*10**16;    #per m^3\n",
      "p=(ni**2)/N;\n",
      "P=sigma/(e*mew_p);\n",
      "n=(ni**2)/P;\n",
      "N=math.ceil(N*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"concentration of electrons in n-type per cubic metre are\",N);\n",
      "print(\"concentration of holes in n-type per cubic metre are\",round(p));\n",
      "print(\"concentration of electrons in p-type per cubic metre are\",round(n));\n",
      "print(\"concentration of holes in p-type per cubic metre are\",P);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('concentration of electrons in n-type per cubic metre are', 1.4423076923076921e+24)\n",
        "('concentration of holes in n-type per cubic metre are', 156000000.0)\n",
        "('concentration of electrons in p-type per cubic metre are', 60000000.0)\n",
        "('concentration of holes in p-type per cubic metre are', 3.7499999999999995e+24)\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.6, Page number 254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "ni=2.37*10**19;   #intrinsic carrier density per m^3\n",
      "mew_e=0.38;    #in m**2/Vs\n",
      "mew_n=0.18;    #in m**2/Vs\n",
      "\n",
      "#Calculation\n",
      "e=1.6*10**-19;\n",
      "sigmai=ni*e*(mew_e+mew_n);\n",
      "rho=1/sigmai;\n",
      "rho=math.ceil(rho*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"resistivity in ohm m is\",rho);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('resistivity in ohm m is', 0.471)\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.7, Page number 254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "Eg=1.12;   #band gap in eV\n",
      "K=1.38*10**-23;\n",
      "T=300;   #temp in K\n",
      "\n",
      "#Calculation\n",
      "#EF = (Eg/2)+(3*K*T/4)*log(mh/me)\n",
      "#given me=0.12m0 and mh=0.28m0. therefore mh/me = 0.28/0.12 \n",
      "#let mh/me be X. therefore X=0.28/0.12 \n",
      "X=0.28/0.12;\n",
      "EF=(Eg/2)+((3*K*T/4)*math.log(X));\n",
      "\n",
      "#Result\n",
      "print(\"the position of fermi level in eV is\",EF);\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the position of fermi level in eV is', 0.56)\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.8, Page number 254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "KB=1.38*10**-23;\n",
      "T=300;   #temp in K\n",
      "h=6.626*10**-34;\n",
      "m0=9.11*10**-31;\n",
      "mh=m0;\n",
      "me=m0;\n",
      "EgeV=0.7;    #energy gap in eV\n",
      "\n",
      "#Calculation\n",
      "Eg=EgeV*1.6*10**-19;    #in J\n",
      "A=((2*math.pi*KB/(h**2))**(3/2))*(me*mh)**(3/4);\n",
      "B=T**(3/2);\n",
      "C=math.exp(-Eg/(2*KB*T));\n",
      "ni=2*A*B*C;\n",
      "\n",
      "#Result\n",
      "print(\"concentration of intrinsic charge carriers per cubic metre is\",ni);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('concentration of intrinsic charge carriers per cubic metre is', 3.3481803992458756e+19)\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.9, Page number 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "ni=2.4*10**19;\n",
      "mew_e=0.39;\n",
      "mew_h=0.19;\n",
      "e=1.6*10**-19;\n",
      "\n",
      "#Result\n",
      "sigmai=ni*e*(mew_e+mew_h);\n",
      "rhoi=1/sigmai;\n",
      "rhoi=math.ceil(rhoi*10**2)/10**2;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print(\"resistivity in ohm m is\",rhoi);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('resistivity in ohm m is', 0.45)\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.10, Page number 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "l=1;    #length in cm\n",
      "l=l*10**-2;    #length in m\n",
      "e=1.6*10**-19;\n",
      "w=1;    #width in mm\n",
      "t=1;     #thickness in mm\n",
      "\n",
      "#Calculation\n",
      "w=w*10**-3;    #width in m\n",
      "t=t*10**-3;      #thickness in m\n",
      "A=w*t;\n",
      "ni=2.5*10**19;\n",
      "mew_e=0.39;\n",
      "mew_p=0.19;\n",
      "sigma=ni*e*(mew_p+mew_e);\n",
      "R=l/(sigma*A);\n",
      "\n",
      "#Result\n",
      "print(\"resistance of intrinsic Ge rod in ohm is\",R);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('resistance of intrinsic Ge rod in ohm is', 4310.3448275862065)\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.11, Page number 255"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "Eg=1.1;   #energy gap in eV\n",
      "m=9.109*10**-31;\n",
      "k=1.38*10**-23;\n",
      "T=300;\n",
      "e=1.6*10**-19;\n",
      "h=6.626*10**-34;\n",
      "mew_e=0.48;     #electron mobility\n",
      "mew_h=0.013;    #hole mobility\n",
      "\n",
      "#Calculation\n",
      "C=2*(2*math.pi*m*k/(h**2))**(3/2);\n",
      "X=2*k*T/e;\n",
      "Y=-Eg/X;\n",
      "A=math.exp(Y);\n",
      "ni=C*(T**(3/2))*A;\n",
      "sigma=ni*e*(mew_e+mew_h);\n",
      "sigma=math.ceil(sigma*10**6)/10**6      #rounding off to 6 decimals\n",
      "\n",
      "#Result\n",
      "print(\"conductivity in ohm-1 m-1 is\",sigma);\n",
      "\n",
      "# answer given in the book is wrong, Page number 255"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('conductivity in ohm-1 m-1 is', 0.001162)\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.12, Page number 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "m=9.109*10**-31;\n",
      "k=1.38*10**-23;\n",
      "T=300;\n",
      "e=1.6*10**-19;\n",
      "h=6.626*10**-34;\n",
      "Eg=0.7;\n",
      "mew_e=0.4;     #electron mobility\n",
      "mew_h=0.2;     #hole mobility\n",
      "\n",
      "#Calculation\n",
      "C=2*(2*math.pi*m*k/((h**2)))**(3/2);\n",
      "X=2*k*T/e;\n",
      "ni=C*(T**(3/2))*math.exp(-Eg/X);\n",
      "sigma=ni*e*(mew_e+mew_h);\n",
      "sigma=math.ceil(sigma*10**3)/10**3      #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"conductivity in ohm-1 m-1\",sigma);\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('conductivity in ohm-1 m-1', 3.214)\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.13, Page number 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "k=8.616*10**-5;\n",
      "T1=20;    #temp in C\n",
      "T1=T1+273;    #temp in K\n",
      "T2=32;     #temp in C\n",
      "rho2=4.5;    #resistivity in ohm m\n",
      "rho1=2;    #resistivity in ohm m\n",
      "\n",
      "#Calculation\n",
      "T2=T2+273;    #temp in K\n",
      "dy=math.log10(rho2)-math.log10(rho1);\n",
      "dx=(1/T1)-(1/T2);\n",
      "Eg=2*k*dy/dx;\n",
      "Eg=math.ceil(Eg*10**3)/10**3      #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"energy band gap in eV is\",Eg);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('energy band gap in eV is', 0.452)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.13, Page number 256"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "k=8.616*10**-5;\n",
      "T1=20;    #temp in C\n",
      "T2=32;     ##temp in C\n",
      "rho2=4.5;    #resistivity in ohm m\n",
      "rho1=2;    #resistivity in ohm m\n",
      "\n",
      "#Calculation\n",
      "T1=T1+273;    #temp in K\n",
      "T2=T2+273;    #temp in K\n",
      "dy=math.log10(rho2)-math.log10(rho1);\n",
      "dx=(1/T1)-(1/T2);\n",
      "Eg=2*k*dy/dx;\n",
      "Eg=math.ceil(Eg*10**3)/10**3      #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"energy band gap in eV is\",Eg);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('energy band gap in eV is', 0.452)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.14, Page number 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "EgeV=1;   #energy in eV\n",
      "k=1.38*10**-23;\n",
      "Eg=EgeV*1.602*10**-19;    #in J\n",
      "#EF can be taken as (Ev+0.5)eV\n",
      "#therefore (Ev+0.5)eV = (Ec+Ev)/2--------(1)\n",
      "#let fermi level shift by 10% then (Ev+0.6)eV = ((Ec+Ev)/2)+((3*k*T/4)*log(4))-----(2)\n",
      "#subtracting (1) from (2)\n",
      "#0.1 eV = (3*k*T/4)*math.log(4)\n",
      "E=0.1;    #energy in eV\n",
      "E=E*1.602*10**-19;    #energy in J\n",
      "T=(4*E)/(3*k*math.log(4));\n",
      "\n",
      "#Result\n",
      "print(\"temperature in K is\",T);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('temperature in K is', 1116.520509905372)\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.15, Page number 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "ni=1.5*10**16;\n",
      "e=1.6*10**-19;\n",
      "mew_e=0.13;\n",
      "mew_h=0.05;\n",
      "\n",
      "#Calculation\n",
      "sigma=ni*e*(mew_e+mew_h);\n",
      "M=28.1;    #atomic weight of Si\n",
      "d=2.33*10**3;   #density in kg/m^3\n",
      "v=M/d;\n",
      "N=6.02*10**26;\n",
      "N1=N/v;\n",
      "#1 donor type impurity is added to 1 impurity atom\n",
      "ND=N1/(10**8);\n",
      "p=(ni**2)/ND;\n",
      "sigma_exd=ND*e*mew_e;\n",
      "#1 acceptor type impurity is added to 1 impurity atom\n",
      "Na=N1/(10**8);\n",
      "n=(ni**2)/Na;\n",
      "sigma_exa=Na*e*mew_h;\n",
      "sigma=math.ceil(sigma*10**7)/10**7      #rounding off to 7 decimals\n",
      "sigma_exd=math.ceil(sigma_exd*10**3)/10**3      #rounding off to 3 decimals\n",
      "sigma_exa=math.ceil(sigma_exa*10**3)/10**3      #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"conductivity in ohm-1 m-1 is\",sigma);\n",
      "print(\"number of Si atoms per m^3 is\",N1);\n",
      "print(\"conductivity for donor type impurity in ohm-1 m-1 is\",sigma_exd);\n",
      "print(\"conductivity for acceptor type impurity in ohm-1 m-1 is\",sigma_exa);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('conductivity in ohm-1 m-1 is', 0.000432)\n",
        "('number of Si atoms per m^3 is', 4.991672597864769e+28)\n",
        "('conductivity for donor type impurity in ohm-1 m-1 is', 10.383)\n",
        "('conductivity for acceptor type impurity in ohm-1 m-1 is', 3.994)\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.16, Page number 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "T=300;   #temperature in K\n",
      "KB=1.38*10**-23;\n",
      "e=1.6*10**-19;\n",
      "mew_e=0.19;    #mobility of electrons in m^2/Vs\n",
      "\n",
      "#Calculation\n",
      "Dn=mew_e*KB*T/e;\n",
      "Dn=math.ceil(Dn*10**6)/10**6      #rounding off to 6 decimals\n",
      "\n",
      "#Result\n",
      "print(\"diffusion coefficient of electrons in m^2/s is\",Dn);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('diffusion coefficient of electrons in m^2/s is', 0.004917)\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.17, Page number 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "\n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "RH=3.66*10**-4;     #hall coefficient in m^3/coulomb\n",
      "I=10**-2;    #current in amp\n",
      "B=0.5;    #magnetic field in wb/m^2\n",
      "t=1;    #thickness in mm\n",
      "\n",
      "#Calculation\n",
      "t=t*10**-3;    #thickness in m\n",
      "VH=(RH*I*B)/t;\n",
      "VH=VH*10**3;    #converting from Volts to mV\n",
      "\n",
      "#Result\n",
      "print(\"Hall voltage in mV is\",VH);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('Hall voltage in mV is', 1.83)\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.18, Page number 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "RH=-7.35*10**-5;    #hall coefficient\n",
      "e=1.6*10**-19;\n",
      "sigma=200;\n",
      "\n",
      "#Calculation\n",
      "n=(-1/(RH*e));\n",
      "mew=sigma/(n*e);\n",
      "\n",
      "#Result\n",
      "print(\"density of charge carriers in m^3 is\",n);\n",
      "print(\"mobility of charge carriers in m^2/Vs is\",mew);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('density of charge carriers in m^3 is', 8.503401360544217e+22)\n",
        "('mobility of charge carriers in m^2/Vs is', 0.0147)\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.19, Page number 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "I=50;    #current in amp\n",
      "B=1.5;   #magnetic field in T\n",
      "n=8.4*10**28;     #free electron concentration in electron/m^3\n",
      "t=0.5;    #thickness in cm\n",
      "e=1.6*10**-19;\n",
      "\n",
      "#Calculation\n",
      "t=t*10**-2;    #thickness in m\n",
      "VH=(I*B)/(n*e*t);\n",
      "VH=VH*10**6;   #converting VH from V to micro V\n",
      "VH=math.ceil(VH*10**4)/10**4      #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"magnitude of Hall voltage in microVolt is\",VH);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('magnitude of Hall voltage in microVolt is', 1.1161)\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.20, Page number 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "\n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "RH=3.66*10**-4;\n",
      "e=1.6*10**-19;\n",
      "rho_n=8.93*10**-3;\n",
      "\n",
      "#Calculation\n",
      "n=1/(RH*e);\n",
      "mew_e=RH/rho_n;\n",
      "mew_e=math.ceil(mew_e*10**5)/10**5      #rounding off to 5 decimals\n",
      "\n",
      "#Result\n",
      "print(\"n per m^3 is\",n);\n",
      "print(\"mew_e in m^2/V is\",mew_e);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('n per m^3 is', 1.7076502732240434e+22)\n",
        "('mew_e in m^2/V is', 0.04099)\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.21, Page number 260"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "mew_e=0.13;    #electron mobility in m^2/Vs\n",
      "mew_h=0.048;   #hole mobility in m^2/Vs\n",
      "ni=1.5*10**16;\n",
      "e=1.6*10**-19;\n",
      "T=300;   #temp in K\n",
      "ND=10**23;    #density per m^3\n",
      "\n",
      "#Calculation\n",
      "sigmai=ni*e*(mew_e+mew_h);\n",
      "sigma=ND*mew_e*e;\n",
      "p=(ni**2)/ND;\n",
      "sigmai=math.ceil(sigmai*10**5)/10**5      #rounding off to 5 decimals\n",
      "\n",
      "#Result\n",
      "print(\"conductivity of intrinsic Si in s is\",sigmai);\n",
      "print(\"conductivity in s is\",sigma);\n",
      "print(\"equilibrium hole concentration per m^3 is\",round(p));\n",
      "\n",
      "#answers for sigmai and sigma given in the book are wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('conductivity of intrinsic Si in s is', 0.00043)\n",
        "('conductivity in s is', 2080.0)\n",
        "('equilibrium hole concentration per m^3 is', 2250000000.0)\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.22, Page number 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "T=300;   #temp in K\n",
      "kB=1.38*10**-23;\n",
      "mew_e=0.36;    #mobility of electrons in m^2/Vs\n",
      "e=1.6*10**-19;\n",
      "mew_h=0.7;    #mobility of electrons in m^2/Vs\n",
      "sigma=2.12;    #conductivity in ohm-1 m-1\n",
      "C=4.83*10**21;    #proportional constant\n",
      "\n",
      "#Calculation\n",
      "ni=sigma/(e*(mew_e+mew_h));\n",
      "#exp(-Eg/(2*kB*T)) = (C*(T^(3/2)))/ni\n",
      "#let X be (C*(T^(3/2)))/ni\n",
      "X=(C*(T**(3/2)))/ni;\n",
      "#exp(-Eg/(2*kB*T)) = X \n",
      "#applyinf log on both sides\n",
      "#Eg/(2*kB*T) = log(X)\n",
      "Eg=2*kB*T*math.log(X);\n",
      "\n",
      "#Result\n",
      "print(\"forbidden energy gap in eV is\",Eg);\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('forbidden energy gap in eV is', 1.2016388762259164e-19)\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.23, Page number 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "Eg=0.4;    #energy gap in eV\n",
      "Eg=Eg*1.6*10**-19;    #Eg in J\n",
      "KB=1.38*10**-23;\n",
      "T1=0;   #temp 1 in C\n",
      "T2=50;   #temp 2 in C\n",
      "T3=100;   #temp 3 in C\n",
      "\n",
      "#Calculation\n",
      "T1k=T1+273;    #temp 1 in K\n",
      "T2k=T2+273;    #temp 2 in K\n",
      "T3k=T3+273;    #temp 3 in K\n",
      "#F(E) = 1/(1+(exp((E-Ep)/(KB*T))))\n",
      "#but E-Ep = (1/2)*Eg\n",
      "#therefore F(E) = 1/(1+(exp(Eg/(2*KB*T))))\n",
      "FE1=1/(1+(math.exp(Eg/(2*KB*T1k))));\n",
      "FE2=1/(1+(math.exp(Eg/(2*KB*T2k))));\n",
      "FE3=1/(1+(math.exp(Eg/(2*KB*T3k))));\n",
      "FE1=math.ceil(FE1*10**6)/10**6      #rounding off to 6 decimals\n",
      "FE2=math.ceil(FE2*10**6)/10**6      #rounding off to 6 decimals\n",
      "FE3=math.ceil(FE3*10**6)/10**6      #rounding off to 6 decimals\n",
      "\n",
      "#Result\n",
      "print(\"probability of occupation at 0 C in eV is\",FE1);\n",
      "print(\"probability of occupation at 50 C in eV is\",FE2);\n",
      "print(\"probability of occupation at 100 C in eV is\",FE3);\n",
      "\n",
      "#answers given in the book are wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('probability of occupation at 0 C in eV is', 0.000205)\n",
        "('probability of occupation at 50 C in eV is', 0.000762)\n",
        "('probability of occupation at 100 C in eV is', 0.001992)\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.24, Page number 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "Eg=1.2;   #energy in eV\n",
      "Eg=Eg*1.6*10**-19;    #in J\n",
      "KB=1.38*10**-23;\n",
      "T1=600;   #temp in K\n",
      "T2=300;   #temp in K\n",
      "\n",
      "#Calculation\n",
      "#sigma is proportional to exp(-Eg/(2*KB*T))\n",
      "#let sigma1/sigma2 be R\n",
      "R=math.exp((Eg/(2*KB))*((1/T2)-(1/T1)));\n",
      "\n",
      "#Result\n",
      "print(\"the ratio between conductivity is\",round(R));\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the ratio between conductivity is', 108467.0)\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.25, Page number 263"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "ni=2.5*10**19;   #density of charge carriers in m^3\n",
      "r=1/(10**6);    #ratio\n",
      "e=1.6*10**-19;\n",
      "mew_e=0.36;   #mobility of electrons in m^2/Vs\n",
      "mew_h=0.18;   #mobility of holes in m^2/Vs\n",
      "N=4.2*10**28;    #number of Si atoms per m^3\n",
      "\n",
      "#Calculation\n",
      "Ne=r*N;\n",
      "Nh=(ni**2)/Ne;\n",
      "sigma=(Ne*e*mew_e)+(Nh*e*mew_h);\n",
      "rho=1/sigma;\n",
      "rho=math.ceil(rho*10**8)/10**8      #rounding off to 8 decimals\n",
      "\n",
      "#Result\n",
      "print(\"number of impurity atoms per m^3 is\",Ne);\n",
      "print(\"the resistivity of doped Ge in ohm m is\",rho);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('number of impurity atoms per m^3 is', 4.2e+22)\n",
        "('the resistivity of doped Ge in ohm m is', 0.00041336)\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.26, Page number 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "n=5*10**17;   #concentration in m^3\n",
      "vd=350;   #drift velocity in m/s\n",
      "E=1000;   #electric field in V/m\n",
      "e=1.6*10**-19;\n",
      "\n",
      "#Calculation\n",
      "mew=vd/E;\n",
      "sigma=n*e*mew;\n",
      "sigma=math.ceil(sigma*10**4)/10**4      #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"the conductivity of material in ohm m is\",sigma);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the conductivity of material in ohm m is', 0.028)\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.27, Page number 264"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "sigma_e=2.2*10**-4;   #conductivity\n",
      "mew_e=125*10**-3;    #mobility of electrons in m^2/Vs\n",
      "e=1.602*10**-19;\n",
      "\n",
      "#Calculation\n",
      "ne=sigma_e/(e*mew_e);\n",
      "\n",
      "#Result\n",
      "print(\"concentration in m^3 is\",ne);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('concentration in m^3 is', 1.0986267166042448e+16)\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.28, Page number 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "RH=3.66*10**-4;    #hall coefficient in m^3/c\n",
      "rho_i=8.93*10**-3;    #resistivity in ohm m\n",
      "e=1.6*10**-19;\n",
      "\n",
      "#Calculation\n",
      "nh=1/(RH*e);\n",
      "mew_h=1/(rho_i*nh*e);\n",
      "mew_h=math.ceil(mew_h*10**4)/10**4      #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"density of charge carriers in m^3 is\",nh);\n",
      "print(\"mobility of charge carriers is %f m^2/Vs\",mew_h);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('density of charge carriers in m^3 is', 1.7076502732240434e+22)\n",
        "('mobility of charge carriers is %f m^2/Vs', 0.041)\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 7.29, Page number 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "#import module\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable decleration\n",
      "I=3;    #current in mA\n",
      "I=I*10**-3;    #current in amp\n",
      "e=1.6*10**-19;\n",
      "RH=3.66*10**-4;    #hall coefficient in m^3/C\n",
      "B=1;    #flux density in w/m^2\n",
      "d=2;   #dimension along Y in cm\n",
      "z=1;   #dimension along z in mm\n",
      "\n",
      "#Calculation\n",
      "d=d*10**-2;   #dimension along Y in m\n",
      "z=z*10**-3;    #dimension along z in m\n",
      "A=d*z;   #area in m^2\n",
      "EH=RH*I*B/A;\n",
      "VH=EH*d;\n",
      "VH=VH*10**3;    #converting from V to mV\n",
      "n=1/(RH*e);\n",
      "VH=math.ceil(VH*10**2)/10**2      #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print(\"Hall voltage in mV is\",VH);\n",
      "print(\"charge carrier concentration in m^3 is\",n);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('Hall voltage in mV is', 1.1)\n",
        "('charge carrier concentration in m^3 is', 1.7076502732240434e+22)\n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}