{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 7 Wave Guides"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_1 pgno:75"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-Critical wavelength =  cm\n",
      "15.24\n",
      "-Guide wavelength =  cm 13.3\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "c=3.*(10**8);\n",
    "f=3000.*(10**8);\n",
    "lo=c/f;\n",
    "l=lo*(10**4);\n",
    "m=1.;n=0;a=7.62;\n",
    "lc=2*a;\n",
    "print\"-Critical wavelength =  cm\\n\",lc\n",
    "lg=sqrt((l*l*lc*lc)/((lc*lc)-(l*l)));\n",
    "print\"-Guide wavelength =  cm\",round(lg*10)/10\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_2 pgno:76"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Frequency of dominant mode =  GHz 5.0\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "a=3;\n",
    "lc=2*a;\n",
    "Zs=500;n=377;c=3*(10**8);\n",
    "lo=sqrt(1-((n/Zs)**2))*lc;\n",
    "f=c/lo;\n",
    "f1=f/(10**7);\n",
    "print\"Frequency of dominant mode =  GHz\",round(f1*100)/100\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_3 pgno:78"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i)Cutoff wavelegth =  cm\n",
      "9.0\n",
      "(ii)Guide wavelength =  cm\n",
      "3.59\n",
      "(iii)Phase velocity =  * 10**8 m/sec\n",
      "3.23\n",
      "   Group velocity =  * 10**8 m/sec\n",
      "2.79\n",
      "(iv)Characteristic impedance =  ohm 406.0\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt\n",
    "a=4.5;b=3.;f=9.*(10**9);c=3.0*(10**8);n=377.\n",
    "lo=c/f;\n",
    "l=lo*(10**2);\n",
    "lc=2*a;\n",
    "print\"(i)Cutoff wavelegth =  cm\\n\",lc\n",
    "lg=l /(sqrt(1-((l/lc)**2)));\n",
    "print\"(ii)Guide wavelength =  cm\\n\",round(lg*100)/100\n",
    "Vp=(lg/l)*c*10**-8;\n",
    "print\"(iii)Phase velocity =  * 10**8 m/sec\\n\",round(Vp*100)/100\n",
    "Vg=(l/lg)*c*10**-8;\n",
    "print\"   Group velocity =  * 10**8 m/sec\\n\",round(Vg*100)/100\n",
    "Z=n/(sqrt(1-((l/lc)**2)));\n",
    "print\"(iv)Characteristic impedance =  ohm\",round(Z)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_4 pgno:79"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total attenuation =  db 681.88\n",
      "The difference in result is due to erroneous value in textbook\n"
     ]
    }
   ],
   "source": [
    "a=1.;c=3.*(10**8);f=(10**9);d=25.;\n",
    "lc=2*a;\n",
    "lo=c/f;\n",
    "l=lo/(10**2);\n",
    "att=(54.55/lc)*d;\n",
    "print\"Total attenuation =  db\",round(att*100)/100\n",
    "#the difference in result  is due to erroneous value in textbook.\n",
    "print (\"The difference in result is due to erroneous value in textbook\")\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_5 pgno:80"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-Phase velocity Vp =  * 10**8 m/sec\n",
      "4.2\n",
      "-Group velocity Vg =  * 10**8 m/sec\n",
      "2.2\n",
      "-Phase constant =  radians/m 45.0\n"
     ]
    }
   ],
   "source": [
    "from math import sqrt,pi\n",
    "c=3.*(10**8);f=3000.*(10**6);a=.0722;\n",
    "lo=c/f;\n",
    "lc=2*a;\n",
    "lg=lo/(sqrt(1-((lo/lc)**2)));\n",
    "Vp=(lg/lo)*c*10**-8;\n",
    "print\"-Phase velocity Vp =  * 10**8 m/sec\\n\",round(Vp*10)/10\n",
    "Vg=(lo/lg)*c*10**-8;\n",
    "print\"-Group velocity Vg =  * 10**8 m/sec\\n\",round(Vg*10)/10\n",
    "b=(2*pi)/lg;\n",
    "print\"-Phase constant =  radians/m\",round(b)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_6 pgno:81"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(i)Cutoff frequency for TE11 =  GHz\n",
      "3.52\n",
      "(ii)Cutoff frequency for TE01 =  GHz 4.6\n"
     ]
    }
   ],
   "source": [
    "\n",
    "d=5.;c=3.*(10**8);\n",
    "lo=1.706*d;\n",
    "f=c/lo;\n",
    "ff=f/(10**7);\n",
    "print\"(i)Cutoff frequency for TE11 =  GHz\\n\",round(ff*100)/100\n",
    "l=1.306*d;\n",
    "fc=c/l;\n",
    "ffc=fc/(10**7);\n",
    "print\"(ii)Cutoff frequency for TE01 =  GHz\",round(ffc*10)/10\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 7_7 pgno:82"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "-Cutoff wavelength =  cm\n",
      "8.54\n",
      "-Guide wavelength =  cm\n",
      "4.17\n",
      "-Characteristic wave impedance =  ohm 419.7\n"
     ]
    }
   ],
   "source": [
    "from math import pi,sqrt\n",
    "c=3.*(10**8);f=8.*(10**9);r=2.5;h=1.84;n=377.;\n",
    "l=c/f;\n",
    "lo=l*(10**2);\n",
    "lc=2*pi*r/h;\n",
    "print\"-Cutoff wavelength =  cm\\n\",round(lc*100)/100\n",
    "lp=lo/(sqrt(1-((lo/lc)**2)));\n",
    "print\"-Guide wavelength =  cm\\n\",round(lp*100)/100\n",
    "Zo=n/(sqrt(1-((lo/lc)**2)));\n",
    "print\"-Characteristic wave impedance =  ohm\",round(Zo*10)/10\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.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}