{
 "metadata": {
  "name": "",
  "signature": "sha256:ab3713dc22f25eef68710ebd9039d7fba92418b0de95b0ba48c70d6376545f8e"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 2- Optical Fiber"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1: PgNo- 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.55 # core refractive index\n",
      "n2=1.50 #cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "x=math.asin(n2/n1) #Critical angle in radians\n",
      "x1=x*180/math.pi   #Critical angle in degree\n",
      "n_a=math.sqrt(math.pow(n1,2)-math.pow(n2,2)) # Numerical aperture\n",
      "x_a=math.asin(n_a)*180/math.pi\n",
      "x_a1=math.ceil(x_a) # Acceptance angle in Degree\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" Critical angle in degree= \", x1,\"degree\"))\n",
      "print ('%s %.2f ' %(\"\\n Numerical aperture= \",n_a))\n",
      "print ('%s %.1f %s' %(\"\\n Acceptance angle in degree= \",x_a1,\"degree\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Critical angle in degree=  75.41 degree\n",
        "\n",
        " Numerical aperture=  0.39 \n",
        "\n",
        " Acceptance angle in degree=  23.0 degree\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2:PgNo-21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variable declaration\n",
      "\n",
      "c=3*math.pow(10,8) #speed of light in m/s\n",
      "v=2*math.pow(10,8) # in m/s\n",
      "# calculations\n",
      "n1=c/v\n",
      "x=75    # in degree\n",
      "n2=n1*math.sin((x*math.pi/180))\n",
      "n_2=1.44\n",
      "n_a=math.sqrt(math.pow(n1,2)-math.pow(n_2,2)) # numerical aperture\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" Numerical aperture = \",n_a))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Numerical aperture =  0.42\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3:PgNo-25"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math \n",
      "\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "n2=1.47 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "dl=(n1-n2)/n1\n",
      "n_a=n1*(math.sqrt(2*dl))# numerical aperture\n",
      "x_a=(math.asin(n_a))*180/math.pi #acceptance angle in degree\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" Numerical aperture = \",n_a))\n",
      "print ('%s %.2f %s' %(\"\\n Acceptance angle in degree = \",x_a,\"degree\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Numerical aperture =  0.30\n",
        "\n",
        " Acceptance angle in degree =  17.46 degree\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4:PgNo-27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "n2=1.45 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "dl=(n1-n2)/n1\n",
      "n_a=n1*(math.sqrt(2*dl)) # numerical aperture\n",
      "x_a=(math.asin(n_a))*180/math.pi # acceptance angle in degree\n",
      "x_c=(math.asin(n2/n1))*180/math.pi # critical angle in degree\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" Numerical aperture = \",n_a))\n",
      "print ('%s %.2f %s' %(\"\\n acceptance angle in degree = \",x_a,\"degree\"))\n",
      "print ('%s %.2f %s' %(\"\\n critical angle in degree = \",x_c,\"degree\"))\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Numerical aperture =  0.39\n",
        "\n",
        " acceptance angle in degree =  22.79 degree\n",
        "\n",
        " critical angle in degree =  75.16 degree\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5:PgNo- 32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "dl=0.012\n",
      "n_a=0.22  # numerical aperture\n",
      "\n",
      "# Calculations\n",
      "n1=n_a/(math.sqrt(2*dl)) # core refractive index\n",
      "n2=n1-(dl*n1)# cladding refractive index\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" core refractive index = \",n1))\n",
      "print ('%s %.2f' %(\"\\n cladding refractive index = \",n2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " core refractive index =  1.42\n",
        "\n",
        " cladding refractive index =  1.40\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6:PgNo-34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "dl=0.012\n",
      "n_a=0.22 # numerical aperture\n",
      "\n",
      "# Calculations\n",
      "n1=n_a/(math.sqrt(2*dl)) # core refractive index\n",
      "n2=n1-(dl*n1)# cladding refractive index\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" core refractive index = \",n1))\n",
      "print ('%s %.2f' %(\"\\n cladding refractive index = \",n2))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " core refractive index =  1.42\n",
        "\n",
        " cladding refractive index =  1.40\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7:PgNo-37"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n2=1.59 # cladding refractive index\n",
      "n_a=0.2 # numerical aperture\n",
      "n_1=1.60 # core refractive index\n",
      "n_o=1.33\n",
      "\n",
      "# Calculations\n",
      "n1=math.sqrt(math.pow(n2,2)+math.pow(n_a,2)) # core refractive index\n",
      "A=(math.sqrt(math.pow(n_1,2)-math.pow(n2,2)))/n_o\n",
      "x_a=(math.asin(A))*180/math.pi        # acceptance angle in degree\n",
      "x_c=(math.asin(n2/n1))*180/math.pi    #critical angle in degree\n",
      "y=1300*math.pow(10,(-9))    # in meter\n",
      "a=25*math.pow(10,(-6))      # in meter\n",
      "v=(2*math.pi*a*n_a)/y\n",
      "V=math.floor(v)\n",
      "M=math.pow(V,2)/2 # number of modes transmitted\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" acceptance angle in degree = \",x_a,\"degree\"))\n",
      "print ('%s %.2f %s' %(\"\\n critical angle in degree = \",x_c,\"degree\"))\n",
      "print ('%s %d' %(\"\\n number of modes transmitted = \",M))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " acceptance angle in degree =  7.72 degree\n",
        "\n",
        " critical angle in degree =  82.83 degree\n",
        "\n",
        " number of modes transmitted =  288\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8:PgNo-42"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "n2=1.47 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "dl=(n1-n2)/n1\n",
      "n_a=n1*(math.sqrt(2*dl)) # numerical aperture\n",
      "x_e=(math.asin(n_a))*180/math.pi # the maximum entrance angle in degree\n",
      "\n",
      "# Results\n",
      "print ('%s %.1f' %(\" Numerical aperture = \",n_a))\n",
      "print ('%s %.2f %s' %(\"\\n The maximum entrance angle in degree = \",x_e,\"degree\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Numerical aperture =  0.3\n",
        "\n",
        " The maximum entrance angle in degree =  17.46 degree\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 9:PgNo-47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.44 # core refractive index\n",
      "dl=0.02\n",
      "\n",
      "# Calculations\n",
      "n_a=n1*math.sqrt(2*dl)\n",
      "n_a=n1*(math.sqrt(2*dl)) # numerical aperture\n",
      "x_a=(math.asin(n_a))*180/math.pi # acceptance angle in degree\n",
      "\n",
      "# Results\n",
      "print \" Numerical aperture = \",n_a\n",
      "print ('%s %.2f %s'%(\"\\n acceptance angle in degree = \",x_a,\"degree\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Numerical aperture =  0.288\n",
        "\n",
        " acceptance angle in degree =  16.74 degree\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 10:PgNo-53"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "n2=(99.0/100.0)*1.50 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "x_c=math.asin(n2/n1)*(180/math.pi) # critical angle in degree\n",
      "n_m=math.sqrt(math.pow(n1,2)-math.pow(n2,2)) # numerical aperture\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" critical angle = \",x_c,\"degree\"))\n",
      "print ('%s %.2f' %(\"\\n numerical aperture = \",n_m))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " critical angle =  81.89 degree\n",
        "\n",
        " numerical aperture =  0.21\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 11: PgNo-58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "n2=1.45 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "n_m=math.sqrt(math.pow(n1,2)-math.pow(n2,2)) # numerical aperture\n",
      "dl=(n1-n2)/n1 # fractional difference\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" numerical aperture = \",n_m))\n",
      "print ('%s %.2f' %(\"\\n fractional difference = \",dl))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " numerical aperture =  0.38\n",
        "\n",
        " fractional difference =  0.03\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 12: PgNo-65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.46 # core refractive index\n",
      "n2=1.45 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "x_c=(math.asin(n2/n1))*180/math.pi # critical angle in degree\n",
      "n_m=math.sqrt(math.pow(n1,2)-math.pow(n2,2)) # numerical aperture\n",
      "x_a=(math.asin(n_m))*180/math.pi # acceptance angle in degree\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" critical angle = \",x_c,\"degree\"))\n",
      "print ('%s %.2f %s' %(\"\\n acceptance angle = \",x_a,\"degree\"))\n",
      "print ('%s %.2f' %(\"\\n numerical aperture = \",n_m))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " critical angle =  83.29 degree\n",
        "\n",
        " acceptance angle =  9.82 degree\n",
        "\n",
        " numerical aperture =  0.17\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 13: PgNo-67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variable declaration\n",
      "n_m=0.204 #numerical aperture\n",
      "dl=0.01 # index difference\n",
      "\n",
      "# Calculations\n",
      "n1=n_m/(math.sqrt(2*dl)) # core refractive index\n",
      "n2=n1*(1-dl) # cladding refractive index\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f' %(\" core refractive index = \",n1))\n",
      "print ('%s %.2f' %(\"\\n cladding refractive index = \",n2))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " core refractive index =  1.44\n",
        "\n",
        " cladding refractive index =  1.43\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 14: PgNo-71"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variable declaration\n",
      "\n",
      "n1=1.46 #core refractive index\n",
      "dl=0.01 # index difference\n",
      "\n",
      "# Calculations\n",
      "n_2=n1-(n1*dl) # cladding refractive index\n",
      "x_c=(math.asin(n_2/n1))*180/math.pi #critical angle in degree\n",
      "n_m=math.sqrt(math.pow(n1,2)-math.pow(n_2,2)) # numerical aperture\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" critical angle = \",x_c,\"degree\"))\n",
      "print ('%s %.2f' %(\"\\n numerical aperture = \",n_m))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " critical angle =  81.89 degree\n",
        "\n",
        " numerical aperture =  0.21\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 15: PgNo-76"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "n2=1.45 # cladding refractive index\n",
      "\n",
      "# Calculations\n",
      "x_c=(math.asin(n2/n1))*180/math.pi # critical angle in degree\n",
      "n_m=math.sqrt(math.pow(n1,2)-math.pow(n2,2)) # numerical aperture\n",
      "x_a=(math.asin(n_m))*180/math.pi # acceptance angle in degree\n",
      "n_c=math.pow((n_m),2)*100 # percentage of light\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f %s' %(\" critical angle= \",x_c,\"degree\"))\n",
      "print ('%s %.2f %s' %(\"\\n acceptance angle= \",x_a,\"degree\"))\n",
      "print ('%s %.2f' %(\"\\n numerical aperture= \",n_m))\n",
      "print ('%s %.2f %s'%(\"\\n percentage of light= \",n_c,\"%\"))\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " critical angle=  75.16 degree\n",
        "\n",
        " acceptance angle=  22.59 degree\n",
        "\n",
        " numerical aperture=  0.38\n",
        "\n",
        " percentage of light=  14.75 %\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 16: PgNo-81"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variable declaration\n",
      "n1=1.50 # core refractive index\n",
      "dl=0.01 # index difference\n",
      "\n",
      "# Calculations\n",
      "n_m=n1*(math.sqrt(2*dl)) # numerical aperture\n",
      "x_a=math.pi*math.pow((n_m),2) # acceptance angle in radian\n",
      "n2_1=(1-dl) # the ratio of n2 to n1\n",
      "x_c=(math.asin(n2_1))*180/math.pi # critical angle in degree\n",
      "\n",
      "# Results\n",
      "print ('%s %.2f'%(\" numerical aperture= \",n_m))\n",
      "print ('%s %.2f %s' %(\"\\n acceptance angle= \",x_a,\"radian\"))\n",
      "print ('%s %.2f %s'%(\"\\n critical angle= \",x_c,\"degree\"))"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " numerical aperture=  0.21\n",
        "\n",
        " acceptance angle=  0.14 radian\n",
        "\n",
        " critical angle=  81.89 degree\n"
       ]
      }
     ],
     "prompt_number": 18
    }
   ],
   "metadata": {}
  }
 ]
}