{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 1: Light"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1.1, Page Number 10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Brewsters Angle of the Material is 56.31 Degrees\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "n2=1.5 #Given Refractive Index of Glass in Air\n",
    "n1=1   #Given Refractive Index of Air\n",
    "\n",
    "theta=0 #Brewster's Angle\n",
    "#From Equation 1.13 (Brewsters angle= Tan Inverse (n2/n1))\n",
    "theta=math.degrees(math.atan(1.5))\n",
    "print \"The Brewsters Angle of the Material is \"+str(round(theta,2))+\" Degrees\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1.2, Page Number 13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "In Coherant Sources The Maximum Irradiance is 16I\n",
      "In Incoherant Sources The Maximum Irradiance is 4I\n"
     ]
    }
   ],
   "source": [
    "n=4 #Total Number of Sources\n",
    "\n",
    "#For Coherant Sources\n",
    "print \"In Coherant Sources The Maximum Irradiance is \"+str(n*n)+\"I\"  #Where I is the Irradiance at any point\n",
    "#For Incoherant Sources\n",
    "print \"In Incoherant Sources The Maximum Irradiance is \"+str(n)+\"I\"   "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 1.3, Page Number 23"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(A)The Minimum Seperation Between the Sources is 0.0025 m\n",
      "(B)The Minimum Wavelength Difference which may be resolved is 2.08333333333e-11 m\n"
     ]
    }
   ],
   "source": [
    "D=0.1 #Diameter of the Objective Lens\n",
    "d1=500 #Distance from the source\n",
    "l =0.000000500 #Wavelength Provided\n",
    "p=1 #First Order\n",
    "N=40*600 #The diffraction grating is 40 mm wide and has 600 lines/mm\n",
    "\n",
    "#From Equation 1.29 we Have\n",
    "Smin=(d1*l)/D  #Where Smin is the minimum Seperation of the Sources\n",
    "print \"(A)The Minimum Seperation Between the Sources is \"+str(Smin)+\" m\"\n",
    "\n",
    "#We know that Chromatic resolving power is given by l/dl where dl is the Minimum Wavelength Difference\n",
    "#From Equation l/dl=p*N\n",
    "dl=l/(N*p)\n",
    "\n",
    "print \"(B)The Minimum Wavelength Difference which may be resolved is \"+str(dl)+\" m\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 1.4, Page Number 29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Total Power Radiated from the Source is 6.3504 W\n"
     ]
    }
   ],
   "source": [
    "em=0.7 #Emissivity Of the Surface\n",
    "T=2000 #Temperature in Kelvin\n",
    "A=0.00001 #Area in Meter Square\n",
    "S=5.67*(10**-8) #Stefan-Boltzmann Constant\n",
    "\n",
    "W=S*A*em*(T**4) #Where W is the total power radiated\n",
    "\n",
    "print \"The Total Power Radiated from the Source is \"+str(W)+\" W\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 1.5, Page Number 31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Ionization Energy required to excite the electron from ground to Infinity 13.66 eV\n"
     ]
    }
   ],
   "source": [
    "Z=1 #Atomic Number of Hydrogen\n",
    "m=9.1*(10**-31) #Mass of a Electron\n",
    "e=1.6*(10**-19) #Charge Of a Electron\n",
    "p=6.6*(10**-34) #Plancks Constant\n",
    "e1=8.85*(10**-12)#Permittivity of Free Space\n",
    "#From Equation 1.43\n",
    "E=(m*(Z**2)*(e**4))/(8*(p**2)*(e1**2)) #Where E is the Ionization Energy\n",
    "E2=E/e #Converting in Electron Volts\n",
    "E2=round(E2,2)\n",
    "\n",
    "print \"The Ionization Energy required to excite the electron from ground to Infinity \"+str(E2)+\" eV\"\n",
    "       "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##Example 1.6, Page Number 32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The Required Work function is 4.5375 eV\n"
     ]
    }
   ],
   "source": [
    "e=1.6*(10**-19) #Charge Of a Electron\n",
    "h=6.6*(10**-34) #Plancks Constant\n",
    "vo=1.1*(10**15) #Threshold Frequency in Hertz\n",
    "\n",
    "# We Know h*vo=phi*e where phi is the required Work Function\n",
    "# We assume that the ejected electron has zero kinetic energy\n",
    "\n",
    "phi=h*vo/e\n",
    "print \"The Required Work function is \"+str(phi)+\" eV\""
   ]
  }
 ],
 "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.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}