{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter5 - Single mode fibers"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.1 : Page 86"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " w = 4.7086 and wp = 4.6184 micro meter when wavelength is 1.30 micro meter\n",
      " w = 5.5109 and wp = 5.3570 micro meter when wavelength is 1.55 micro meter\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "from math import pi, sqrt\n",
    "#w and wp\n",
    "n=1.46#core refractive index\n",
    "d=0.003#differnce in core-cladding refrative index\n",
    "a=4#core radius in micro meter\n",
    "h1=1.30# inmicro meter\n",
    "h2=1.55#in micro meter\n",
    "v1=((2*pi*(a*10**-6))*n*sqrt(2*(d)))/(h1*10**-6)#normalised frequency parameter\n",
    "v2=((2*pi*(a*10**-6))*n*sqrt(2*(d)))/(h2*10**-6)#normalised frequency parameter\n",
    "w1=(a*10**-6)*(0.65+((1.619)/(v1)**(3/2))+(2.879/(v1)**6))#in meter\n",
    "wp1=w1-(a*10**-6)*(0.016+((1.567)/(v1)**7))#in micro meter\n",
    "w2=(a*10**-6)*(0.65+((1.619)/(v2)**(3/2))+(2.879/(v2)**6))#in meter\n",
    "wp2=w2-(a*10**-6)*(0.016+((1.567)/(v2)**7))#in micro meter\n",
    "print \" w = %0.4f\"%(w1*10**6),\"and wp = %0.4f\"%(wp1*10**6),\"micro meter when wavelength is 1.30 micro meter\"\n",
    "print \" w = %0.4f\"%(w2*10**6),\"and wp = %0.4f\"%(wp2*10**6),\"micro meter when wavelength is 1.55 micro meter\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.2 : Page 88"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "part (a)\n",
      "difference between propogation constant = 62.83 m**-1\n",
      "part (b)\n",
      "modal birefringence = 1e-05\n"
     ]
    }
   ],
   "source": [
    "#difference between propogation constant and modal birefringence\n",
    "print \"part (a)\"\n",
    "bl=10#beat length in cm\n",
    "h=1#in micro meter\n",
    "db=((2*pi)/(bl*10**-2))#in m**-1\n",
    "print \"difference between propogation constant = %0.2f m**-1\"%db\n",
    "print \"part (b)\"\n",
    "mb=db*((h*10**-6)/(2*pi))#modal birefringence\n",
    "print \"modal birefringence = %0.e\"%mb\n",
    "#answer is approximately equal to the answer in the book"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.3 : Page 93"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " waveguide dispersion factor = -3.149 ps nm**-1 km**-1 at wavelength 1.3 micro meter\n",
      " waveguide dispersion factor = -5.537 ps nm**-1 km**-1 at wavelength 1.55 micro meter\n"
     ]
    }
   ],
   "source": [
    "#waveguide dispersion factor\n",
    "n=1.45#core refractive index\n",
    "d=0.003#differnce in core-cladding refrative index\n",
    "n2=1.45*(1-d)#cladding refractive index\n",
    "d1=8.2#core diameter in micro meter\n",
    "a=d1/2#core radius in micro meter\n",
    "h1=1.30# inmicro meter\n",
    "h2=1.55#in micro meter\n",
    "v1=(2*pi*a*n*sqrt(2*d))/h1#normalised frequency parameter\n",
    "v2=((2*pi*(a))*n*sqrt(2*(d)))/(h2)#normalised frequency parameter\n",
    "v1dv=0.080+0.549*(2.834-v1)**2#\n",
    "v2dv=0.080+0.549*(2.834-v2)**2#\n",
    "c=3*10**8# in m/s\n",
    "dw1=-((n2*d*v1dv)/(c*h1))*10**12#waveguide dispersion factor in ps nm**-1 km**-1\n",
    "dw2=-((n2*d*v2dv)/(c*h2))*10**12#waveguide dispersion factor in ps nm**-1 km**-1\n",
    "print \" waveguide dispersion factor = %0.3f\"%(dw1),\"ps nm**-1 km**-1 at wavelength 1.3 micro meter\"\n",
    "print \" waveguide dispersion factor = %0.3f\"%(dw2),\"ps nm**-1 km**-1 at wavelength 1.55 micro meter\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.4 : Page 95"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "diameter of the core = 7.10 micro meter\n"
     ]
    }
   ],
   "source": [
    "#diameter of the core\n",
    "c=3*10**8#in m/s\n",
    "dm=6#material dispersion in ps nm**-1 km**-1\n",
    "h=1.55#in micro meter\n",
    "n1=1.45#core refrative index\n",
    "d=0.005#differnce\n",
    "n2=n1*(1-d)#cladding refrative index\n",
    "x=((-dm/(((-n2*d)/(c*h))*10**12))-0.080)/0.549#\n",
    "v=-(sqrt(x)-2.834)#\n",
    "d=((v*h)/(pi*n1*sqrt(2*d)))#diameter in micro meter\n",
    "print \"diameter of the core = %0.2f micro meter\"%d"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 5.5 : Page 100"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "splice loss = 0.20 dB when wavelength is 1.30 micro meter\n",
      "splice loss = 0.15 dB when wavelength is 1.55 micro meter\n"
     ]
    }
   ],
   "source": [
    "#splice loss\n",
    "h1=1.30#in micro meter\n",
    "wp1=4.6155#in micro meter\n",
    "h2=1.55#in micro meter\n",
    "wp2=5.355#in micro meter\n",
    "sl1=4.34*(1/wp1)**2#splice loss in dB\n",
    "sl2=4.34*(1/wp2)**2#splice loss in dB\n",
    "print \"splice loss = %0.2f dB when wavelength is 1.30 micro meter\"%sl1\n",
    "print \"splice loss = %0.2f dB when wavelength is 1.55 micro meter\"%sl2"
   ]
  }
 ],
 "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
}