{
 "metadata": {
  "name": "",
  "signature": "sha256:682987e4618d85f3223ce09c9f676959c97dc81b85e6ff92270d30168f8d3c6a"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2 - Optical Fibers"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex 2.4.1 - p:2-10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n1=1.46  #refractive index\n",
      "d=0.01  #difference\n",
      "na=n1*(2*d)**(1.0/2) #numerical aperture\n",
      "x=1-d  #\n",
      "oc=math.asin(x)  #in radian\n",
      "oc*=180/math.pi # in degree\n",
      "print \"Numerical Aperture is \",round(na,2)\n",
      "print \"Critical angle at core cladding interface is \",round(oc,1),\" degree.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical Aperture is  0.21\n",
        "Critical angle at core cladding interface is  81.9  degree.\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5.1 - p:2-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n2=1.45  #core refrative index\n",
      "n1=1.49  #cladding refrative index\n",
      "oc=math.asin(n2/n1)  #in radian\n",
      "oc*=180/math.pi # in degree\n",
      "na=(n1**2-n2**2)**(1.0/2)  #numerical aperture\n",
      "pc=math.asin(na)  # in radian\n",
      "pc*=180/math.pi # in degree\n",
      "print oc,\"Critical angle is \",round(oc,2),\" degree.\"\n",
      "print \"Numerical aperture is \",round(na,3)\n",
      "print \"Acceptance angle is \",round(pc,2),\" degree.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "76.693896868 Critical angle is  76.69  degree.\n",
        "Numerical aperture is  0.343\n",
        "Acceptance angle is  20.06  degree.\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5.2 - p:2-11"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "delta = 1.2/100        # Relative refractive difference index\n",
      "n1=1.45          # Core refractive index \n",
      "NA= n1*(2*delta)**(1.0/2)         #computing numerical aperture\n",
      "Acceptance_angle = math.asin(NA)     #computing acceptance angle\n",
      "si = math.pi*NA**2          #computing solid acceptance angle\n",
      "print \"Numerical aperture is %.3f.\\nAcceptance angle is %.2f degree.\\nSolid acceptance angle is %.3f radians.\"%(NA,Acceptance_angle,si)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical aperture is 0.225.\n",
        "Acceptance angle is 0.23 degree.\n",
        "Solid acceptance angle is 0.159 radians.\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.5.4 - p:2-12"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "diameter = 1.0         #Diameter in centimeter\n",
      "Focal_length = 10.0        #Focal length in centimeter\n",
      "radius=diameter/2.0    #computing radius\n",
      "Acceptance_angle = math.atan(radius/Focal_length)    #computing acceptance angle in radian\n",
      "Acceptance_angle*=180/math.pi  # in degree\n",
      "Conical_full_angle = 2*Acceptance_angle          #computing conical angle in degree\n",
      "Solid_acceptance_angle = math.pi*Acceptance_angle**2      #computing solid acceptance angle in degree\n",
      "NA = (Solid_acceptance_angle/math.pi)**(1.0/2)        #computing Numerical aperture\n",
      "print \"Numerical aperture is %.2f.\\nConical full angle is %.2f degree.\" %(NA,Conical_full_angle)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Numerical aperture is 2.86.\n",
        "Conical full angle is 5.72 degree.\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.8.1 - p:2-21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "core_diameter=78*10**-6          #core diameter\n",
      "delta=1.4/100        #relative index difference\n",
      "lamda=0.8*10**-6         #operating wavelength\n",
      "n1=1.47       #core refractive index\n",
      "a=core_diameter/2        #computing core radius\n",
      "v= 2*3.14*a*n1*(2*delta)**(1.0/2)/lamda        #computing normalized frequency\n",
      "M=(v)**2/2        #computing guided modes\n",
      "print \"Normalized Frequency is %.3f.\\nTotal number of guided modes are %.1f\" %(v,M) "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Normalized Frequency is 75.306.\n",
        "Total number of guided modes are 2835.5\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2.8.2 - p:2-23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "n1=1.47     #refractive index of core\n",
      "a=4.3         #radius of core in um\n",
      "delta=0.2/100       #relative index difference\n",
      "lamda= 2*math.pi*a*n1*(2*delta)**(1.0/2)/2.405       #computing wavelength in um\n",
      "lamda=lamda*10**3  # nm\n",
      "\n",
      "print \"Wavelength of fiber is %0.2f nm.\" %lamda"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Wavelength of fiber is 1044.43 nm.\n"
       ]
      }
     ],
     "prompt_number": 30
    }
   ],
   "metadata": {}
  }
 ]
}