{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 - Interference"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3 - pg 49"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cycles : 979.0 , Wavelength 5890.0 A\n",
      "Cycles : 978.0 , Wavelength 5896.0 A\n"
     ]
    }
   ],
   "source": [
    "#calculate the cycles and wavelength\n",
    "#Given :\n",
    "lambda1 = 5890. ; # Wavelength in angstroms\n",
    "lambda2 = 5896. ; # Wavelength in angstroms\n",
    "#For sodium doublet\n",
    "nu1 = 5.0934*10**14; #Frequency in Hz\n",
    "nu2 = 5.0882*10**14; #Frequency in Hz\n",
    "#calculations\n",
    "deltanu = nu1-nu2; # Differnece in Frequencies in Hz \n",
    "Tc = 1/deltanu ; # Coherence time in s\n",
    "\n",
    "n1 = Tc*nu1; # Number of Cycles of wavelength 5890 angstroms\n",
    "n2 = Tc*nu2;# Number of cycles of wavelegth 5896 angstrom\n",
    "#in this coherence time , we have:\n",
    "#results\n",
    "print\"Cycles :\",round(n1),\", Wavelength\",lambda1,\"A\"\n",
    "print\"Cycles :\",round(n2),\", Wavelength\",lambda2,\"A\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 4 - pg 50"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For Orange line of Krypton : Coherence Length : \t36.7  cm \n",
      " Bandwidth : \t\t8.17  x 10**8 Hz \n",
      " Coherence : \t\t0.12 x 10**-8 s \n",
      " Degree of Monochromaticity :  1.65 x 10**-6 \n",
      "For Laser Source : Coherence Length : \t2446.62  cm \n",
      " Bandwidth : \t\t0.12  x 10**8 Hz \n",
      " Coherence : \t\t8.16 x 10**-8 s \n",
      " Degree of Monochromaticity :  2.48 x 10**-8 \n"
     ]
    }
   ],
   "source": [
    "#calculate the coherence length, bandwidth and degree of monochromaticity\n",
    "#Given:\n",
    "deltalambd1 = 0.01; # The line width of the orange line of krypton,Kr**86  in A\n",
    "lambd = 6058; # Wavelength in angstroms = 6058*10**-10 m\n",
    "deltalambd2 = 0.00015; # The line width of a laser source in A\n",
    "c = 3*10**8 ;# Velocity of light  in vacuum in m/s \n",
    "#calculations\n",
    "nu0 = c/(lambd*10**-10);\n",
    "\n",
    "#For orange line of Krypton\n",
    "Lc1= (lambd**2/deltalambd1)*10**-10; # coherence length in m \n",
    "deltanu1 = c/Lc1 ;#  bandwidth in Hz\n",
    "Tc1 = (Lc1/c);# Coherence time in s \n",
    "#Xi = deltanu/nu0 , where nu0 = c/lambd which equals to (deltanu*lambd)/c, lambd in A\n",
    "Xi1 = deltanu1/nu0 ; #degree of monochromaticity \n",
    "#For Laser Source\n",
    "Lc2= (lambd**2/deltalambd2)*10**-10;# coherence length in m\n",
    "deltanu2 = c/Lc2 ;#  in Hz\n",
    "Tc2 = (Lc2/c);#Calculating Coherence time in s\n",
    "#Xi = deltanu/nu0 , where nu0 = c/lambd which equals to (deltanu*lambd)/c, lambd in A\n",
    "Xi2 = deltanu2/nu0 ;# degree of monochromaticity\n",
    "#results\n",
    "print\"For Orange line of Krypton : Coherence Length : \\t\",round(Lc1*100,2),\" cm \\n Bandwidth : \\t\\t\",round(deltanu1*10**-8,2),\" x 10**8 Hz \\n Coherence : \\t\\t\",round(Tc1*10**8,2),\"x 10**-8 s \\n Degree of Monochromaticity : \",round(Xi1*10**6,2),\"x 10**-6 \"\n",
    "print\"For Laser Source : Coherence Length : \\t\",round(Lc2*100,2),\" cm \\n Bandwidth : \\t\\t\",round(deltanu2*10**-8,2),\" x 10**8 Hz \\n Coherence : \\t\\t\",round(Tc2*10**8,2),\"x 10**-8 s \\n Degree of Monochromaticity : \",round(Xi2*10**8,2),\"x 10**-8 \",\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5 - pg 54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Optical path (mu m) =  7.9515\n",
      "Number of waves :  13.5\n",
      "The distance in vaccum for those waves is (mu m) =  7.9515\n",
      "Phase difference =  85.0\n"
     ]
    }
   ],
   "source": [
    "#### calculate the optical path, no of waves and Phase difference\n",
    "#(a) \n",
    "#Given:\n",
    "import math\n",
    "lambd = 5890.;# Wavelength in A\n",
    "l = 5.89; #thickness of the film in mu m\n",
    "mu = 1.35; #refractive index\n",
    "delta = mu*l;# optical path in the medium  in m\n",
    "#calculations\n",
    "#(b) (i)Number of waves in the medium\n",
    "#1 angstrom = 1.0*10**-10 m and 1 mu m = 1*10**-6 m\n",
    "N= (l*10**-6)/(lambd*10**-10/mu); \n",
    "#the distance in vaccum for those waves :\n",
    "delta1 =N*lambd*10**-10; # optical path in m\n",
    "#(b) (ii)Phase difference in the medium \n",
    "#1 angstrom = 1.0*10**-10 m and 1 mu m = 1*10**-6 m\n",
    "phi = ((2*math.pi)/(lambd*10**-10/mu))*(l*10**-6) ;\n",
    "#results\n",
    "print\"Optical path (mu m) = \",delta\n",
    "print\"Number of waves : \",N\n",
    "print\"The distance in vaccum for those waves is (mu m) = \",delta1*10**6\n",
    "print\"Phase difference = \",round(phi,0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 6 - pg 55"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Parameters \t\t\t Air \t\t\t Water \t\t\t Oil \t\t\tGlass \n",
      "Wavelength : \t\t5890.0 A \t\t4428.57142857  A \t\t4237.41007194  A \t\t3591.46341463 A \n",
      "Velocity : \t\t3.0  x 10**8 m/s \t\t2.26 x 10**8m/s \t2.16 x 10**8 m/s \t182926829.27 x 10**8 m/s \n",
      "Time of travel : \t  33.33 ,x 10**-10 s\t44.33 x 10**-10 s\t46.33 x 10**-10 s\t54.67 x 10**-10 s \n",
      "Number of waves: \t  1.7 x 10**6 \t\t2.26 x 10**6 \t\t1.0  x 10**6 \t\t2.78 x10**6 \n",
      "Optical path : \t\t  100.0 cm \t\t133.0 cm \t\t139.0  cm \t\t164.0 cm \n",
      " The total optical path (cm) =  536.0\n"
     ]
    }
   ],
   "source": [
    "#pg 55\n",
    "#calculate the Parameters required\n",
    "#Given:\n",
    "lambd = 5890.; # Wavelength of a beam of sodium light in A\n",
    "l = 100.; # thickness  in cm\n",
    "mu1 = 1.00;#refractive index of air\n",
    "mu2 = 1.33;# refractive index of water\n",
    "mu3 = 1.39; # refractive index of  oil\n",
    "mu4 = 1.64; # refractive index of glass\n",
    "c = 3.*10**8 ;# Velocity of light in vacuum in m/s\n",
    "#calculations\n",
    "#For Air :\n",
    "lambd1 = lambd/mu1; # wavelength of light in A\n",
    "v1 = c/mu1;# Velocity of light in air in m/s\n",
    "# 1cm = 1*10**-2 m\n",
    "t1 = (l*10**-2/v1); #time of travel in s\n",
    "# 1 A = 1*10**-10 m\n",
    "N1 = (l*10**-2)/(lambd1*10**-10);# Number of waves \n",
    "delta1 = mu1*l; #Optical path in cm\n",
    "#For Water :\n",
    "lambd2 = lambd/mu2; # wavelength of light in A\n",
    "v2 = c/mu2;# Velocity of light in water in m/s\n",
    "#1cm = 1*10**-2 m\n",
    "t2 = (l*10**-2/v2); #time of travel in s \n",
    "#1 A = 1*10**-10 m\n",
    "N2 = (l*10**-2)/(lambd2*10**-10);# Number of waves \n",
    "delta2 = mu2*l; #Optical path in cm\n",
    "#For Oil :\n",
    "lambd3 = lambd/mu3; # wavelength of light in A\n",
    "v3 = c/mu3;# Velocity of light in Oil in m/s\n",
    "#1cm = 1*10**-2 m\n",
    "t3 = (l*10**-2/v3); #time of travel in s\n",
    "#1 A = 1*10**-10 m\n",
    "N3 = (l*10**-2)/(lambd3*10**-10);# Number of waves \n",
    "delta3 = mu3*l; #Optical path in cm\n",
    "#For Glass: \n",
    "lambd4 = lambd/mu4; # wavelength of light in A\n",
    "v4 = c/mu4;# Velocity of light in Glass in m/s\n",
    "# 1cm = 1*10**-2 m\n",
    "t4 = (l*10**-2/v4); #time of travel in s\n",
    "#1 A = 1*10**-10 m\n",
    "N4 = (l*10**-2)/(lambd4*10**-10);# Number of waves \n",
    "delta4 = mu4*l; #Optical path in cm\n",
    "delta = delta1+delta2+delta3+delta4; # total optical path in cm\n",
    "#results\n",
    "print\"Parameters \\t\\t\\t Air \\t\\t\\t Water \\t\\t\\t Oil \\t\\t\\tGlass \"\n",
    "print\"Wavelength : \\t\\t\",lambd1,\"A \\t\\t\",lambd2,\" A \\t\\t\",lambd3,\" A \\t\\t\",lambd4,\"A \"\n",
    "print\"Velocity : \\t\\t\",v1*10**-8,\" x 10**8 m/s \\t\\t\",round(v2*10**-8,2),\"x 10**8m/s \\t\",round(v3*10**-8,2),\"x 10**8 m/s \\t\",round(v4,2),\"x 10**8 m/s \"\n",
    "print\"Time of travel : \\t \",round(t1*10**10,2),\",x 10**-10 s\\t\",round(t2*10**10,2),\"x 10**-10 s\\t\",round(t3*10**10,2),\"x 10**-10 s\\t\",round(t4*10**10,2),\"x 10**-10 s \"\n",
    "print\"Number of waves: \\t \",round(N1*10**-6,2),\"x 10**6 \\t\\t\",round(N2*10**-6,2),\"x 10**6 \\t\\t\",round(N3**10**-6,2),\" x 10**6 \\t\\t\",round(N4*10**-6,2),\"x10**6 \"\n",
    "print\"Optical path : \\t\\t \",delta1,\"cm \\t\\t\",delta2,\"cm \\t\\t\",delta3,\" cm \\t\\t\",delta4,\"cm \"\n",
    "print\" The total optical path (cm) = \",delta"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 8 - pg 60"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The maximum number of fringes observable are :\n",
      "(a) For a krypton source :  605800.0\n",
      "(b) For a laser source :  40386667.0\n"
     ]
    }
   ],
   "source": [
    "#calculate the maximum no. of fringes observable\n",
    "#Given :\n",
    "lambd = 6058;# Wavelength of light in A\n",
    "deltalambd1 = 0.01; # line width for a krypton source in A\n",
    "deltalambd2 = 0.00015; # line width for a laser source in A\n",
    "#calculations\n",
    "# The maximum number of fringes is given by n_max = lambd/deltalambd\n",
    "# (a) For a krypton source :\n",
    "n_max1 = lambd/deltalambd1 ;\n",
    "# (b) For a laser source :\n",
    "n_max2 = lambd/deltalambd2;\n",
    "#results\n",
    "print\"The maximum number of fringes observable are :\"\n",
    "print\"(a) For a krypton source : \",n_max1\n",
    "print\"(b) For a laser source : \",round(n_max2,0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9 - pg 61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " t_max : 6.195 x 10^5 A\n"
     ]
    }
   ],
   "source": [
    "#calculate the max thickness\n",
    "#Given :\n",
    "mu = 1.4;# refractive index of a thin film\n",
    "lambd = 5890; # Wavelength of sodium light in A\n",
    "deltalambd = 20; #line width in A\n",
    "#calculations\n",
    "# For observing interference pattern, t < lambd**2/(2*mu*deltalambd)\n",
    "t_max = lambd**2/(2*mu*deltalambd); #thickness of the film in A\n",
    "#results\n",
    "print \" t_max :\",round(t_max*10**-5,3),\"x 10^5 A\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10 - pg 61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wedge angle (rad) =  0.003\n"
     ]
    }
   ],
   "source": [
    "#calculate the wedge angle\n",
    "#Given:\n",
    "lambd = 6000.; # wavelength in A\n",
    "mu = 1; #refractive index for air\n",
    "# Fringe pattern having 100 fringes per cm\n",
    "betaa = 0.01; # fringe width in cm\n",
    "#calculations\n",
    "# And,We know betaa = lambd/(2*mu*alpha) , so\n",
    "# 1 A = 1.0*10**-8 cm\n",
    "alpha = lambd*10**-8/(2*mu*betaa); # wedge angle in rad\n",
    "#results\n",
    "print\"Wedge angle (rad) = \",alpha"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 13 - pg 78"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " (a)For Sound waves : (m) =  18.76\n",
      " (b)For Ultrasonic waves : (m) =   2.5\n",
      " (c)For Microwaves  : (m) =   0.73\n",
      " (d)For IR waves : (mu m) =  250.1\n",
      " (e)For Light waves : (mu m) =   14.73\n"
     ]
    }
   ],
   "source": [
    "#calculate the distance required\n",
    "#Given :\n",
    "import math\n",
    "from math import sin\n",
    "angle = 4*10**-2 ; # angle in rad\n",
    "#calculations\n",
    "#1 radian = 57.2957795 degrees\n",
    "theta = angle ;# in degrees \n",
    "#  d*sin(theta) = lambd , so  d = lambd/(sin(theta)) :\n",
    "#(a)For Sound waves \n",
    "lambd1 = 0.75; # Wavelength in m\n",
    "d1 = lambd1/sin(theta); # distance in m \n",
    "#(b)For Ultrasonic waves\n",
    "lambd2 = 0.1; # Wwavelength in m\n",
    "d2 =  lambd2/sin(theta); # distance in m\n",
    "#(c)For microwaves \n",
    "lambd3 = 2.9 ; # Wavelength in cm\n",
    "#1cm = 1.0*10**-2 m\n",
    "d3 = lambd3*10**-2/sin(theta); # distance in m\n",
    "#(d)For IR waves\n",
    "lambd4 = 10; # Wavelength in mu_m\n",
    "# 1 mu_m = 1.0*10**-6 m\n",
    "d4 = lambd4*10**-6/sin(theta);# distance in m\n",
    "#(e)For light waves \n",
    "lambd5 = 5890;# in angstroms\n",
    "#1 A = 1.0*10**-10 m\n",
    "d5 = lambd5*10**-10/sin(theta); # distance in m\n",
    "#results\n",
    "print\" (a)For Sound waves : (m) = \",round(d1,2)\n",
    "print\" (b)For Ultrasonic waves : (m) =  \",round(d2,2)\n",
    "print\" (c)For Microwaves  : (m) =  \",round(d3,2)\n",
    "print\" (d)For IR waves : (mu m) = \",round(d4*10**6,1)\n",
    "print\" (e)For Light waves : (mu m) =  \",round(d5*10**6,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 14 - pg 79"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum Intensity \n",
      "---> theta = 0.0 degrees\n",
      "---> theta = 30.0 degrees\n",
      "---> theta = 90.0 degrees\n",
      "Minimum Intensity\n",
      "--> theta (degrees) =  14.5\n"
     ]
    }
   ],
   "source": [
    "#calculate the maximum and minimum intensity\n",
    "#Given :\n",
    "# Now, the intensity  distribution  is given by :\n",
    "# I = I_1 + I_2 + 2*(I_1*I_2)**0.5 *cos(alpha1- alpha2) , Using alpha = alpha1 - alpha2  and I_1 = I_2 = I_0 \n",
    "# I = 2*I_0*(1+ cos(alpha)) \n",
    "import math\n",
    "nu = 1.2 * 10**6 ; # frequency in Hz\n",
    "c = 3*10**8 ; # velocity of light in m/s\n",
    "#calculations\n",
    "lambd = c/nu ; # wavelength in m\n",
    "d = 500; # two identical vertical dipole antenna spaced 500 m apart\n",
    "# Directions along which  the intensity is maximum :\n",
    "print \"Maximum Intensity \"\n",
    "for n in range(0,3):\n",
    "\ttheta = math.asin((n*lambd)/d) *57.3;# in degrees\n",
    "\tprint \"---> theta =\",round(theta,0),\"degrees\"\n",
    "\n",
    "# Directions for which intensity is minimum :\n",
    "n1 =0;\n",
    "theta1 = math.asin(((n1 + (1./2.))*lambd)/d) *57.3;#in degrees\n",
    "#results\n",
    "print\"Minimum Intensity\"\n",
    "print\"--> theta (degrees) = \",round(theta1,1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 15 - pg 81"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The linear expansivity of the metal of the cylinder using Newtons rings apparatus is : 7.9 x 10^-6/K \n"
     ]
    }
   ],
   "source": [
    "#calculate the linear expansivity of the metal\n",
    "#Given :\n",
    "lambd = 5900. ; #Wavelength in A\n",
    "delta_T = 150.; # Temperature of the metal cylinder is now raised by 150 K\n",
    "p = 20. ; # p is the number of rings shifted due to increase in t_n (t_n  is the thickness of the air film)\n",
    "l = 5. ; # length of the metal cyclinder in  mm\n",
    "mu = 1.; #refractive index for air\n",
    "#Increase in length  = (p*lambd)/2*mu\n",
    "# 1 A = 1.0*10**-7 mm\n",
    "#calculations\n",
    "delta_l = (p*lambd*10**-7)/2*mu; # increase in length in mm\n",
    "#Linear expansivity of the metal of the cyclinder \n",
    "alpha = (delta_l)/(l*delta_T); # in 1/K\n",
    "#results\n",
    "print\"The linear expansivity of the metal of the cylinder using Newtons rings apparatus is :\",round(alpha*10**6,1),\"x 10^-6/K \"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 16 - pg 83"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Wavelength : 6.5 x 10^-4 mm \n"
     ]
    }
   ],
   "source": [
    "#calculate the wavelength\n",
    "#Given :\n",
    "d = 0.065; #distance in mm\n",
    "p = 200 ;# 200 fringes cross the field of view\n",
    "#Michelson's interferometer arrangement : 2*d = p*lambd\n",
    "#calculations\n",
    "lambd = 2*d/p;# wavelength in mm\n",
    "#results\n",
    "print\" Wavelength :\",lambd*10**4,\"x 10^-4 mm \"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 17 - pg 84"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The refractive index of the liquid is  1.211\n"
     ]
    }
   ],
   "source": [
    "#calculate the refractive index\n",
    "#Given :\n",
    "D10_air = 1.75 ;#diameter of the 10th bright ring in Newton's ring apparatus in cm\n",
    "D10_liquid = 1.59 ; # diameter of the 10th bright ring in Newton's ring apparatus in cm\n",
    "# The diameter of the nth bright ring in Newton's ring apparatus :  D_n = 2*(R*(n + 1/2)*(lambd/mu))^0.5\n",
    "#calculations\n",
    "mu = (D10_air/D10_liquid)**2;\n",
    "#results\n",
    "print\"The refractive index of the liquid is \",round(mu,3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 18 - pg 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The minimum thickness (A) =  996.4\n",
      " alpha = 3.14 for MgF2 and 3.37 for lucite\n",
      " For MgF2 : I = ( 0.0 )*I_0\n",
      " For lucite : I = ( 0.052 )*I_0\n",
      "For Lucite : ( 0.052 )*I_0 , indicates 5.16  percentage  of the incident light is reflected ,so it is less suitable for coating.\n"
     ]
    }
   ],
   "source": [
    "#calculate the minimum thickness and alpha values\n",
    "#Given :\n",
    "import math\n",
    "from math import cos\n",
    "lambd = 5500; # Wavelength in A\n",
    "mu_f = 1.38; # refractive index for MgF2\n",
    "mu_f1 = 1.48; # refractive index for lucite\n",
    "#The minimum thickness \n",
    "#calculations\n",
    "t = lambd/(4*mu_f) ; # thickness in A\n",
    "print\"The minimum thickness (A) = \",round(t,1)\n",
    "# Resultant reflected intensity = I = 2*I_0*(1 + cos(alpha)) \n",
    "# alpha = (2*pi/lambd)*(path difference) \n",
    "alpha1 = (2*math.pi/lambd)*(2*mu_f*t); # angle in radians\n",
    "alpha2 = (2*math.pi/lambd)*(2*mu_f1*t); # angle in radians\n",
    "#results\n",
    "print\" alpha =\",round(alpha1,2),\"for MgF2 and\",round(alpha2,2),\"for lucite\"\n",
    "print\" For MgF2 : I = (\",2*(1+cos(alpha1)),\")*I_0\"\n",
    "print\" For lucite : I = (\",round(2*(1+cos(alpha2)),3),\")*I_0\"\n",
    "print\"For Lucite : (\",round(2*(1+cos(alpha2)),3),\")*I_0 , indicates\",round(100*2*(1+cos(alpha2)),2),\" percentage  of the incident light is reflected ,so it is less suitable for coating.\""
   ]
  }
 ],
 "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
}
