{
 "metadata": {
  "name": "",
  "signature": "sha256:8b3ccd88c7aadd311b6269c4809d3b632a222a912e8231c54428ad90a16f0d12"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h1>Chapter 14: Modern Topics<h1>"
     ]
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14.1, Page number: 643<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "import cmath\n",
      "from numpy import *\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "S11=0.85*scipy.e**(-30j*scipy.pi/180)\n",
      "S12=0.07*scipy.e**(56j*scipy.pi/180)\n",
      "S21=1.68*scipy.e**(120j*scipy.pi/180)\n",
      "S22=0.85*scipy.e**(-40j*scipy.pi/180)\n",
      "Zl=75 \n",
      "Zo=75\n",
      "\n",
      "#Calculations\n",
      "\n",
      "Tl=(Zl-Zo)/(Zl+Zo)\n",
      "Ti=S11+(S12*S21*Tl)/(1-S22*Tl)                      #reflection coefficient\n",
      "Timod=abs(Ti)                                       #mod of Ti\n",
      "Tiang=scipy.arctan(Ti.imag/Ti.real)*180/scipy.pi    #argument of Ti in degrees\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'input reflection coefficient =',Timod,'/',Tiang,'degrees'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "input reflection coefficient = 0.85 / -30.0 degrees\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14.2, Page number: 654<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "d=80*(10)**-6       #diameter in m\n",
      "n1=1.62             #core refractive index\n",
      "NA=0.21             #numerical aperture\n",
      "L=8*(10)**-7        #wavelength in m\n",
      "\n",
      "#Calculations\n",
      "\n",
      "P=scipy.arcsin(NA)*180/scipy.pi             #acceptance angle\n",
      "n2=scipy.sqrt(n1**2-NA**2)                  #refractive index\n",
      "V=(scipy.pi*d/L)*scipy.sqrt(n1**2-n2**2)\n",
      "N=V**2/2                                    #number of modes\n",
      "\n",
      "#Results\n",
      "\n",
      "print 'Acceptance angle =',round(P,2),'degrees'\n",
      "print 'Refractive index =',round(n2,3)\n",
      "print 'No. of modes =',round(N,0)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Acceptance angle = 12.12 degrees\n",
        "Refractive index = 1.606\n",
        "No. of modes = 2176.0\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "markdown",
     "metadata": {},
     "source": [
      "<h3>Example 14.3, Page number: 655<h3>"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      " \n",
      "import scipy\n",
      "\n",
      "#Variable Declaration\n",
      "\n",
      "a=0.25          #in dB/km\n",
      "P=1-0.4         #strength of pulse im %\n",
      "\n",
      "#Calculation\n",
      "\n",
      "l=(10/a)*scipy.log(1/P)/scipy.log(10)   #distance in km\n",
      "\n",
      "#Result\n",
      "\n",
      "print 'distance through which the power is reduced by 40% =',round(l,3),'km'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "distance through which the power is reduced by 40% = 8.874 km\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}