{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 10:Optical Properties of Materials"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.1,Page No:10.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wavelength of the photon = 6211 Å\n",
      " The colour of the photon is red\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "E2     = 5.56*10**-19;          # Higher Energy level in J\n",
    "E1     = 2.36*10**-19;          # Lower Energy level in J\n",
    "h      = 6.626*10**-34;         # plancks constant in J.s\n",
    "c      = 3*10**8;               # velocity of light in m\n",
    "\n",
    "# Calculations\n",
    "dE    = E2 - E1;              # Energy difference in J\n",
    "lamda = (h*c)/float(dE);             # wavelength in m\n",
    " \n",
    "\n",
    "# Result\n",
    "\n",
    "print'Wavelength of the photon = %d'%(lamda*10**10),'Å';\n",
    "print' The colour of the photon is red';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.2,Page No:10.25"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Maximum Wavelength for which diamond is opaque is Imax = 2219  Å\n",
      "\n",
      " Note: Imax is wrongly printed as 220 Å in textbook\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "# Variable declaration\n",
    "h   = 6.63*10**-34;         # plancks constant in J.s\n",
    "c   = 3*10**8;              # velocity of light in m\n",
    "E   = 5.6;                  # bandgap in eV\n",
    "e   = 1.6*10**-19;           # charge of electron coulombs\n",
    "\n",
    "# Calculations\n",
    "lamda    = (h*c)/float(E*e)         # wavelength in m\n",
    "\n",
    "#output\n",
    "print'Maximum Wavelength for which diamond is opaque is Imax = %d '%(lamda*10**10),'Å';\n",
    "print'\\n Note: Imax is wrongly printed as 220 Å in textbook';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.3,Page No:10.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Energy of radiation = 2.0719 eV\n",
      "Rate of energy gap varies with addition of GaP is 0.00830 eV/mol %\n",
      "mol percent to be added to get an energy gap of 2.0719 eV is 78.54 mol %\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "h     = 6.63*10**-34;            # plancks constant\n",
    "c     = 3*10**8;                 # velocity of light\n",
    "lamda = 0.6*10**-6;             # wavelength in m\n",
    "e     = 1.6*10**-19;              # charge of electron\n",
    "EGap  = 2.25;                    # energy in eV\n",
    "EGas  = 1.42;                    # energy in eV\n",
    "\n",
    "#Calculations\n",
    "E        = (h*c)/float(lamda*e);            # Energy in eV\n",
    "p_change = (EGap - EGas)/float(100);        #rate of energy gap\n",
    "x        = (E-EGas)/float(p_change);        #mol % of GaP to be added to get an energy gap of E\n",
    "\n",
    "# Result\n",
    "print'Energy of radiation = %3.4f'%E,'eV';\n",
    "print'Rate of energy gap varies with addition of GaP is %3.5f'%p_change,'eV/mol %';\n",
    "print'mol percent to be added to get an energy gap of %3.4f'%E,'eV','is %3.2f'%x,'mol %';\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.4,Page No:10.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Energy of the metastable state E3 = 2.2e-19 J\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "h     = 6.63*10**-34;          #plancks constant in J.s\n",
    "c     = 3*10**8;               # velocity of light in m\n",
    "lamda = 1.1*10**-6;             # wavelength in m\n",
    "e     = 1.6*10**-19;           # charge of electron in coulombs\n",
    "E2    = 0.4*10**-19;           # energy level in joules\n",
    "\n",
    "\n",
    "#Calculations\n",
    "E3  = E2 + ((h*c)/float(lamda));          #energy in J\n",
    "\n",
    "#Result\n",
    "print'Energy of the metastable state E3 = %3.1e'%E3,'J';"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.5,Page No:10.26"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of Optical modes =  15\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "c   = 3*10**8;               # velocity of light in m\n",
    "L   = 1.5;                   #length in m\n",
    "n   = 1.0204;               # refractive index \n",
    "BW  = 1.5*10**9;             # Bandwidth in Hz\n",
    "\n",
    "# Calculations\n",
    "dV  = c/float(2*L*n);             #frequency in Hz\n",
    "N   = BW/float(dV);               # Number of optical nodes\n",
    "\n",
    "# Result\n",
    "print'Number of Optical modes = % d'%N;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.6,Page No:10.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Numerical aperture = 0.248\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "n1  = 1.55;         # refractive index of core\n",
    "n2  = 1.53;         # refractive index of cladding\n",
    "\n",
    "\n",
    "# Calculations\n",
    "NA  = math.sqrt(n1**2 - n2**2);\n",
    "\n",
    "\n",
    "#Result\n",
    "print'Numerical aperture = %3.3f'%NA;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 10.7,Page No:10.31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For angles above 48.75° ,there will be total internal reflection in water\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "#variable declaration\n",
    "n1      = 1.33;         #refractive index of water\n",
    "n2      = 1;            # refractive index of air\n",
    "\n",
    "# Calculations\n",
    "theta_c = math.asin((n2/n1))\n",
    "theta_c_deg = theta_c*(180/float(math.pi));        # radian to degree conversion\n",
    "\n",
    "# Result\n",
    "print'For angles above %3.2f° ,there will be total internal reflection in water'%theta_c_deg ;\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.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}