{
 "metadata": {
  "name": "",
  "signature": "sha256:8acf5696f32436267e7f75bdb11d995255b92eabdfb678e05be23818c6e6d6a6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 18 - Optoelectronic Devices"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E1 - Pg 901"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_1 Pg-901\n",
      "#calculate Source resistance,Wattage rating\n",
      "Vs=12. #supply voltage in V\n",
      "Vd=2. #forward bias voltage in V\n",
      "Id=20.*10.**(-3.) #forward bias current\n",
      "Rs=(Vs-Vd)/Id #source resistor\n",
      "print '%s %.0f' %(\"Source resistance = ohm\",Rs)\n",
      "P=Id**2.*Rs #power\n",
      "print '%s %.1f' %(\"Wattage rating = mW\",P*1e3)\n",
      "print '%s' %(\"Therefore a standard size 0.25 watt = 250mW resistor is required\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Source resistance = ohm 500\n",
        "Wattage rating = mW 200.0\n",
        "Therefore a standard size 0.25 watt = 250mW resistor is required\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E2 - Pg 945"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_2 Pg-945\n",
      "#calculate R\n",
      "import math\n",
      "T=2000. #temperature in Kelvin\n",
      "f=5.*10.**(14.) # frequency in Hz\n",
      "h=6.6*10.**(-34.) #planck constant\n",
      "k=1.38*10.**(-23.) #Boltzmann constant\n",
      "R=math.exp((h*f)/(k*T)) #ratio of spontaneous and stimulated emisson\n",
      "print '%s %.2f' %(\"R =\",R*1e-5)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "R = 1.56\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E3 - Pg 946"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_3 Pg-946\n",
      "#calculate Average wavelength of visible radiation\n",
      "import math\n",
      "print '%s' %(\"Average wavelength of visible radiation = 550 nm\")\n",
      "print '%s' %(\"      E1 - E2 = hc/lamda\")\n",
      "h=6.6*10.**(-34.) #planck constant\n",
      "c=3.*10.**(8.) #speed of light in sec\n",
      "lamda= 550.*10.**(-9.) #wavelength in m\n",
      "E=h*c/lamda #difference in energy levels in Joules\n",
      "e=1.6*10.**(-19.) #electron charge in eV\n",
      "E_eV=E/e #difference in energy levels in electronVolt\n",
      "print '%s %.1f' %(\"              = J\",E*1e19)\n",
      "print '%s %.2f' %(\"              = eV\",E_eV)\n",
      "T=300. #temperature in Kelvn\n",
      "k=1.38*10.**(-23.) #Boltzmann constant\n",
      "print '%s' %(\"Average room temperature=300K and g1=g2,we have\")\n",
      "N=math.exp((-E)/(k*T))\n",
      "print '%s %.2f' %(\"N2/N1 =\",N*1e37)\n",
      "#answer in the book is wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average wavelength of visible radiation = 550 nm\n",
        "      E1 - E2 = hc/lamda\n",
        "              = J 3.6\n",
        "              = eV 2.25\n",
        "Average room temperature=300K and g1=g2,we have\n",
        "N2/N1 = 0.17\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E4 - Pg 946"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_4 Pg-946\n",
      "#calculate Energy absorbed,recombination radiation\n",
      "import math\n",
      "w=0.3*10.**(-6.)*100. #width of silicon in cm\n",
      "alpha=4.*10.**(4.) \n",
      "phi=10.**(-2.)\n",
      "e=1.6*10.**(-19.) #electron charge in eV\n",
      "print '%s' %(\"(1)Energy absorbed/sec is given by \")\n",
      "E=phi*(1.-math.exp(alpha*w)) #energy absorbed(textbook answer is wrong)\n",
      "print '%s %.1f' %(\"                = mW\",abs(E)*1e3)\n",
      "print '%s' %(\"(2)The portion of each photo energy that is converted into heat is obtained as hv-Eg/hv\")\n",
      "Heat=(3-1.12)/3.*100. #photon energy coverted to heat\n",
      "print '%s %.0f' %(\"                = \",Heat)\n",
      "E1=(62./100.)*0.0232 #energy dissipated/sec (textbook answer is wrong)\n",
      "print '%s %.1f' %(\"\\nObviously, the amount of energy dissipated/sec to lattice is = mW\",E1*1e3)\n",
      "print '%s' %(\"(3)Number of photons/sec from recombination is\")\n",
      "num_photons=2.4/(e*1.12)\n",
      "print '%s %.1f' %(\"                = photon/sec\",num_photons*1e-19)\n",
      "#textbook answer is wrong\n",
      "print '%s' %(\"Therefore recombination radiation\")\n",
      "RR=abs(E)-E1 #recombination radiation (textbok answer is wrong)\n",
      "print '%s %.1f' %(\"                = mW\",RR*1e3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(1)Energy absorbed/sec is given by \n",
        "                = mW 23.2\n",
        "(2)The portion of each photo energy that is converted into heat is obtained as hv-Eg/hv\n",
        "                =  63\n",
        "\n",
        "Obviously, the amount of energy dissipated/sec to lattice is = mW 14.4\n",
        "(3)Number of photons/sec from recombination is\n",
        "                = photon/sec 1.3\n",
        "Therefore recombination radiation\n",
        "                = mW 8.8\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E5 - Pg 947"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_5 Pg-947\n",
      "#calculate Time taken to diffuse\n",
      "d=5.*10.**(-6.) #thickness of silicon in m\n",
      "Dc=3.4*10.**(-3.) #diffusion coefficient in m**2sec**(-1)\n",
      "t=d**2./(2.*Dc) #time taken to diffuse\n",
      "print '%s %.1f' %(\"Time taken to diffuse = sec\",t*1e9)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time taken to diffuse = sec 3.7\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E6 - Pg 947"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_6 Pg-947\n",
      "#calculate Diode capacitance\n",
      "import math\n",
      "A=10.**(-6.) #diode area in m\n",
      "epsilon_r=11.7 #relative permitivity \n",
      "Nd=10.**(21.) #number of doping carriers\n",
      "V=10. #bias potential in V\n",
      "e=1.6*10.**(-19.) #electron charge in eV\n",
      "epsilon_0=8.85*10.**(-12.) #permitivity of free space\n",
      "Cj=A/2.*math.sqrt(2.*e*epsilon_r*epsilon_0*Nd)/math.sqrt(V)\n",
      "print '%s %.f' %(\"Diode capacitance = pF\",Cj*1e12)\n",
      "#textbook answer is wrong\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diode capacitance = pF 29\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E7 - Pg 947"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_7 Pg-947\n",
      "#calculate Gain\n",
      "import math\n",
      "L=10.**(-6.) #length of cavity in m\n",
      "r2=0.5 #relative coefficient of semiconductor\n",
      "r1=1.5 #relative coefficient of semiconductor\n",
      "print '%s' %(\"No internal loss means di=0; we have\")\n",
      "g=math.log10(1./(r1*r2))/(2.*L) #gain of the laser (textbook answer is wrong)\n",
      "print '%s %.2f' %(\"Gain g = cm**(-1)\",g*1e-3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "No internal loss means di=0; we have\n",
        "Gain g = cm**(-1) 62.47\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example E8 - Pg 947"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Ex18_8 Pg-947\n",
      "#calculate gain\n",
      "L=100.*10.**(-6.) #length of semiconductor in m\n",
      "A=10.**(-7.) #area of semiconductor in cm**2\n",
      "V=10. #applied voltage in V\n",
      "mew_n=1350. #mobility of electrons \n",
      "mew_p=480. #mobiltiy of protons\n",
      "tp=10.**(-6.) #lifetime of protons in sec\n",
      "tn=L/(mew_n*V) #lifetime of electrons in sec\n",
      "Gain=tp/tn*(1+(mew_p/mew_n)) #gain of photoconductor\n",
      "print '%s %.2f' %(\"Gain =\",Gain*1e-2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gain = 1.83\n"
       ]
      }
     ],
     "prompt_number": 9
    }
   ],
   "metadata": {}
  }
 ]
}