{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1> Chapter No 3 : Excess Carriers In Semiconductors<h1>"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.1, Page No 145 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "n_o = 10**17          #in/cm^3\n",
      "n_i = 1.5*10**10      #in /cm^3\n",
      "\n",
      "#CALCULATIONS\n",
      "p_o = ((n_i)**(2))/n_o      #in holes/cm^3\n",
      "\n",
      "#RESULTS\n",
      "print('The hole concentration  is =%.f  in holes/cm^3' %p_o)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The hole concentration  is =2250  in holes/cm^3\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.3, Page No  146"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "n_i = 1.5 * 10**10              #in /cm^3 for silicon\n",
      "N_d = 10**17                    #in atoms/cm^3\n",
      "n_o = 10**17                   #electrons/cm^3\n",
      "KT = 0.0259\n",
      "\n",
      "#CALCULATIONS\n",
      "# E_r - E_i = KT * log(n_o/n_i)\n",
      "del_E = KT * math.log(n_o/n_i)                 #in eV\n",
      "\n",
      "#RESULTS\n",
      "print('The energy band for this type material is Ei =%.2f eV' %del_E)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The energy band for this type material is Ei =0.41 eV\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.4 Page No 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "K = 1.38*10**-23               #in J/K\n",
      "T = 27                     #in degree C\n",
      "T = T + 273               #in K\n",
      "e = 1.6*10**-19          \n",
      "Miu = 0.17             #in m^2/v-s\n",
      "Miu1 = 0.025           #in m^2/v-s\n",
      "\n",
      "#CALCULATIONS\n",
      "D_n = ((K*T)/e)*Miu        #in m^2/s\n",
      "D_p = ((K*T)/e)*Miu1    #in m^2/s\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The diffusion coefficient  of electrons  is =%.2f X 10^-4 in m^2/s ' %(D_n*(10**4)))\n",
      "print('The diffusion coefficient  of holes  is =%.2f X 10^-4 in m^2/s ' %(D_p*(10**4)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion coefficient  of electrons  is =43.99 X 10^-4 in m^2/s \n",
        "The diffusion coefficient  of holes  is =6.47 X 10^-4 in m^2/s \n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.5, Page No 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Miu_n = 0.15           #in m^2/v-s\n",
      "K = 1.38*10**-23      \n",
      "T = 300                #in K\n",
      "e = 1.6*10**-19      #in C\n",
      "\n",
      "#CALCULATIONS\n",
      "D_n = Miu_n*((K*T)/e)            #in m^2/s\n",
      "Torque_n = 10**-7                 #in s\n",
      "L_n = math.sqrt(D_n*Torque_n)    #in m\n",
      "del_n = 10**20                   #electrons/m^3\n",
      "J_n = (e*D_n*del_n)/L_n        #in A/m^2\n",
      "\n",
      "#RESULTS\n",
      "print('The diffusion length is =%.2f  X 10^-4 in m' %(L_n*(10**5)))\n",
      "print('The diffusion current density  is =%.2f X 10^3 in A/m^2 ' %(J_n/(10**3)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion length is =1.97  X 10^-4 in m\n",
        "The diffusion current density  is =3.15 X 10^3 in A/m^2 \n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.6 Page No 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Sigma_n = 0.1              #in (ohm-cm)^-1\n",
      "Miu_n = 1300\n",
      "q = 1.6*10**-19             #in C\n",
      "\n",
      "#CALCULATIONS\n",
      "n_n = Sigma_n/(Miu_n*q)        #in electrons/cm^3 \n",
      "n_i = 1.5*10**10\n",
      "p_n = ((n_i)**2)/n_n           #in holes/cm^3\n",
      "p_n = p_n * 10**6          #in holes/m^3\n",
      "n_n=n_n*10**6\n",
      "\n",
      "#RESULTS\n",
      "print('Concentration of electrons  is =%.2f X 10^20 per m^3 ' %(n_n/(10**20)))\n",
      "print('Concentration of holes  is =%.2f X 10^11 per m^3 ' %(p_n/(10**11)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Concentration of electrons  is =4.81 X 10^20 per m^3 \n",
        "Concentration of holes  is =4.68 X 10^11 per m^3 \n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.7 Page No 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "L = 100*10**-6         #in m\n",
      "Miu_e = 0.13          #in m^2/V-s\n",
      "Torque_h = 10**-6     #in s\n",
      "Miu_h = 0.05          #in m^2/v-s\n",
      "V = 12                 #in V\n",
      "\n",
      "#CALCULATIONS\n",
      "Torque_n = ((L)**2)/(Miu_e*V)             #in s\n",
      "P = (Torque_h/Torque_n)*(1+(Miu_h/Miu_e))\n",
      "\n",
      "#RESULTS\n",
      "print('Electron transit time  is =%.2f X 10^-9 in sec' %(Torque_n*(10**9)))\n",
      "print('Photoconductor gain is =%.2f  ' %P)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electron transit time  is =6.41 X 10^-9 in sec\n",
        "Photoconductor gain is =216.00  \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.8, Page No 147"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "q = 1.6*10**-19              #in C\n",
      "n_i = 2.5*10**13\n",
      "Miu_n = 3800             #in cm^2/V-s\n",
      "Miu_p = 1800             #in cm^2/V-s\n",
      "\n",
      "#CALCULATIONS\n",
      "Sigma = n_i*(Miu_n + Miu_p)*q             #in (ohm-cm)^-1\n",
      "Rho = 1/Sigma               #in ohm-cm\n",
      "N_D =4.4*10**22/10**8     #in atoms/cm^3\n",
      "Sigma_n = N_D * Miu_n*q   #in (ohm-cm)^-1 \n",
      "Rho1 = 1/Sigma_n     #in ohm cm\n",
      "\n",
      "#RESULTS\n",
      "print('The resistivity  is =%.2f in ohm-cm ' %Rho)\n",
      "print('The resistivity drops  is =%.2f in ohm cm ' %Rho1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistivity  is =44.64 in ohm-cm \n",
        "The resistivity drops  is =3.74 in ohm cm \n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.9 Page No 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "#initialisation of variables\n",
      "n_i = 10**16          #in /m^3\n",
      "N_D = 10**22       #in /m^3\n",
      "\n",
      "#CALCULATIONS\n",
      "n = N_D        #in /m^3\n",
      "p = ((n_i)**2)/n   #in /m^3\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The concentration of  is =%.2f X 10^21  electrons per m^3' %(n/(10**21)))\n",
      "print('The concentration of  is =%.2f X 10^9 holes per m^3 ' %(p/(10**9)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The concentration of  is =10.00 X 10^21  electrons per m^3\n",
        "The concentration of  is =10.00 X 10^9 holes per m^3 \n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.10 Page No 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Rho = 9.6*10**-2       #ohm-m\n",
      "Sigma_n = 1/Rho        #in (ohm-m)^-1\n",
      "Miu_n = 1300           #in cm^2/V-s\n",
      "\n",
      "#CALCULATIONS\n",
      "Miu_n = Miu_n * 10**-4  #in m^2/V-s\n",
      "q = 1.6*10**-19     #in C\n",
      "N_D = Sigma_n/(Miu_n*q)           #in atoms/m^3\n",
      "d = 5*10**22                     #in atoms/cm^3\n",
      "d = d * 10**6                   #// in atoms/m^3\n",
      "R_d = N_D/d                   #Ratio \n",
      "\n",
      "#RESULTS\n",
      "print('Ratio of donor atom to silicon atoms per unit volume is =%.2f X 10^-8  ' %(R_d*(10**8)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ratio of donor atom to silicon atoms per unit volume is =1.00 X 10^-8  \n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3.11 Page No 148"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "n_i = 1.5*10**10            #in /cm^3\n",
      "n_n = 2.25*10**15           #in /cm^3\n",
      "\n",
      "#CALCULATIONS\n",
      "p_n = ((n_i)**2)/n_n         #in /cm^3\n",
      "\n",
      "#RESULTS\n",
      "print('The concentration of  is =%.2f X 10^5 holes per cm^3 ' %(p_n/(10**5)))\n",
      "print('Donor impurity per cm^3 is =%.2f X 10^15 ' %(n_n/(10**15)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The concentration of  is =1.00 X 10^5 holes per cm^3 \n",
        "Donor impurity per cm^3 is =2.25 X 10^15 \n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.12 Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "N_A = 2*10**16           #in /cm^3\n",
      "N_D = 10**16             #in /cm^3\n",
      "\n",
      "#CALCULATIONS\n",
      "C = N_A-N_D             #in /cm^3\n",
      "\n",
      "#RESULTS\n",
      "print('Carrier concentration in holes/cm^3 is =%.2f X 10^16 ' %(C/(10**16)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Carrier concentration in holes/cm^3 is =1.00 X 10^16 \n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.13 Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "del_n = 10**15           #in /cm^3\n",
      "Torque_p = 10*10**-6       #in sec\n",
      "\n",
      "#CALCULATIONS\n",
      "R_G = del_n/Torque_p          #in electron hole pairs/sec/cm^3\n",
      "\n",
      "#RESULTS\n",
      "print('The rate of generation of minority carrier is : =%.2f X 10^20 electron hole pairs/sec/cm^3 ' %(R_G/(10**20)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of generation of minority carrier is : =1.00 X 10^20 electron hole pairs/sec/cm^3 \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.14 Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "V = 1/20.0        #in cm/\u00b5sec\n",
      "V=V*10**6       #in cm/sec\n",
      "\n",
      "#CALCULATIONS\n",
      "E = 10            #in V/cm\n",
      "Miu = V/E         #in cm^2/V-sec\n",
      "\n",
      "#RESULTS\n",
      "print('The mobility of minority charge carrier is =%.f  cm^2/V-sec' %Miu)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mobility of minority charge carrier is =5000  cm^2/V-sec\n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.15 Page No 149"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "q = 1.6 * 10**-19       #in C\n",
      "N_D = 4.5 * 10**15      #in /cm^3\n",
      "del_p = 10**21 \n",
      "e=10                #in cm\n",
      "A = 1             #in mm^2\n",
      "A = A * 10**-14        #cm^2\n",
      "l = 10              #in cm\n",
      "Torque_p = 1            #in microsec\n",
      "\n",
      "\n",
      "#CALCULATIONS\n",
      "Torque_p = Torque_p * 10**-6           #in sec\n",
      "Torque_n = 1                      #in microsec\n",
      "Torque_n = Torque_n * 10**-6        #in  sec\n",
      "n_i = 1.5 * 10**10               #in /cm^3\n",
      "D_n = 30                   #cm^2/sec\n",
      "D_p = 12                  #in cm^2/sec\n",
      "n_o = N_D                #in /cm^3\n",
      "p_o = ((n_i)**2)/n_o           #in /cm^3\n",
      "l_n = math.sqrt(D_n * Torque_n)  #in cm\n",
      "l_p = math.sqrt(D_p * Torque_p)      #in cm\n",
      "x=34.6*10*8-4            #in cm\n",
      "e1 = 1.88 * 10**1        #in cm\n",
      "dnBYdx = del_p * e1        #in cm^4\n",
      "dpBYdx = del_p *e         #in cm^4\n",
      "\n",
      "J_P = -(q) * D_p * dpBYdx       #in A/cm^2\n",
      "J_n = q * D_n * dnBYdx          #in A/cm^2\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('Hole concentration at thermal equilibrium per cm^3 is =%.1f X 10^5  ' %(p_o/(10**5)))\n",
      "print('Diffusion length of holes in cm is =%.1f X 10^-3 ' %(l_p*(10**3)))\n",
      "print('Concentration gradient of holes at distance in cm^4 is =%.f X 10^22 ' %(dpBYdx/(10**22)))\n",
      "print('Concentration gradient of electrons in per cm^4 is =%.1f X 10^22  ' %(dnBYdx/(10**22)))\n",
      "print('Current density of holes due to diffusion in A/cm^2 is =%.2f X 10^4 ' %(J_P/(10**4)))\n",
      "print('Current density of electrons due to diffusion in A/cm^2 is =%.2f X 10^4 ' %(J_n/(10**4)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hole concentration at thermal equilibrium per cm^3 is =0.5 X 10^5  \n",
        "Diffusion length of holes in cm is =3.5 X 10^-3 \n",
        "Concentration gradient of holes at distance in cm^4 is =1 X 10^22 \n",
        "Concentration gradient of electrons in per cm^4 is =1.9 X 10^22  \n",
        "Current density of holes due to diffusion in A/cm^2 is =-1.92 X 10^4 \n",
        "Current density of electrons due to diffusion in A/cm^2 is =9.02 X 10^4 \n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.16 Page No 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "h = 6.626 * 10**-34          #in J-s\n",
      "q= 1.6*10**-19            #in C\n",
      "\n",
      "#CALCULATIONS\n",
      "h= h/q              #in eV\n",
      "c = 3*10**8\n",
      "lembda = 5490*10**-10             #in m\n",
      "E = h*c/lembda                 #in eV\n",
      "\n",
      "#RESULTS\n",
      "print('The energy band gap is =%.2f eV ' %E)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The energy band gap is =2.26 eV \n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.17 Page No 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "D_n = 35               #in cm^2/sec\n",
      "q = 1.6*10**-19        #in C\n",
      "y2 = 6*10**16          #in /cm^3\n",
      "y1 = 10**17           #in /cm^3\n",
      "x2 = 2*10**-4\n",
      "x1 = 0\n",
      "\n",
      "#CALCULATIONS\n",
      "dnBYdx = (y2-y1)/(x2-x1)\n",
      "J_n = q*D_n*dnBYdx              #in A/cm^2\n",
      "\n",
      "#RESULTS\n",
      "print('The current density is =%.f  in A/cm^2' %J_n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current density is =-1120  in A/cm^2\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.18 Page No 151"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "q = 1.6*10**-19               #in C\n",
      "n_n = 5*10**20                #in  /m^3\n",
      "n_n = n_n * 10**-6            #in /cm^3\n",
      "Miu_n = 0.13                   #in m^2/V-sec\n",
      "\n",
      "\n",
      "#CALCULATIONS\n",
      "Miu_n = Miu_n * 10**4       #in cm^2/V-sec\n",
      "Sigma_n = q*n_n*Miu_n      #in ohm-cm^-1\n",
      "Rho = 1/Sigma_n\n",
      "A = 100        # in \u00b5m^2\n",
      "A = A * 10**-8     #in cm^2\n",
      "l = 0.1           #in cm\n",
      "R = Rho * (l/A)        #in ohm\n",
      "R=R*10**-6\n",
      "#RESULTS\n",
      "print('The resistance of the bar  is =%.2f in M ohm' %R)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of the bar  is =0.96 in M ohm\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.19 Page No 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "w = 3.0              #in \u00b5m\n",
      "\n",
      "#CALCULATIONS\n",
      "D = w/9          #in \u00b5m\n",
      "\n",
      "#RESULTS\n",
      "print('Depletion width on P side is =%.2f in \u00b5m ' %D)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depletion width on P side is =0.33 in \u00b5m \n"
       ]
      }
     ],
     "prompt_number": 37
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.20 Page No 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "n_i = 1.5*10**16          #in /m^3\n",
      "n_n = 5*10**20          #in /m^3\n",
      "\n",
      "#CALCULATIONS\n",
      "p_n = ((n_i)**2)/n_n          #in /m^3\n",
      "\n",
      "#RESULTS\n",
      "print('The minority carrier density per m^3 is =%.2f X 10^11' %(p_n/(10**11)))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The minority carrier density per m^3 is =4.50 X 10^11\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.21 Page No 152"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "y2 = 10**14                #in /cm^3\n",
      "y1 = 0\n",
      "x1=-0.5                    #in \u00b5m\n",
      "\n",
      "#CALCULATIONS\n",
      "x1= x1*10**-4             #in cm\n",
      "x2=0\n",
      "dnBYdx = (y2-y1)/(x2-x1)     #in /cm^4\n",
      "q = 1.6*10**-19              #in C\n",
      "D_n = 25                     #in cm^2/sec\n",
      "J_n = q*D_n*dnBYdx          #in A/cm^2\n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print('The collector current density  is =%.f in A/cm^2' %J_n)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The collector current density  is =8 in A/cm^2\n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.22 Page No 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialisation of variables\n",
      "h = 6.64*10**-34              ##in J-s\n",
      "q=1.6*10**-19                #in C\n",
      "\n",
      "#CALCULATIONS\n",
      "h= h/q                     #in eV\n",
      "c = 3*10**8               #in m/s\n",
      "lembda = 0.87*10**-6        #in m\n",
      "E_g = (h*c)/lembda         #in eV\n",
      "\n",
      "#RESULTS\n",
      "print('The band gap in eV is =%.2f ' %E_g)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The band gap in eV is =1.43 \n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.23 Page No 153"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#initialisation of variables\n",
      "alpha = 5*10**4            #in cm^-1\n",
      "l = 0.46*10**-4            #in cm\n",
      "hv = 2                    #in eV\n",
      "I_o = 10**-2             #in W\n",
      "\n",
      "#CALCULATIONS\n",
      "I_t = I_o*math.exp(-alpha*l)   #in W\n",
      "A_p = I_o-I_t            #absorbed power in W or J/s\n",
      "c = 1.43\n",
      "A_E = (hv-c)/hv*A_p           # in J/s\n",
      "e = 1.6*10**-19               #in C\n",
      "P = A_p/(e*hv)               #Perfect quantum efficiency in photon/s\n",
      "\n",
      "#RESULTS\n",
      "print('Total energy absorbed  is =%.f X 10^-3 in J/s' %(A_p*(10**3)))\n",
      "print('Rate of excess thermal energy  is =%.2f X 10^-3 in J/s' %(A_E*(10**3)))\n",
      "print('Perfect quantum efficiency  is =%.2f X 10^16 in photon/s' %(P/(10**16)))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total energy absorbed  is =9 X 10^-3 in J/s\n",
        "Rate of excess thermal energy  is =2.56 X 10^-3 in J/s\n",
        "Perfect quantum efficiency  is =2.81 X 10^16 in photon/s\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example No 3.24 Page No 154"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#initialisation of variables\n",
      "Mu_p = 500         #in cm^2/v-s\n",
      "kT = 0.0259\n",
      "Toh_p = 10**-10         #in sec\n",
      "p_o = 10**17           #in cm^-3\n",
      "q= 1.6*10**-19             # in C\n",
      "A=0.5             #in square meter\n",
      "del_p = 5 * 10**16        #in cm^-3\n",
      "n_i= 1.5*10**10          #in cm^-3    \n",
      "\n",
      "\n",
      "#CALCULATIONS\n",
      "D_p = kT * Mu_p          #in cm/s\n",
      "L_p = math.sqrt(D_p * Toh_p)             # in cm\n",
      "x = 10**-5            #in cm\n",
      "p = p_o+del_p*e**(x/L_p)          #in cm^-3\n",
      "Eip= math.log(p/n_i)*kT              #in eV\n",
      "Ecp= 1.1/2-Eip                   #value of E_c-E_p in eV\n",
      "Ip= q*A*D_p/L_p*del_p*e**(x/L_p)         #in A\n",
      "Qp= q*A*del_p*L_p               #in C\n",
      "\n",
      "#RESULTS\n",
      "print('The hole current  is : =%.2f X 10^3 in A ' %(Ip*(10**3)))\n",
      "print('Approximation error')\n",
      "print('The value of Qp  is :=%.2f X 10^-7 in C' %(Qp*(10**7)))\n",
      "\n",
      "#Note: There is a calculation error to evalaute the value of hole current hence the value of hole current in the book is wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The hole current  is : =8.61 X 10^3 in A \n",
        "Approximation error\n",
        "The value of Qp  is :=1.44 X 10^-7 in C\n"
       ]
      }
     ],
     "prompt_number": 42
    }
   ],
   "metadata": {}
  }
 ]
}