{
 "metadata": {
  "name": "Chapter_6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": "Chapter 6 - Optical sources 1: the laser\n"
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.1, page 301"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nc=2.998*10**8                              #speed of light in m/s\nh=0.5*10**-6                               #operating wavelength in um\nt=1000                                     #tempreture in K\n\n#Calculation\nf=c/h                                                 #operating frequency\nr=1/math.exp((6.626*10**-34*f)/(1.381*10**-23*t))     #ratio\n\n#Result\nprint'Ratio = %.1f x 10^-13 '%(r*10**13)\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Ratio = 3.2 x 10^-13 \n"
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.2, page 306"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#Variable declaration\nn=1.78                                   #refractive index\nL=0.04                                   #length in meter\nh=0.55*10**-6                            #peak emission wavelength in um\nc=2.998*10**8                            #speed of light in meter\n\n#Calculation\nq=2*n*L/h                                #no of longitudinal modes\nsf=c/(2*n*L)                             #frequency separation modes\n\n#Result\nprint'No of longitudinal modes = %.1f x 10^5'%(q/10**5)\nprint'Frequency separation modes = %.1f GHz'%(sf/10**9)\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "No of longitudinal modes = 2.6 x 10^5\nFrequency separation modes = 2.1 GHz\n"
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.3, page 308"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "#Variable declaration\na=30                                    #active cavity losses\nL=0.06                                  #length in meter\nr=0.3                                   #reflectivity\n\n\n#Calculation\ngm=a+(1/L)+(1/r)                           #laser gain coefficient\n\n\n#Result\nprint'Laser gain coefficient = %.1f cm^-1'%gm",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Laser gain coefficient = 50.0 cm^-1\n"
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.4, page 315"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nBt1=7.21*10**-10                                  #recombination coefficient of GaAs\nBt2=1.79*10**-15                                  #recombination coefficient of Si\nN=10**18                                          #hole concentration \n\n#Calculation\ntr1=(Bt1*N)**-1                                   #radiative carrier lifetime of GaAs\ntr2=(Bt2*N)**-1                                   #radiative carrier lifetime of Si\n\n#Result\nprint'Radiative carrier lifetime of silicon = %.2f ms'%(tr2*1000)\nprint'Radiative carrier lifetime of gallium arsenide = %.2f ns'%(tr1*10**9)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Radiative carrier lifetime of silicon = 0.56 ms\nRadiative carrier lifetime of gallium arsenide = 1.39 ns\n"
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.5, page 322"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nn=3.6                                         #refractive index\nB=21*10**-3                                   #gain factor\na=10                                          #loss coefficient per cm\nL=250*10**-4                                  #optical cavity length\nw=100*10**-4                                  #optical cavity width\n\n#Calculation\nr=((n-1)/(n+1))**2                             #reflectivity\njth=(1/B)*(a+math.log(1/r)/L)                  #threshold current density\narea=L*w                                       #area\nith=jth*area                                   #threshold current\n \n#Result\nprint'Threshold current = %.1f mA'%(ith*1000)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Threshold current = 662.4 mA\n"
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.6, page 330"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nnt=0.18                                  #total efficiency\nE=1.43                                   #bandgap energy\nV=2.5                                    #voltage\n\n\n#Calculation\nnep=nt*(E/V)*100                            #external power efficiency\n\n#Result\nprint'External power efficiency = %d percent'%nep",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "External power efficiency = 10 percent\n"
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.7, page 352"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\nt1=20+273                               #tempreture 20 \u00b0C convert to kelvin\nt2=80+273                               #tempreture 80 \u00b0C convert to kelvin\nL1=160                                  #tempreture 160K\nL2=55                                   #tempreture 55K\n\n#Calculation\na=t1*L1**-1                          \nb=t2*L1**-1\nc=t1*L2**-1\nd=t2*L2**-1\nJa1=math.exp(a)                           #For the AlGaAs device\nJa2=math.exp(b)                           #For the AlGaAs device\nJa=Ja2/Ja1                                #ratio of the current densities\nJb1=math.exp(c)                           #For the InGaAsP device\nJb2=math.exp(d)                           #For the InGaAsP device\nJb=Jb2/Jb1                                #ratio of the current densities\n\n#Result\nprint'Threshold current density at 20 \u00b0C = %.2f'%Ja\nprint'                          at 80 \u00b0C = %.2f' %Jb\n",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "Threshold current density at 20 \u00b0C = 1.45\n                          at 80 \u00b0C = 2.98\n"
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": "Example 6.8, page 359"
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": "import math\n\n#Variable declaration\ns=10**-15                            #RIN value    \nf=100*10**6                          #bandwidth\ne=1.602*10**-19                      #1 electron volt\nn=0.6                                #quantum efficiency\nh=1.55*10**-6                        #wavelength in um\npe=2*10**-3                          #power incident\nB=100*10**6                          #bandwidth\nh1=6.626*10**-34                     #plancks constant\nc=2.998*10**8                        #speed of light\n\n#Calculation\nsr=s*f                                 \nrin=math.sqrt(sr)                                 #RMS value of power fluctuation\nirn=e*n*h*rin*pe*math.sqrt(B)*10**-4/(h1*c)       #RMS noise current\n\n#Result\nprint'(a) RMS value of power fluctuation = %.2f x 10^-4 W'%(rin*10**4)\nprint'(b) RMS noise current = %.2f x 10^-7 A'%(irn*10**7)",
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": "(a) RMS value of power fluctuation = 3.16 x 10^-4 W\n(b) RMS noise current = 4.74 x 10^-7 A\n"
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}