{
 "metadata": {
  "name": "",
  "signature": "sha256:86128ebcddc1aace30166722ef06d4489b2c11f53b2c59c5d439d37f83881533"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Laser"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.1, Page number 59 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "lamda=632.8*10**-9;    #wavelength in m\n",
      "P=5*10**-3;        #output power in W\n",
      "\n",
      "#Calculation\n",
      "E=(h*c)/lamda;    #energy of one photon\n",
      "E_eV=E/(1.6*10**-19);   #converting J to eV\n",
      "E_eV=math.ceil(E_eV*1000)/1000;   #rounding off to 3 decimals\n",
      "N=P/E;    #number of photons emitted\n",
      "\n",
      "\n",
      "#Result\n",
      "print(\"energy of one photon in eV is\",E_eV);\n",
      "print(\"number of photons emitted per second is\",N);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('energy of one photon in eV is', 1.964)\n",
        "('number of photons emitted per second is', 1.5917094275077976e+16)\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.2, Page number 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "lamda=632.8*10**-9;    #wavelength in m\n",
      "\n",
      "#Calculation\n",
      "E=(h*c)/lamda;   #energy of one photon\n",
      "E_eV=E/(1.6*10**-19);   #converting J to eV\n",
      "E_eV=math.ceil(E_eV*1000)/1000;   #rounding off to 3 decimals\n",
      "\n",
      "#Result\n",
      "print(\"energy of one photon in eV is\",E_eV);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('energy of one photon in eV is', 1.964)\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.3, Page number 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "E1=0;        #value of 1st energy level in eV\n",
      "E2=1.4;       #value of 2nd energy level in eV\n",
      "lamda=1.15*10**-6;\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "\n",
      "#Calculation\n",
      "E=(h*c)/lamda;   #energy of one photon\n",
      "E_eV=E/(1.6*10**-19);   #converting J to eV\n",
      "E3=E2+E_eV;\n",
      "E3=math.ceil(E3*100)/100;   #rounding off to 2 decimals\n",
      "\n",
      "#Result\n",
      "print(\"value of E3 in eV is\",E3);\n",
      "\n",
      "#answer given in the book for E3 is wrong"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('value of E3 in eV is', 2.49)\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.4, Page number 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Variable declaration\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "E2=3.2;        #value of higher energy level in eV\n",
      "E1=1.6;        #value of lower energy level in eV\n",
      "\n",
      "#Calculation\n",
      "E=E2-E1;   #energy difference in eV\n",
      "E_J=E*1.6*10**-19;      #converting E from eV to J\n",
      "lamda=(h*c)/E_J;    #wavelength of photon\n",
      "\n",
      "#Result\n",
      "print(\"energy difference in eV\",E);\n",
      "print(\"wavelength of photon in m\",lamda);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('energy difference in eV', 1.6)\n",
        "('wavelength of photon in m', 7.76484375e-07)\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.5, Page number 60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Variable declaration\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "E=1.42*1.6*10**-19;     #band gap of GaAs in J\n",
      "\n",
      "#Calculation\n",
      "lamda=(h*c)/E;   #wavelength of laser\n",
      "\n",
      "#Result\n",
      "print(\"wavelength of laser emitted by GaAs in m\",lamda);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('wavelength of laser emitted by GaAs in m', 8.74911971830986e-07)\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.6, Page number 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T=300;     #temperature in K\n",
      "lamda=500*10**-9;        #wavelength in m\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "k=1.38*10**-23;\n",
      "\n",
      "#Calculation\n",
      "#from maxwell and boltzmann law, relative population is given by\n",
      "#N1/N2=exp(-E1/kT)/exp(-E2/kT)\n",
      "#hence N1/N2=exp(-(E1-E2)/kT)=exp((h*new)/(k*T));\n",
      "#new=c/lambda\n",
      "R=(h*c)/(lamda*k*T);\n",
      "RP=math.exp(R);\n",
      "\n",
      "#Result\n",
      "print(\"relative population between N1 and N2 is\",RP);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('relative population between N1 and N2 is', 5.068255595981255e+41)\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.7, Page number 61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "T=300;   #temperature in K\n",
      "h=6.626*10**-34;\n",
      "c=3*10**8;\n",
      "k=1.38*10**-23;\n",
      "lamda=600*10**-9;    #wavelength in m\n",
      "\n",
      "#Calculation\n",
      "R=(h*c)/(lamda*k*T);\n",
      "Rs=1/(math.exp(R)-1);\n",
      "\n",
      "#Result\n",
      "print(\"the ratio between stimulated emission to spontaneous emission is\",Rs);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('the ratio between stimulated emission to spontaneous emission is', 1.7617782449453023e-35)\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.8, Page number 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "P=5*10**-3;          #output power in W\n",
      "I=10*10**-3;        #current in A\n",
      "V=3*10**3;        #voltage in V\n",
      "\n",
      "#Calculation\n",
      "e=(P*100)/(I*V);\n",
      "e=math.ceil(e*10**6)/10**6;   #rounding off to 6 decimals\n",
      "\n",
      "#Result\n",
      "print(\"efficiency of laser in % is\",e);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('efficiency of laser in % is', 0.016667)\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.9, Page number 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "P=1e-03;    #output power in W\n",
      "d=1e-06;    #diameter in m\n",
      "\n",
      "#Calculation\n",
      "r=d/2;      #radius in m\n",
      "I=P/(math.pi*r**2);    #intensity\n",
      "I=I/10**9;\n",
      "I=math.ceil(I*10**4)/10**4;   #rounding off to 4 decimals\n",
      "\n",
      "#Result\n",
      "print(\"intensity of laser in W/m^2 is\",I,\"*10**9\");"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('intensity of laser in W/m^2 is', 1.2733, '*10**9')\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.10, Page number 62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "lamda=632.8*10**-9;   #wavelength in m\n",
      "D=5;      #distance in m\n",
      "d=1*10**-3;      #diameter in m\n",
      "\n",
      "#Calculation\n",
      "deltatheta=lamda/d;   #angular speed\n",
      "delta_theta=deltatheta*10**4;\n",
      "r=D*deltatheta;\n",
      "r1=r*10**3;       #converting r from m to mm\n",
      "A=math.pi*r**2;   #area of the spread\n",
      "\n",
      "#Result \n",
      "print(\"angular speed in radian is\",delta_theta,\"*10**-4\");\n",
      "print(\"radius of the spread in mm is\",r1);\n",
      "print(\"area of the spread in m^2 is\",A);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "('angular speed in radian is', 6.328, '*10**-4')\n",
        "('radius of the spread in mm is', 3.164)\n",
        "('area of the spread in m^2 is', 3.1450157329451454e-05)\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}