{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 14 - Lasers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2 - pg 493"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ratio = 1.7 x 10^-35 \n",
      "T (K) =  34650.0\n",
      "Resuts obtained differ from those in texbook, because approximate value of k*T was considered\n"
     ]
    }
   ],
   "source": [
    "#pg 493\n",
    "#calculate the ratio required and Temperature\n",
    "#Given :\n",
    "import math\n",
    "lambd = 6000.; #wavelength in A\n",
    "k = 8.62*10**-5; # in eV/K\n",
    "T = 300.; # Temperature in K\n",
    "#calculations\n",
    "#Equilibrium ratio = N2/N1 =  exp[-(E2-E1)/k*T]\n",
    "#(a)\n",
    "E2_E1 = 12422./lambd; # energy in eV\n",
    "Ratio = math.exp(-E2_E1/(k*T));\n",
    "#(b)\n",
    "T1 = (E2_E1)/(k*math.log(2)); # Temperature in K\n",
    "#results\n",
    "print \"Ratio =\",round(Ratio*10**35,1),\"x 10^-35 \"\n",
    "print \"T (K) = \",round(T1,0)\n",
    "print 'Resuts obtained differ from those in texbook, because approximate value of k*T was considered'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 - pg 497"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Difference (A) =  0.025\n"
     ]
    }
   ],
   "source": [
    "#pg 497\n",
    "#calculate the difference required\n",
    "#Given :\n",
    "L =8.;# in cm\n",
    "lambd = 5330.; #wavelength in A\n",
    "# lambd = 2*L/n\n",
    "# 1 A = 1.0*10**-8 cm\n",
    "#calculations\n",
    "n= (2*L)/(lambd*10**-8); # allowed modes\n",
    "#adjacent mode \n",
    "n1 = round(n+1);\n",
    "# 1 cm = 1.0*10**8 A\n",
    "lambd1 = ((2*L)/n1)*10**8;# wavelength in A\n",
    "D = lambd-lambd1; # difference in wavelengths in A\n",
    "#results\n",
    "print \"Difference (A) = \",round(D,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 - pg 505"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Laser source = 1.0 x 10^-10\n",
      "Ordinary  source = 1.0 x 10^-7\n",
      "Results obtained differ from those in textbook, beacuse only order of 10 was considered in the result.\n"
     ]
    }
   ],
   "source": [
    "#pg 505\n",
    "#calculate the laser source and Ordinary source\n",
    "import math\n",
    "#Given :\n",
    "tau_c = 10.**-5; # lifetime of lasing energy in s\n",
    "tau_c1 = 10.**-8; # coherence time in s\n",
    "lambd = 5000.; # wavelength in A\n",
    "c = 3.*10**8;# light speed in m/s\n",
    "# Ratio = delta_lambd/lambd   = lambd/(c*tau_c)\n",
    "# 1 A = 1.0*10**-10 m\n",
    "#(a)Laser source\n",
    "#calculations\n",
    "Ratio = (lambd*10**-10)/(c*tau_c);\n",
    "#(b)Ordinary source\n",
    "Ratio1 = (lambd*10**-10)/(c*tau_c1);\n",
    "#results\n",
    "print \"Laser source =\",math.floor(Ratio*10**10),\"x 10^-10\"\n",
    "print \"Ordinary  source =\",math.floor(Ratio1*10**7),\"x 10^-7\"\n",
    "print'Results obtained differ from those in textbook, beacuse only order of 10 was considered in the result.'\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 - pg 506"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Intensity = 4.0 x 10^6 kW/cm^2 \n",
      "Intensity of this laser source is 1.0 x 10^6 times the intensity of Sun radiation\n"
     ]
    }
   ],
   "source": [
    "#pg 506\n",
    "#calculate the intensity required\n",
    "#Given :\n",
    "P = 10.; # Power in W\n",
    "lambd =5000.; # wavelength in A\n",
    "SI = 7*10**3; # Sun's radiation intensity in W/cm^2\n",
    "# 1 A = 1.0*10^-8 cm\n",
    "#calculations\n",
    "I = P/(lambd*10**-8)**2; #Intensity in W/cm^2\n",
    "Ratio = (I)/SI; \n",
    "#results\n",
    "print \"Intensity =\",I*10**-9,\"x 10^6 kW/cm^2 \"\n",
    "print \"Intensity of this laser source is\",round(Ratio*10**-6,0),\"x 10^6 times the intensity of Sun radiation\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7 - pg 512"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Number of Telephone conversations = 3.0 x 10^11\n",
      " Number of Television programmes  = 3.0 x 10^7\n",
      "The answers differ from textbook due to rounding off error\n"
     ]
    }
   ],
   "source": [
    "#pg 512\n",
    "#calculate the Number of Telephone and Television conversations and programmes\n",
    "#Given :\n",
    "c = 3.*10**8;# light speed in m/s\n",
    "#Visible range = 4000 A - 7000 A\n",
    "lambd1 = 4000.; # wavelength in A\n",
    "lambd2 = 7000.;# wavelength in A\n",
    "#calculations\n",
    "# 1 A = 1.0*10**-10 m\n",
    "nu1 = c/(lambd1*10**-10); # frequency in Hz\n",
    "nu2 = c/(lambd2*10**-10);# frequency in Hz\n",
    "deltanu = nu1-nu2; # in Hz\n",
    "#(a)Telephone conversations\n",
    "f1 = 10**3; # frequency in Hz\n",
    "n1 = deltanu/f1;\n",
    "#(b)Television programmes\n",
    "f2 = 10**7; # frequency in Hz\n",
    "n2 = deltanu/f2;\n",
    "#results\n",
    "print \" Number of Telephone conversations =\",round(n1*10**-11),\"x 10^11\"\n",
    "print \" Number of Television programmes  =\",round(n2*10**-7),\"x 10^7\"\n",
    "print 'The answers differ from textbook due to rounding off error'"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
