{
 "metadata": {
  "name": "",
  "signature": "sha256:0873412d6a4e98969b64a50f25d022cd9e4d104c8635e0bc9bd27817ed58d4b4"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Semiconducting materials"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.1, Page number 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Variable declaration\n",
      "mew_e=0.36;    #mobility of electrons in m^2/Vs\n",
      "mew_h=0.14;    #mobility of holes in m^2/Vs\n",
      "sigma=2.2;    #conductivity in ohm-1 m-1\n",
      "T=300;     #temperature in K\n",
      "e=1.6*10**-19;   #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "ni=sigma/(e*(mew_e+mew_h));    #carrier concentration per m^3\n",
      "\n",
      "#Result\n",
      "print(\"carrier concentration of an intrinsic semiconductor per m^3 is\",ni);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('carrier concentration of an intrinsic semiconductor per m^3 is', 2.75e+19)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.2, Page number 266"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "import numpy as np\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "T1=20;    #temperature in C\n",
      "T2=100;    #temperature in C\n",
      "sigma_i20=250;     #conductivity in ohm-1 m-1\n",
      "sigma_i100=1100;     #conductivity in ohm-1 m-1\n",
      "k=1.38*10**-23;\n",
      "\n",
      "#Calculation\n",
      "T1K=T1+273;     #temperature in K\n",
      "T2K=T2+273;     #temperature in K\n",
      "T_1K=T1K**(-1);\n",
      "T_2K=T2K**(-1);\n",
      "T_1=T_2K-T_1K;\n",
      "T_2=T2K/T1K;\n",
      "Tk=T_1**(-1);\n",
      "T_k=(T_2)**(3/2);\n",
      "#intrinsic carrier concentration at T1K is ni20 = 2*((2*math.pi*k*m*293)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*293))\n",
      "#intrinsic carrier concentration at T2K is ni100 = 2*((2*math.pi*k*m*373)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-Eg/(2*k*373))\n",
      "#dividing ni20/ni100 = (293/373)**(3/2)*(math.exp(-Eg/(2*k*293))/math.exp(-Eg/(2*k*373)))\n",
      "#ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n",
      "#sigma_i20/sigma_i100 = (ni20*e*(mew_e+mew_h))/(ni100*e*(mew_e+mew_h)) = ni20/ni100\n",
      "#therefore sigma_i20/sigma_i100 = ni20/ni100 = (293/373)**(3/2)*math.exp((-Eg/(2*k))((1/293)-(1/373)))\n",
      "#math.exp((-Eg/(2*k))*((1/293)-(1/373))) = (sigma_i20/sigma_i100)*(373/293)**(3/2)\n",
      "#by taking log on both sides we get (-Eg/(2*k))*((1/293)-(1/373)) = np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n",
      "#Eg=2*k*(((1/373)-(1/293))**(-1))*np.log((sigma_i20/sigma_i100)*(373/293)**(3/2))\n",
      "Eg=2*k*Tk*np.log((sigma_i20/sigma_i100)*T_k);   #band gap in J\n",
      "EgeV=Eg*6.241*10**18;    #converting J to eV\n",
      "EgeV=math.ceil(EgeV*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"band gap of the semiconductor in J is\",Eg);\n",
      "print(\"band gap of the semiconductor in eV is\",EgeV);\n",
      "\n",
      "#answer for band gap in eV given in the book is wrong in the 4th decimal point"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('band gap of the semiconductor in J is', 4.2210259829756855e-20)\n",
        "('band gap of the semiconductor in eV is', 0.2635)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.3, Page number 267"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Variable declaration\n",
      "I=10**-2;    #current in Ampere\n",
      "l=100;    #length in mm\n",
      "d=1;     #thickness in mm\n",
      "w=10;    #breadth in mm\n",
      "B=0.5;   #magnetic field in Wb/m^2\n",
      "RH=3.66*10**-4;    #hall coefficient in m^3/C\n",
      "\n",
      "#Calculation\n",
      "w=w*10**-3;    #width in m\n",
      "VH=(B*I*RH)/w;    #hall voltage\n",
      "VH=VH*10**4;\n",
      "\n",
      "#Result\n",
      "print(\"Hall voltage in V is\",VH,\"*10**-4\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('Hall voltage in V is', 1.83, '*10**-4')\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.4, Page number 268"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "sigma=300;   #conductivity in S/cm\n",
      "T=300;   #temperature in K\n",
      "ni=1.5*10**10    #carrier concentration per cm^3\n",
      "mew_e=1300;   #mobility of electrons in cm^2/Vs\n",
      "mew_h=500;    #mobility of holes in cm^2/Vs\n",
      "e=1.6*10**-19;    #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "sigma=sigma*10**2;    #sigma in S/m\n",
      "mew_e=mew_e*10**-4;   #mobility of electrons in m^2/Vs\n",
      "ND=sigma/(e*mew_e);   #concentration of electron per m^3\n",
      "ni=ni*10**6;         #carrier concentration per m^3\n",
      "p=ni**2/ND;     #hole concentration per m^3\n",
      "p=p/10**8;\n",
      "p=math.ceil(p*10**3)/10**3;   #rounding off to 3 decimals\n",
      "mew_h=mew_h*10**-4;    #mobility of holes in m^2/Vs\n",
      "NA=sigma/(e*mew_h);   #concentration of hole per m^3\n",
      "n=ni**2/NA;     #electron concentration per m^3\n",
      "n=n/10**7;\n",
      "\n",
      "#Result\n",
      "print(\"concentration of electron for N-type semiconductor per m^3\",ND);\n",
      "print(\"hole concentration per m^3\",p,\"*10**8\");\n",
      "print(\"concentration of hole for P-type semiconductor per m^3\",NA);\n",
      "print(\"electron concentration per m^3\",int(n),\"*10**7\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('concentration of electron for N-type semiconductor per m^3', 1.4423076923076921e+24)\n",
        "('hole concentration per m^3', 1.561, '*10**8')\n",
        "('concentration of hole for P-type semiconductor per m^3', 3.7499999999999995e+24)\n",
        "('electron concentration per m^3', 6, '*10**7')\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.5, Page number 269"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "RH=-3.68*10**-5;    #hall coefficient in m^3/C\n",
      "e=1.6*10**-19;    #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "#hall coefficient is negative implies charge carriers are electrons\n",
      "n=(3*math.pi)/(8*(-RH)*e);     #carrier concentration\n",
      "\n",
      "#Result\n",
      "print(\"charge carriers are electrons\");\n",
      "print(\"carrier concentration per m^3 is\",n);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "charge carriers are electrons\n",
        "('carrier concentration per m^3 is', 2.000844505937792e+23)\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.6, Page number 269"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "\n",
      "#Variable declaration\n",
      "Eg1=0.36;    #energy gap of 1st material in eV\n",
      "Eg2=0.72;   #energy gap of 2nd material in eV\n",
      "T=300;     #temperature in K\n",
      "mh=9*10**-31;\n",
      "me=9*10**-31; \n",
      "#given that 2*k*T=0.052;    \n",
      "#consider X=2*k*T\n",
      "X=0.052;\n",
      "\n",
      "#Calculation\n",
      "#intrinsic carrier concentration for A niA = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.36/(2*k*T))\n",
      "#intrinsic carrier concentration for B niB = 2*((2*math.pi*k*T*m)/h**2)**(3/2)*((me*mh)/m**2)**(3/4)*math.exp(-0.72/(2*k*T))\n",
      "#dividing niA/niB = math.exp(-0.36/(2*k*T))*math.exp(0.72/(2*k*T))\n",
      "#let niA/niB be A\n",
      "A = math.exp(-0.36/X)*math.exp(0.72/X);\n",
      "A=A/10**3;\n",
      "A=math.ceil(A*10**5)/10**5;   #rounding off to 5 decimals\n",
      "\n",
      "#Result\n",
      "print(\"ratio of intrinsic carrier densities of A and B is\",A,\"*10**3\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('ratio of intrinsic carrier densities of A and B is', 1.01544, '*10**3')\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.7, Page number 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "ND=2*10**22;     #concentration of electron per m^3\n",
      "sigma=112;     #conductivity in ohm-1 m-1\n",
      "e=1.6*10**-19;    #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "mew=sigma/(ND*e);    #mobility of electrons \n",
      "mew=math.ceil(mew*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"mobility of electrons in m^2/Vs is\",mew);"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('mobility of electrons in m^2/Vs is', 0.035)\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.8, Page number 270"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "w=500;     #thickness  in micrometre\n",
      "A=2.5*10**-3;    #area of cross section in cm^-2\n",
      "Ix=1;     #current in ampere\n",
      "Bz=10;    #magnetic field in Wb/cm^2\n",
      "n=10**16;    #donor concentration in m^-3\n",
      "e=1.6*10**-19;    #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "Bz=Bz*10**-4;    #magnetic field in Wb/m^2\n",
      "w=w*10**-6;    #thickness in m\n",
      "RH=(3*math.pi)/(8*n*e);     #hall coefficient\n",
      "VH=(Bz*Ix*RH)/w;    #hall voltage\n",
      "VH=VH/10**3;\n",
      "VH=math.ceil(VH*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"hall voltage in V is\",VH,\"*10**3\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('hall voltage in V is', 1.4727, '*10**3')\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.9, Page number 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "from __future__ import division\n",
      "import numpy as np\n",
      "\n",
      "#Variable declaration\n",
      "Eg=1.2;    #energy gap in eV\n",
      "T1=300;    #temperature in K\n",
      "T2=600;    #temperature in K\n",
      "k=1.38*10**-23;\n",
      "\n",
      "#Calculation\n",
      "T_1=T1**(-1);\n",
      "T_2=T2**(-1);\n",
      "T=T_1-T_2;\n",
      "Eg=Eg*1.602*10**-19;    #Eg in J\n",
      "#sigma_300=ni300*e*(mew_e+mew_h)\n",
      "#sigma_600=ni600*e*(mew_e+mew_h)\n",
      "#sigma_600/sigma_300 = ni600/ni300\n",
      "#ni600/ni300 =((T2/T1)**(3/2))*math.exp(-Eg/(2*k*T2))*math.exp(Eg/(2*k*T1));\n",
      "#ni600/ni300 =((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T;\n",
      "#let ni600/ni300 be X\n",
      "X=((T2/T1)**(3/2))*math.exp((Eg/(2*k))*T);\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"ratio between the conductivity of material is\",int(X));\n",
      "\n",
      "#answer given in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('ratio between the conductivity of material is', 311270)\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.10, Page number 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "sigma=10**-6;    #electrical conductivity in ohm-1 m-1\n",
      "mew_e=0.85;    #electron mobility in m^2/Vs\n",
      "mew_h=0.04;    #hole mobility in m^2/Vs\n",
      "e=1.6*10**-19;    #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "ni=sigma/(e*(mew_e+mew_h));     #intrinsic carrier concentration\n",
      "ni=ni/10**12;\n",
      "ni=math.ceil(ni*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"intrinsic carrier concentration per m^3 is\",ni,\"*10**12\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('intrinsic carrier concentration per m^3 is', 7.0225, '*10**12')\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 9.11, Page number 272"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "rho_p=10;   #resistivity of p-type Si in ohm cm\n",
      "rho_n=10;   #resistivity of n-type Si in ohm cm\n",
      "mew_e=1350;   #electron mobility in cm^2/Vs\n",
      "mew_h=480;    #hole mobility in cm^2/Vs\n",
      "ni=1.5*10**10;    #carrier concentration in cm^-3\n",
      "e=1.6*10**-19;    #electron charge in C\n",
      "\n",
      "#Calculation\n",
      "rho_p=rho_p*10**-2;#resistivity of p-type Si in ohm m\n",
      "sigma_p=1/rho_p;   #electrical conductivity\n",
      "mew_h=mew_h*10**-3;\n",
      "NA=sigma_p/(e*mew_h);   #acceptor concentration\n",
      "ni=ni*10**6;    #carrier concentration in m^-3\n",
      "n=ni**2/NA;    #concentration of minority carriers in m^-3\n",
      "n=n/10**12;\n",
      "n=math.ceil(n*10**4)/10**4;   #rounding off to 4 decimals\n",
      "rho_n=rho_n*10**-2;      #resistivity of n-type Si in ohm m\n",
      "sigma_n=1/rho_n;   #electrical conductivity\n",
      "mew_e=mew_e*10**-3;\n",
      "ND=sigma_n/(e*mew_e);   #donor concentration\n",
      "p=(ni**2)/ND;    #concentration of minority carriers in m^-3\n",
      "p=p/10**12;\n",
      "p=math.ceil(p*10**3)/10**3;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"donor concentration per m^3 is\",ND);\n",
      "print(\"concentration of minority carriers per m^3\",p,\"*10**12\");\n",
      "print(\"acceptor concentration per m^3 is\",NA);\n",
      "print(\"concentration of minority carriers per m^3 is\",n,\"*10**12\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('donor concentration per m^3 is', 4.6296296296296284e+19)\n",
        "('concentration of minority carriers per m^3', 4.861, '*10**12')\n",
        "('acceptor concentration per m^3 is', 1.3020833333333331e+20)\n",
        "('concentration of minority carriers per m^3 is', 1.7281, '*10**12')\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}