{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 24:Interference and Diffraction"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex24.1:pg-1130"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The angle at which the reinforcement line occurs is theta2= 44.0  degrees\n"
     ]
    }
   ],
   "source": [
    "  #Example 24_1\n",
    "import math \n",
    "  \n",
    "  #To find the angle at which the reinforcement line occurs\n",
    "n=2      #units in constant\n",
    "lamda=0.7         #units in cm\n",
    "d=2          #units in cm\n",
    "theta2=math.asin((n*lamda)/d)*180/math.pi       #Units in degrees\n",
    "print \"The angle at which the reinforcement line occurs is theta2=\",round(theta2),\" degrees\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex24.2:pg-1131"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The thickness of air gap increases by= 294.0  nm\n"
     ]
    }
   ],
   "source": [
    "  #Example 24_2\n",
    " \n",
    "  \n",
    "  #To find by how much does thickness of air gap increases\n",
    "lamda=589           #units in nm\n",
    "gap=round(lamda/2)          #units in nm\n",
    "print \"The thickness of air gap increases by=\",round(gap),\" nm\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex24.3:pg-1132"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The thickness that should be coated for minimum reflection is L= 99.6  nm\n"
     ]
    }
   ],
   "source": [
    "  #Example 24_3\n",
    " \n",
    "  \n",
    "  #To find the thickness that should be coated for minimum reflection\n",
    "lamda=550         #units in nm\n",
    "n=1.38            #units in constant\n",
    "L=(lamda/2)/(2*n)         #units in nm\n",
    "print \"The thickness that should be coated for minimum reflection is L=\",round(L,1),\" nm\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex24.4:pg-1133"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For the first order theta1= 32.0  degrees\n",
      "For the second order theta2= 53.0  degrees\n",
      "\n",
      " As it is impossible for the sine of angle that is= 1.18  radians to be greater that unity this second order and higher order images doesnot exist\n"
     ]
    }
   ],
   "source": [
    "  #Example 24_4\n",
    "\n",
    "import math \n",
    "  \n",
    "#To find out the angle at which the line appears\n",
    "line=5.89*10**-7          #Units in meters\n",
    "noline=1/10.0**6         #units in Lines per meter\n",
    "theta1=math.sin(line/noline)*180/math.pi      #units in degrees\n",
    "#For second order\n",
    "theta2=math.sin(2*line/noline)*180/math.pi      #units in degrees\n",
    "print \"For the first order theta1=\",round(theta1),\" degrees\\nFor the second order theta2=\",round(theta2),\" degrees\"\n",
    "sinevalue=2*line/noline        #units in radians\n",
    "print \"\\n As it is impossible for the sine of angle that is=\",round(sinevalue,2),\" radians to be greater that unity this second order and higher order images doesnot exist\"\n"
   ]
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}