{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  Chapter 3 : Polarization"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 1 , Page number 65"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Percentage of light that passes through=  25.0 %\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "theta=math.radians(60)                #angle in radians\n",
    "\n",
    "#Calculations\n",
    "Intensityred=100-(1-math.cos(theta)**2)*100\n",
    "\n",
    "#Result\n",
    "print\"Percentage of light that passes through= \",Intensityred,\"%\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 2 , Page number 66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Ratio of the two intensities Ie:Io = 3:1\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=6000              #wavlenght in Armstrong\n",
    "\n",
    "#Calculations\n",
    "Ie=3/4\n",
    "Io=1/4\n",
    "Ratio=Ie/Io\n",
    "\n",
    "#Result\n",
    "print\"Ratio of the two intensities Ie:Io = 3:1\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 3 , Page number 67"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angle of polarization= 57.171 degrees\n",
      "Angle between reflected and refracted ray= 90 degrees\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "myu=1.55                #refractive index of glass\n",
    "\n",
    "#Calculations\n",
    "theta_p=math.degrees(math.atan(myu))\n",
    "theta_r=math.degrees(math.asin(math.sin(math.radians(theta_p))/1.55))\n",
    "Total=theta_p+theta_r\n",
    "\n",
    "#Result\n",
    "print\"Angle of polarization= %2.3f degrees\" %theta_p\n",
    "print\"Angle between reflected and refracted ray= %i degrees\" %Total"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 4 , Page number 67"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thickness of a quarterwave plate= 1.67*10**-5 m\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=6000*10**-8       #wavelength\n",
    "no=1.544                #refractive index of O-ray\n",
    "ne=1.553                #refractive index of E-ray\n",
    "\n",
    "#Calculations\n",
    "t=lamda/(4*(ne-no))/10**-3\n",
    "\n",
    "#Result\n",
    "print\"thickness of a quarterwave plate= %1.2f*10**-5 m\" %t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 5 , Page number 67"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thickness of a quarterwave plate= 0.001\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=6000*10**-8       #wavelength\n",
    "no=1.54                #refractive index of O-ray\n",
    "ne=1.55                #refractive index of E-ray\n",
    "\n",
    "#Calculations\n",
    "t=lamda/(6*(ne-no))\n",
    "\n",
    "#Result\n",
    "print\"thickness of a quarterwave plate= %1.3f\" %t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 6 , Page number 68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "thickness of a quarterwave plate= 0.003 cm\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "lamda=6000*10**-8       #wavelength\n",
    "no=1.54                 #refractive index of O-ray\n",
    "ne=1.55                 #refractive index of E-ray\n",
    "\n",
    "#Calculations\n",
    "t=lamda/(2*(ne-no))\n",
    "\n",
    "#Result\n",
    "print\"thickness of a quarterwave plate= %1.3f cm\" %t"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example number 7 , Page number 68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The solution is of 10%\n"
     ]
    }
   ],
   "source": [
    "#importing module\n",
    "import math\n",
    "from __future__ import division\n",
    "\n",
    "#Variable declaration\n",
    "l=2                    #length of the tube\n",
    "s=60                   #specific rotation\n",
    "theta=12               #angle of rotation of plane vibration\n",
    "\n",
    "#Calculations\n",
    "C=theta/(l*s)*100\n",
    "\n",
    "#Result\n",
    "print\"The solution is of %i%%\" %C"
   ]
  }
 ],
 "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.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
