{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter9 - Optoelectronics modulators"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.1 : Page 227"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The thickness of the a quarter wave plate,x = 0.0164 mm\n"
     ]
    }
   ],
   "source": [
    "#The thickness\n",
    "#given data :\n",
    "lamda=589.3*10**-9## in m\n",
    "ne=1.553#J\n",
    "no=1.544#\n",
    "x=(lamda/(4*(ne-no)))*10**3#\n",
    "print \"The thickness of the a quarter wave plate,x = %0.4f mm\"%x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.2 : Page 228"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The thickness of the a quarter wave plate,x = 0.0017 mm\n"
     ]
    }
   ],
   "source": [
    "#The thickness\n",
    "#given data :\n",
    "lamda=589.3*10**-9## in m\n",
    "ne=1.486#\n",
    "no=1.658#\n",
    "x=(lamda/(2*(no-ne)))*10**3#\n",
    "print \"The thickness of the a quarter wave plate,x = %0.4f mm\"%x"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.3: Page 234"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "change in refrative index = 1.032\n",
      "net phase shift = 2.065 \n",
      "Vpi = 7.61 kV\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi\n",
    "#change in refractive index ,net phase shiftand Vpi\n",
    "v=5##kV\n",
    "l=1##cm\n",
    "ez=(v*10**3)/(l*10**-2)##in V/m\n",
    "no=1.51##\n",
    "r63=10.5*10**-12##m/V\n",
    "dn=((1/2)*no**3*r63*ez)##\n",
    "h=550##nm\n",
    "dfi=((2*pi*dn*l*10**-2)/(h*10**-9))##\n",
    "fi=2*dfi##\n",
    "vpi=((h*10**-9)/(2*no**3*r63))*10**-3##kV\n",
    "print \"change in refrative index = %0.3f\"%dfi\n",
    "print \"net phase shift = %0.3f \"%fi\n",
    "print \"Vpi = %0.2f kV\"%vpi\n",
    "#refractive index and phase shift is in the form of pi in the textbook"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.4: Page 237"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "phase differnce = 1.371e+04\n",
      "part (b)\n",
      "additional phase differnce = 1.246\n",
      "part (c)\n",
      "Vpi = 504.25 V\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "#phase difference,additional phase difference and Vpi\n",
    "print \"part (a)\"\n",
    "h=550##nm\n",
    "l=3##cm\n",
    "no=1.51##\n",
    "ne=1.47##\n",
    "dfi=((2*pi*l*10**-2*(no-ne))/(h*10**-9))##\n",
    "print \"phase differnce = %0.3e\"%dfi\n",
    "#phase difference is in the form of pi in the textbook\n",
    "print \"part (b)\"\n",
    "no=1.51##\n",
    "r63=26.4*10**-12##m/V\n",
    "V=200##\n",
    "d=0.25##cm\n",
    "dfi=((pi*r63*no**3*(V)*(l*10**-2))/(h*10**-9*d*10**-2))##\n",
    "print \"additional phase differnce = %0.3f\"%dfi\n",
    "#additional phase difference is in the form of pi in the textbook\n",
    "print \"part (c)\"\n",
    "r63=26.4*10**-12##m/V\n",
    "V=200##\n",
    "d=0.25##cm\n",
    "dfi=((pi*r63*no**3*(V)*(l*10**-2))/(h*10**-9*d*10**-2))##\n",
    "vpi=((h*10**-9)/(no**3*r63))*(d/l)##V\n",
    "print \"Vpi = %0.2f V\"%vpi"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 9.5 : Page 239"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "angle = 0.09 degree\n",
      "part (b)\n",
      "The relative intensity = 0.246\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import asin,degrees\n",
    "#angle and relative intensity\n",
    "#given data :\n",
    "print \"part (a)\"\n",
    "m=1#\n",
    "l=633*10**-9## in m\n",
    "f=5*10**6## in Hz\n",
    "v=1500##in m/s\n",
    "n=1.33## for water\n",
    "A=v/f#\n",
    "theta=asin((l/(n*A)))#\n",
    "print \"angle = %0.2f degree\"%degrees(theta)\n",
    "print \"part (b)\"\n",
    "del_n=10**-5#\n",
    "L=1*10**-2## in m\n",
    "lamda=633*10**-9## in m\n",
    "eta=(pi**2*del_n**2*L**2)/lamda**2#\n",
    "print \"The relative intensity = %0.3f\"%eta"
   ]
  }
 ],
 "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
}