{
 "metadata": {
  "name": "",
  "signature": "sha256:764d1c60d9fefbb17ec0ffb4d8cdbf1cddd8802a6e86f8e004d6805017f0ecae"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter : 2 - Excess Carriers in Semiconductor"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.1 - Page No : 2-34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "# Given data\n",
      "N_d = 10**17 # atoms/cm**3\n",
      "n_i = 1.5 * 10**10 # in /cm**3\n",
      "n_o = 10**17 # in cm**3\n",
      "# p_o * n_o = (n_i)**2\n",
      "p_o = (n_i)**2 / n_o #in holes/cm**3\n",
      "print \"The holes concentration at equilibrium = %0.2e holes/cm**3 \" %p_o"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The holes concentration at equilibrium = 2.25e+03 holes/cm**3 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.3 - Page No : 2-35"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "# Given data\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",
      "# E_r - E_i = KT * log(n_o/n_i)\n",
      "del_E = KT * log(n_o/n_i) # in eV\n",
      "print \"The energy band for this type material, E_F = Ei +\",round(del_E,3),\" eV\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The energy band for this type material, E_F = Ei + 0.407  eV\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.4 - Page No : 2-36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "K = 1.38 * 10**-23 # in J/K\n",
      "T = 27 # in degree\n",
      "T = T + 273 # in K\n",
      "e = 1.6 * 10**-19 # in C\n",
      "Mu_e = 0.17 # in m**2/v-s\n",
      "Mu_e1 = 0.025 # in m**2/v-s\n",
      "D_n = ((K * T)/e) * Mu_e # in m**2/s\n",
      "print \"The diffusion coefficient of electrons = %0.1e m**2/s \" %D_n\n",
      "D_p = ((K * T)/e) * Mu_e1 # in m**2/s\n",
      "print \"The diffusion coefficient of  holes = %0.2e m**2/s \" %D_p"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion coefficient of electrons = 4.4e-03 m**2/s \n",
        "The diffusion coefficient of  holes = 6.47e-04 m**2/s \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.5 - Page No : 2-36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import sqrt\n",
      "# Given data\n",
      "Mu_n = 0.15 # in m**2/v-s\n",
      "K = 1.38 * 10**-23  # in J/K\n",
      "T = 300 # in K\n",
      "del_n = 10**20 # in per m**3\n",
      "Toh_n = 10**-7 # in s\n",
      "e = 1.6 * 10**-19 # in C\n",
      "D_n = Mu_n * ((K * T)/e) # in m**2/s\n",
      "print \"The diffusion coefficient = %0.2e m**2/s \" %D_n\n",
      "L_n = sqrt(D_n * Toh_n) # in m \n",
      "print \"The Diffusion length = %0.2e m \" %L_n\n",
      "J_n = (e * D_n * del_n)/L_n # in A/m**2\n",
      "print \"The diffusion current density = %0.2e A/m**2 \"  %J_n\n",
      "# Note : The value of diffusion coefficient in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion coefficient = 3.88e-03 m**2/s \n",
        "The Diffusion length = 1.97e-05 m \n",
        "The diffusion current density = 3.15e+03 A/m**2 \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.6 - Page No : 2-36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Sigma = 0.1 # in (ohm-m)**-1\n",
      "Mu_n = 1300 \n",
      "n_i = 1.5 * 10**10 \n",
      "q = 1.6 * 10**-19 # in C\n",
      "n_n = Sigma/(Mu_n * q) # in electrons/cm**3\n",
      "print \"The concentration of electrons = %0.2e per m**3 \" %(n_n*10**6)\n",
      "p_n = (n_i)**2/n_n # in per cm**3\n",
      "p_n = p_n * 10**6 # in perm**3\n",
      "print \"The concentration of holes = %0.2e per m**3 \" %p_n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The concentration of electrons = 4.81e+20 per m**3 \n",
        "The concentration of holes = 4.68e+11 per m**3 \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.7 - Page No : 2-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Mu_e = 0.13 # in m**2/v-s\n",
      "Mu_h = 0.05 # in m**2/v-s\n",
      "Toh_h = 10**-6 # in s\n",
      "L = 100 # in \u00b5m\n",
      "L = L * 10**-6 # in m\n",
      "V = 2 # in V\n",
      "t_n =L**2/(Mu_e * V) # in s\n",
      "print \"Electron transit time = %0.1e seconds \" %t_n\n",
      "p_g = (Toh_h/t_n) * (1 + Mu_h/Mu_e) #photo conductor gain \n",
      "print \"Photo conductor gain = %0.2f\" %p_g\n",
      "\n",
      "# Note: There is a calculation error to evaluate the value of t_n. So the answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electron transit time = 3.8e-08 seconds \n",
        "Photo conductor gain = 36.00\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.8 - Page No : 2-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "n_i = 2.5 * 10**13 \n",
      "Mu_n = 3800 \n",
      "Mu_p = 1800 \n",
      "q = 1.6 * 10**-19 # in C\n",
      "Sigma = n_i * (Mu_n + Mu_p) * q # in (ohm-cm)**-1\n",
      "Rho = 1/Sigma # in ohm-cm\n",
      "Rho= round(Rho) \n",
      "print \"The resistivity of intrinsic germanium = %0.f ohm-cm \" %Rho\n",
      "N_D = 4.4 * 10**22/(1*10**8) # in atoms/cm**3\n",
      "Sigma_n = N_D * Mu_n * q # in (ohm-cm)**-1\n",
      "Rho_n = 1/Sigma_n # in ohm-cm\n",
      "print \"If a donor type impurity is added to the extent of 1 atom per 10**8 Ge atoms, then the resistivity drops = %0.2f ohm-cm \" %Rho_n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistivity of intrinsic germanium = 45 ohm-cm \n",
        "If a donor type impurity is added to the extent of 1 atom per 10**8 Ge atoms, then the resistivity drops = 3.74 ohm-cm \n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.9 - Page No : 2-38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "n_i = 10**16 # in /m3\n",
      "N_D = 10**22 # in /m**3\n",
      "n = N_D # in /m**3\n",
      "print \"Electron concentration = %0.1e per m**3 \" %n\n",
      "p = (n_i)**2/n # in /m**3\n",
      "print \"Hole concentration = %0.1e per m**3 \" %p"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Electron concentration = 1.0e+22 per m**3 \n",
        "Hole concentration = 1.0e+10 per m**3 \n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.10 - Page No : 2-38"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "Rho = 9.6 * 10**-2 # in ohm-m\n",
      "Sigma_n = 1/Rho # in (ohm-m)**-1\n",
      "q = 1.6 * 10**-19 # in C\n",
      "Mu_n = 1300 * 10**-4 # in m**2/v-s\n",
      "N_D = Sigma_n / (Mu_n * q) # in atoms/m**3\n",
      "A_D = N_D # Atom density in atoms/cm**3\n",
      "A_D = A_D * 10**6 # atoms/m**3\n",
      "R_si = N_D/A_D # ratio\n",
      "print \"The ratio of donor atom to silicon atom = %0.1e\" %R_si\n",
      "\n",
      "# Note: In the book the wrong value of N_D (5*10**22) is putted to evaluate the value of \n",
      "#       Atom Density (A_D) whereas the value of N_D is calculated as 5*10**20.So the answer in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The ratio of donor atom to silicon atom = 1.0e-06\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.11 - Page No : 2-39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "n_i = 1.5 * 10**10 # in per cm**3\n",
      "n_n = 2.25 * 10**15 # in per cm**3\n",
      "p_n = (n_i)**2/n_n # in per cm**3\n",
      "print \"The equilibrium electron = %0.1e per cm**3 \" %p_n\n",
      "h_n = n_n # in cm**3\n",
      "print \"Hole densities = %0.2e per cm**3 \" %h_n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The equilibrium electron = 1.0e+05 per cm**3 \n",
        "Hole densities = 2.25e+15 per cm**3 \n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.12 - Page No : 2-39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "N_A = 2 * 10**16 # in atoms/cm**3\n",
      "N_D = 10**16 # in atoms/cm**3\n",
      "C_c = N_A-N_D # C_c stands for Carrier concentration in /cm**3\n",
      "print \"Carrier concentration = %0.1e holes/cm**3 \" %C_c"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Carrier concentration = 1.0e+16 holes/cm**3 \n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.13 - Page No : 2-39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "del_n = 10**15 # in cm**3\n",
      "Torque_p = 10 * 10**-6 # in sec\n",
      "R_g = del_n/Torque_p # in hole pairs/sec/cm**3\n",
      "print \"The rate of generation of minority carrier = %0.1e electron hole pairs/sec/cm**3 \" %R_g"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The rate of generation of minority carrier = 1.0e+20 electron hole pairs/sec/cm**3 \n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.14 - Page No : 2-40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "v = 1/(20 * 10**-6) # in cm/sec\n",
      "E = 10 # in V/cm\n",
      "Mu= v/E # in cm**2/V-sec\n",
      "print \"The mobility of minority charge carrier = %0.f cm**2/V-sec \" %Mu"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The mobility of minority charge carrier = 5000 cm**2/V-sec \n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.15 - Page No : 2-40"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\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",
      "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 # in 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",
      "print \"Hole concentration at thermal equilibrium = %0.1e per cm**3 \" %p_o\n",
      "l_n = sqrt(D_n * Torque_n) # in cm\n",
      "print \"Diffusion length of electron = %0.2e cm \" %l_n\n",
      "l_p = sqrt(D_p * Torque_p) # in cm\n",
      "print \"Diffusion length of holes = %0.1e cm \" %l_p\n",
      "x=34.6*10**-4 # in cm\n",
      "dpBYdx = del_p *e # in cm**4\n",
      "print \"Concentration gradient of holes = %0.1e cm**4 \" %dpBYdx\n",
      "e1 = 1.88 * 10**1 # in cm\n",
      "dnBYdx = del_p * e1 # in cm**4 \n",
      "print \"Concentration gradient of electrons = %0.2e per cm**4 \" %dnBYdx\n",
      "J_P = -(q) * D_p * dpBYdx # in A/cm**2\n",
      "print \"Current density of holes due to diffusion = %0.2e A/cm**2 \" %J_P\n",
      "J_n = q * D_n * dnBYdx # in A/cm**2\n",
      "print \"Current density of electrons due to diffusion = %0.1e A/cm**2 \" %J_n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Hole concentration at thermal equilibrium = 5.0e+04 per cm**3 \n",
        "Diffusion length of electron = 5.48e-03 cm \n",
        "Diffusion length of holes = 3.5e-03 cm \n",
        "Concentration gradient of holes = 1.0e+22 cm**4 \n",
        "Concentration gradient of electrons = 1.88e+22 per cm**4 \n",
        "Current density of holes due to diffusion = -1.92e+04 A/cm**2 \n",
        "Current density of electrons due to diffusion = 9.0e+04 A/cm**2 \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.16 - Page No : 2-42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "e= 1.6*10**-19 # electron charge in C\n",
      "h = 6.626 * 10**-34 # in J-s\n",
      "h= h/e # in eV\n",
      "c = 3 * 10**8 # in m/s\n",
      "lembda = 5490 * 10**-10 # in m\n",
      "f = c/lembda \n",
      "E = h * f # in eV\n",
      "print \"The energy band gap of the semiconductor material = %0.2f eV \" %E"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The energy band gap of the semiconductor material = 2.26 eV \n"
       ]
      }
     ],
     "prompt_number": 32
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.17 - Page No : 2-42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "y2 = 6 * 10**16 # in /cm**3\n",
      "y1 = 10**17 # in /cm**3\n",
      "x2 = 2 # in \u00b5m\n",
      "x1 = 0 # in \u00b5m\n",
      "D_n = 35 # in cm**2/sec\n",
      "q = 1.6 *10**-19 # in C\n",
      "dnBYdx = (y2 - y1)/((x2-x1) * 10**-4) \n",
      "J_n = q * D_n * dnBYdx # in A/cm**2\n",
      "print \"The current density in silicon = %0.f A/cm**2 \" %J_n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current density in silicon = -1120 A/cm**2 \n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.18 - Page No : 2-43"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\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",
      "Mu_n = 0.13 # in m**2/V-sec\n",
      "Mu_n = Mu_n * 10**4 # in cm**2/V-sec\n",
      "Sigma_n = q * n_n * Mu_n # in (ohm-cm)**-1\n",
      "Rho = 1/Sigma_n # in \u03a9-cm\n",
      "l = 0.1 # in cm\n",
      "A = 100 # \u00b5m**2\n",
      "A = A * 10**-8 # in cm**2\n",
      "R = Rho * (l/A) # in Ohm\n",
      "R=round(R*10**-6) # in M\u03a9\n",
      "print \"The resistance of the bar = %0.f M\u03a9 \"  %R"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of the bar = 1 M\u03a9 \n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.19 - Page No : 2-44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "t_d = 3 # total depletion in \u00b5m\n",
      "D = t_d/9 # in \u00b5m\n",
      "print \"Depletion width = %0.1f \u00b5m \" %D"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Depletion width = 0.3 \u00b5m \n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.20 - Page No : 2-44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "n_i = 1.5 * 10**16 # in /m**3\n",
      "n_n = 5 * 10**20 # in /m**3\n",
      "p_n = (n_i)**2/n_n # in /m**3\n",
      "print \"The majority carrier density = %0.2e per m**3 \" %p_n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The majority carrier density = 4.50e+11 per m**3 \n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.21 - Page No : 2-44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "D_n = 25 # in cm**2/sec\n",
      "q = 1.6 * 10**-19 # in C\n",
      "y2 = 10**14 # in /cm**3\n",
      "y1 = 0 # in /cm**3\n",
      "x2 = 0 #in  \u00b5m\n",
      "x1 = 0.5 # in \u00b5m\n",
      "x1 = x1 * 10**-4 # in cm\n",
      "dnBYdx = abs((y2-y1)/(x2-x1)) # in /cm**4 \n",
      "J_n = q * D_n * (dnBYdx) # in /cm**4\n",
      "J_n = J_n * 10**-1 # in A/cm**2\n",
      "print \"The collector current density = %0.f A/cm**2 \" %J_n\n",
      "\n",
      "# Note: In the book, the calculated value of dn by dx (2*10**19) is wrong. Correct value is 2*10**18\n",
      "#       so the answer in the book is wrong."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The collector current density = 1 A/cm**2 \n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example : 2.21.22 - Page No : 2-45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "h = 6.64 * 10**-34 # in J-s\n",
      "e= 1.6*10**-19 # electron charge in C\n",
      "c= 3 * 10**8 # in m/s\n",
      "lembda = 0.87 # in \u00b5m\n",
      "lembda = lembda * 10**-6 # in m\n",
      "E_g = (h * c)/lembda # in J-s\n",
      "E_g= E_g/e # in eV\n",
      "print \"The band gap of the material = %0.3f eV \" %E_g"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The band gap of the material = 1.431 eV \n"
       ]
      }
     ],
     "prompt_number": 39
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.23 - Page No : 2-45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import exp\n",
      "# Given data\n",
      "I_o = 10 # in mW\n",
      "e = 1.6 * 10**-19 # in J/eV\n",
      "hv = 2 # in eV\n",
      "hv1=1.43 # in eV\n",
      "alpha = 5 * 10**4 # in cm**-1\n",
      "l = 46 # in \u00b5m\n",
      "l = l * 10**-6 # in m\n",
      "I_t = round(I_o * exp(-(alpha) * l)) # in mW\n",
      "AbsorbedPower= I_o-I_t # in mW\n",
      "AbsorbedPower=AbsorbedPower*10**-3 # in W or J/s\n",
      "print \"The absorbed power = %0.1e watt or J/s \" %AbsorbedPower\n",
      "F= (hv-hv1)/hv # fraction of each photon energy unit\n",
      "EnergyConToHeat= AbsorbedPower*F # in J/s\n",
      "print \"The amount of energy converted to heat per second = %0.2e in J/s \" %EnergyConToHeat\n",
      "A= (AbsorbedPower-EnergyConToHeat)/(e*hv1) \n",
      "print \"The number of photon per sec given off from recombination events = %0.2e photons/s \" %A"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The absorbed power = 9.0e-03 watt or J/s \n",
        "The amount of energy converted to heat per second = 2.57e-03 in J/s \n",
        "The number of photon per sec given off from recombination events = 2.81e+16 photons/s \n"
       ]
      }
     ],
     "prompt_number": 43
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.24 - Page No : 2-46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\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",
      "D_p = kT * Mu_p # in cm/s\n",
      "L_p = sqrt(D_p * Toh_p) # in cm\n",
      "x = 10**-5 # in cm\n",
      "p = p_o+del_p* exp(x/L_p) # in cm**-3\n",
      "# p= n_i*%e**(Eip)/kT where Eip=E_i-F_p\n",
      "Eip= 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*exp(x/L_p) # in A\n",
      "print \"The hole current = %0.2e A \" %Ip\n",
      "Qp= q*A*del_p*L_p # in C\n",
      "print \"The value of Qp = %0.2e C \" %Qp\n",
      "\n",
      "# Note: There is a calculation error or miss print to evalaute the value of hole current but they putted correct \n",
      "# value of it to evaluate the value of Qp.Hence the value of hole current in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The hole current = 1.90e+03 A \n",
        "The value of Qp = 1.44e-07 C \n"
       ]
      }
     ],
     "prompt_number": 49
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example :  2.21.25 - Page No : 2-47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Given data\n",
      "KT = 0.0259 \n",
      "A = 0.5 # in cm**2\n",
      "Toh_p = 10**-10 # in sec\n",
      "p_o = 10**17 # in per cm**3\n",
      "del_p = 5 * 10**16 # in per cm**3\n",
      "x = 10**-5 # in cm\n",
      "Mu_p = 500 # in cm**2/V-S\n",
      "q = 1.6 * 10**-19 # in C\n",
      "D_p = KT * Mu_p # in cm/s\n",
      "L_p = sqrt(D_p * Toh_p) # in cm\n",
      "p = p_o * del_p * (exp(x/L_p)) # in per cm**3\n",
      "I_p =q * A * (D_p/L_p) * del_p * (exp(x/L_p)) # in A\n",
      "print \"The hole current = %0.2e A \" %I_p\n",
      "Q_p = q * A * del_p * L_p # in C \n",
      "print \"The hole charge = %0.2e C \" %Q_p\n",
      "\n",
      "# Note: There is a calculation error to evalaute the value of hole current but they putted correct \n",
      "#      value of it to evaluate the value of Qp.Hence the value of hole current in the book is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The hole current = 1.90e+03 A \n",
        "The hole charge = 1.44e-07 C \n"
       ]
      }
     ],
     "prompt_number": 51
    }
   ],
   "metadata": {}
  }
 ]
}