{

 "metadata": {

  "name": "",

  "signature": "sha256:4df436839f5993306536c3970f88a0cacfc571f6977bdd36882e86f5929b935c"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter6:ELECTROMAGNETICS"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg1:pg-206"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "from sympy import *\n",

      "r=1     #radius in meter\n",

      "H=2     #magnitude of field vector in amp/meter\n",

      "pi=Symbol('pi')\n",

      "I=H*2*pi*r                                                     \n",

      "print\"Current in the wire is \",I,\"amp\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Current in the wire is  4*pi amp\n"

       ]

      }

     ],

     "prompt_number": 1

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg5:pg-212"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "from sympy import *\n",

      "sigma=1e-4           #conductivity in siemen/m\n",

      "Er=2.25              #relative permittivity \n",

      "E0=1/(4*math.pi*9e9) #permittivity of free space\n",

      "E=5e-6*sin(Symbol('9e+09*t')) #electric field in the material volt/m\n",

      "J=sigma*E\n",

      "diff_E=5e-6*9e9*cos(Symbol('9e+09*t'))\n",

      "Jd=E0*Er*diff_E\n",

      "print\"Conduction current density is \",J,\"A/m**2\"\n",

      "print\"Displacement current density is \",Jd,\"A/m**2\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Conduction current density is  5.0e-10*sin(9e+09*t) A/m**2\n",

        "Displacement current density is  8.95246554891911e-7*cos(9e+09*t) A/m**2\n"

       ]

      }

     ],

     "prompt_number": 2

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg13:pg-236"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "H0=1    #magnitude of field vector in amp/meter\n",

      "mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m\n",

      "e0=8.85e-12   #permittivity of free space in F/m\n",

      "E0=H0*sqrt(mu_0/e0)\n",

      "print\"Magnitude of electric field for plane wave in free space is \",round(E0,2),\"V/m\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Magnitude of electric field for plane wave in free space is  376.72 V/m\n"

       ]

      }

     ],

     "prompt_number": 3

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg14:pg-236"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "E0=1e2    #maximum electric field in plane electromagnetic wave in Newton/coul.\n",

      "c=3e8     #speed of light in m/sec\n",

      "B0=E0/c  \n",

      "print\"Maximum magnetic field is \",round(B0,9),\"Tesla\"\n",

      "print\"Maximum magnetic field will be in Z-direction.\"#this part is not printed in answer in book"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Maximum magnetic field is  3.33e-07 Tesla\n",

        "Maximum magnetic field will be in Z-direction.\n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg15:pg-236"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "S=2*4.2e4/60   #energy flux per unit area per second at the earth surface\n",

      "mu_0=4*round(math.pi,2)*1e-7  #permeability of free space in H/m\n",

      "e0=8.85e-12    #permittivity of free space in F/m\n",

      "EH=S\n",

      "E_div_H=sqrt(mu_0/e0)\n",

      "E=sqrt(E_div_H*EH)\n",

      "H=EH/E\n",

      "E0=round(E,1)*round(sqrt(2.),3)\n",

      "H0=H*sqrt(2.)\n",

      "print\"Amplitude of electric field is \",round(E0,1),\"V/m\"\n",

      "print\"Amplitude of magnetic field is \",round(H0,3),\"A-turn m-1\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Amplitude of electric field is  1026.8 V/m\n",

        "Amplitude of magnetic field is  2.726 A-turn m-1\n"

       ]

      }

     ],

     "prompt_number": 5

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg16:pg-236"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "P0=1000   #power in watt\n",

      "r=2       #distance in meter\n",

      "Sav=P0/(4*round(math.pi,2)*r**2)\n",

      "mu_0=4*round(math.pi,2)*1e-7   #permeability of free space in H/m\n",

      "e0=8.85e-12   #permittivity of free space in F/m\n",

      "EH=Sav\n",

      "E_div_H=sqrt(mu_0/e0)\n",

      "E=sqrt(E_div_H*EH)\n",

      "H=EH/E\n",

      "print\"Average value of electric field intensity is \",round(E,2),\"V/m\"\n",

      "print\"Average value of magnetic field intensity is \",round(H,2),\"A-turn m-1\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Average value of electric field intensity is  86.59 V/m\n",

        "Average value of magnetic field intensity is  0.23 A-turn m-1\n"

       ]

      }

     ],

     "prompt_number": 6

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg17:pg-237"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "S=1.38      #energy flux in KW/m**2\n",

      "c=3e8       #speed of light in m/sec\n",

      "mu_0=4*math.pi*1e-7   #permeability of free space in H/m\n",

      "E0=sqrt(2*mu_0*c*S*1e3)\n",

      "B0=E0/c\n",

      "print\"Peak value of electric field is \",round(E0*1e-3,2),\"KV/m\"\n",

      "print\"Peak value of magnetic field is \",round(B0,7),\"Wb/m**2\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Peak value of electric field is  1.02 KV/m\n",

        "Peak value of magnetic field is  3.4e-06 Wb/m**2\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg18:pg-237"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "E0=100      #in Newton/coul.\n",

      "A=1e-3      #area in m**2\n",

      "l=100       #length in cm\n",

      "e0=8.85e-12 #permittivity of free space in F/m\n",

      "V=A*l*1e-2\n",

      "U=e0*E0**2*V/2\n",

      "print\"Energy contained in cylinder is \",U,\"Joule\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Energy contained in cylinder is  4.425e-11 Joule\n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg19:pg-238"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "E0=0.05   #amplitude of electric field strength in V/m\n",

      "v=6       #frequency in MHz\n",

      "c=3e8     #speed of light in m/sec\n",

      "mu_0=4*math.pi*1e-7 #permeability of free space in H/m\n",

      "e0=8.85e-12         #permittivity of free space in F/m\n",

      "T=round(1/(v*1e6),9)\n",

      "lamda=c/(v*1e6)\n",

      "H0=E0/sqrt(mu_0/e0)\n",

      "Sx_av=E0*round(H0,6)/2\n",

      "print\"E=\",E0,\"sin(\",\"{:.2e}\".format(2*math.pi/T),\"t -\",(2*round(math.pi,2)/lamda),\"x) V/m\"\n",

      "print\"H=\",\"{:.2e}\".format(H0),\"sin(\",\"{:.2e}\".format(2*math.pi/T),\"t -\",(2*round(math.pi,2)/lamda),\"x) A/m\"   \n",

      "print\"B=\",round(E0/c,12),\"sin(\",\"{:.2e}\".format(2*math.pi/T),\"t -\",(2*round(math.pi,2)/lamda),\"x) Wb/m**2\"         \n",

      "print\"Average poynting vector S=\",Sx_av,\"Wb/m**2\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "E= 0.05 sin( 3.76e+07 t - 0.1256 x) V/m\n",

        "H= 1.33e-4 sin( 3.76e+07 t - 0.1256 x) A/m\n",

        "B= 1.67e-10 sin( 3.76e+07 t - 0.1256 x) Wb/m**2\n",

        "Average poynting vector S= 3.325e-06 Wb/m**2\n"

       ]

      }

     ],

     "prompt_number": 9

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg20:pg-239"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "lamda=7   #wavelength in mm\n",

      "E0=42     #maximum magnitude of electric field in V/m\n",

      "c=3e8     #speed of light in m/sec\n",

      "print\"E=\",E0,\"sin(2*pi*(ct-x)/\",lamda,\") V/m\"\n",

      "print\"B=\",E0/c,\"sin(2*pi*(ct-x)/\",lamda,\") Wb/m**2 \\nThe magnetic field is along Z-axis.\"\n",

      "#unit is not mentioned in answer in book"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "E= 42 sin(2*pi*(ct-x)/ 7 ) V/m\n",

        "B= 1.4e-07 sin(2*pi*(ct-x)/ 7 ) Wb/m**2 \n",

        "The magnetic field is along Z-axis.\n"

       ]

      }

     ],

     "prompt_number": 10

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg21:pg-239"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "er=81  #relative permittivity of distilled water\n",

      "e0=1   #let, permittivity of free space\n",

      "mu_0=1 #let, permeability of free space\n",

      "e=e0*er\n",

      "c=3e8  #speed of light in m/sec\n",

      "mu=mu_0#for distilled water\n",

      "MU=sqrt((mu*e)/(mu_0*e0))\n",

      "v=c/MU\n",

      "print\"Refractive index is \",MU\n",

      "print\"Velocity of light in distilled water is \",\"{:.2e}\".format(v),\"m/s\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Refractive index is  9\n",

        "Velocity of light in distilled water is  3.33e+7 m/s\n"

       ]

      }

     ],

     "prompt_number": 11

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg23:pg-241"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "E0=7.5     #electric field intensity in KV/m\n",

      "w=2e9      #angular frequency in rad/sec\n",

      "c=3e8      #speed of light in m/sec\n",

      "mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m\n",

      "e0=8.85e-12                  #permittivity of free space in F/m\n",

      "f=w/(2*round(math.pi,2))\n",

      "lamda=c/f\n",

      "T=1/f\n",

      "H0=E0*1e3/sqrt(mu_0/e0)\n",

      "print\"Wavelength is \",lamda,\"m\"\n",

      "print\"Frequency is \",round(f*1e-6,1),\"MHz\"\n",

      "print\"Time period is \",T,\"sec\"\n",

      "print\"Amplitude of magnetic field intensity is \",round(H0,2),\"A/m\"\n",

      "print\"Therefore, Hz=\",round(H0,2),\"cos( (%.e*t)-(beta*x)) A/m\"%w#unit is not printed in book"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Wavelength is  0.942 m\n",

        "Frequency is  318.5 MHz\n",

        "Time period is  3.14e-09 sec\n",

        "Amplitude of magnetic field intensity is  19.91 A/m\n",

        "Therefore, Hz= 19.91 cos( (2e+09*t)-(beta*x)) A/m\n"

       ]

      }

     ],

     "prompt_number": 12

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg24:pg-241"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "from sympy import *\n",

      "mu_0=4*math.pi*1e-7  #permeability of free space in H/m\n",

      "e0=8.854e-12         #permittivity of free space in F/m\n",

      "E=array([0, 45*sin(Symbol('6*pi*1e8*t-(2*pi*x)')),15*cos(Symbol('6*pi*1e8*t-(2*pi*x)'))])   \n",

      "#E=Ey*sin((w*t)-(beta*x))j + Ez*cos((w*t)-(beta*x))k\n",

      "#compairing given equation with above equation\n",

      "beta=2*Symbol('pi')\n",

      "w=6e8*Symbol('pi')\n",

      "f=w/(2*Symbol('pi'))\n",

      "n0=sqrt(mu_0/e0)\n",

      "Hx=0\n",

      "Hy=round(15/n0,4)*cos(Symbol('6*pi*10**8*t-(2*pi*x)'))\n",

      "Hz=round(45/n0,3)*sin(Symbol('6*pi*10**8*t-(2*pi*x)'))\n",

      "H=array([ Hx ,   Hy ,   Hz ])\n",

      "print\"Phase constant is \",beta,\"rad/s\"\n",

      "print\"Angular frequency is %.e*pi rad/s\"%(w/Symbol('pi'))\n",

      "print\"Frequency is \",\"{:.0e}\".format(f),\"Hz\"\n",

      "print\"Intrinsic impedance is \",int(round(n0)),\"Ohm\"\n",

      "print\"Magnetic field is \",H,\"A/m\"  #unit is not printed in book"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Phase constant is  2*pi rad/s\n",

        "Angular frequency is 6e+08*pi rad/s\n",

        "Frequency is  3e+8 Hz\n",

        "Intrinsic impedance is  377 Ohm\n",

        "Magnetic field is  [0 0.0398*cos(6*pi*10**8*t-(2*pi*x)) 0.119*sin(6*pi*10**8*t-(2*pi*x))] A/m\n"

       ]

      }

     ],

     "prompt_number": 3

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg25:pg-242"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "from sympy import *\n",

      "x, Beta, y, Y = symbols('x Beta y Y')\n",

      "Hz=(6*x*cos(Beta))+(12*y*sin(Y))\n",

      "a=diff((6*x*cos(Beta))+(12*y*sin(Y)),y)\n",

      "b=diff(-((6*x*cos(Beta))+(12*y*sin(Y))),x)\n",

      "c=0\n",

      "J=array([ a, b, c])\n",

      "print\"Current density is \",J,\"A/m**2\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Current density is  [12*sin(Y) -6*cos(Beta) 0] A/m**2\n"

       ]

      }

     ],

     "prompt_number": 4

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg26:pg-244"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "A=1.3   #area in m**2\n",

      "t=3     #time in hours\n",

      "S=1.1   #intensity of sun rays in KW/m**2\n",

      "c=3e8   #speed of light in m/sec\n",

      "p=A*(t*3600)*(S*1000)/c\n",

      "print\"Momentum is %se-4 Kg-m/s\"%(p*10000)"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Momentum is 514.8e-4 Kg-m/s\n"

       ]

      }

     ],

     "prompt_number": 18

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg27:pg-245"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "S=10      #energy flux in watt/m**2\n",

      "A=1       #area in m**2\n",

      "t=1       #time in hour\n",

      "c=3e8     #speed of light in m/sec\n",

      "p=2*S*A*(t*3600)/c\n",

      "F=2*S*A/c\n",

      "print\"Momentum is %.1e Kg-m/s\"%p\n",

      "print\"Force is %.2e N\"%F"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Momentum is 2.4e-04 Kg-m/s\n",

        "Force is 6.67e-08 N\n"

       ]

      }

     ],

     "prompt_number": 19

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg29:pg-251"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "mu=4*math.pi*1e-7  #permeability in H/m\n",

      "f=71.6             #frequency in MHz\n",

      "sigma=3.54e7       #conductivity in siemens/m\n",

      "d=1/sqrt(math.pi*f*1e6*mu*sigma)\n",

      "print\"Depth of penetration is \",int(round(d*1e6)),\"micro meter\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Depth of penetration is  10 micro meter\n"

       ]

      }

     ],

     "prompt_number": 20

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg30:pg-251"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "f=3e6    #frequency in Hz\n",

      "mu_r=1   \n",

      "mu_0=4*round(math.pi,2)*1e-7  # in H/m\n",

      "sigma=38e6                    # in S/m\n",

      "mu=mu_r*mu_0\n",

      "d=1/sqrt(round(math.pi,2)*f*mu*sigma)\n",

      "alpha=1/(d)\n",

      "beta=alpha\n",

      "magnitude=sqrt(alpha**2+beta**2)\n",

      "angle=degrees(math.atan(beta/alpha))\n",

      "v=2*round(math.pi,2)*f/round(beta)\n",

      "print\"Skin depth is \",round(d*1e3,5),\"mm\"\n",

      "print\"Propagation constant =[ %.4e , %s degree] m**-1\"%(magnitude,int(angle)) #in polar form\n",

      "print\"Wave velocity is \",round(v,2),\"m/s\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Skin depth is  0.04716 mm\n",

        "Propagation constant =[ 2.9987e+04 , 45 degree] m**-1\n",

        "Wave velocity is  888.51 m/s\n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg31:pg-252"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "mu=4*math.pi*1e-7   # in H/m\n",

      "e0=8.854e-12        # in F/m\n",

      "e=70*e0\n",

      "sigma=5\n",

      "d=(2./sigma)*sqrt(e/mu)\n",

      "alpha=1/round(d,4)\n",

      "print\"skin depth is \",round(d,4),\"m\"\n",

      "print\"Attenuation constant is \",round(alpha,2),\"Np/m\""

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "skin depth is  0.0089 m\n",

        "Attenuation constant is  112.36 Np/m\n"

       ]

      }

     ],

     "prompt_number": 22

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg32:pg-253"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "sigma=2e-3    #in S/m\n",

      "e0=8.854e-12  #in F/m\n",

      "e=80*e0\n",

      "f=10          #in KHz\n",

      "mu=4*math.pi*1e-7  #in H/m\n",

      "ratio=sigma/(2*round(math.pi,2)*f*1e3*e)\n",

      "\n",

      "#since ratio= sigma/(w*e) = 44.96 >>1,therefore, medium is a good conductor.\n",

      "#So calculations will be done considering medium as a good conductor.\n",

      "\n",

      "alpha=sqrt(2*math.pi*f*1e3*mu*sigma/2)\n",

      "beta=int(alpha*1e5)*1e-5\n",

      "magnitude=sqrt(alpha**2+beta**2)\n",

      "angle=degrees(math.atan(beta/alpha))\n",

      "ni=round(round(sqrt(2*math.pi*f*1e3*mu/sigma),2)/round(sqrt(2),2),3)*(1+1j)\n",

      "lamda=2*round(math.pi,2)/beta\n",

      "v=2*math.pi*f*1e3/beta\n",

      "print\"Attenuation constant is %.2e neper/m\"%(int(alpha*1e5)*1e-5)\n",

      "print\"Phase constant is %.2e rad/m\"%beta\n",

      "print\"Propagation constant = [ %.3e , %.f degree] m**-1\"%(magnitude,angle)#in polar form(unit is not printed in book)       \n",

      "print\"Intrinsic impedance is \",ni,\"ohm\"\n",

      "print\"Wavelength is %.2f m\"%lamda\n",

      "print\"Velocity of wave is %.2e m/s\"%v"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Attenuation constant is 8.88e-03 neper/m\n",

        "Phase constant is 8.88e-03 rad/m\n",

        "Propagation constant = [ 1.256e-02 , 45 degree] m**-1\n",

        "Intrinsic impedance is  (4.454+4.454j) ohm\n",

        "Wavelength is 707.21 m\n",

        "Velocity of wave is 7.08e+06 m/s\n"

       ]

      }

     ],

     "prompt_number": 23

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg33:pg-254"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "f=100      #in MHz\n",

      "mu_r=1\n",

      "mu_0=4*round(math.pi,2)*1e-7  #in H/m\n",

      "mu=mu_0*mu_r\n",

      "sigma=58e6                    #in S/m\n",

      "alpha=sqrt(round(math.pi,2)*f*1e6*mu*sigma)\n",

      "alpha=int(alpha/10)*10\n",

      "beta=alpha\n",

      "magnitude=sqrt(alpha**2+beta**2)\n",

      "angle=degrees(math.atan(beta/alpha))\n",

      "sqrt_j=45\n",

      "ni=sqrt(2*round(math.pi,2)*f*1e6*mu/sigma)\n",

      "v=2*round(math.pi,2)*f*1e6/beta\n",

      "print\"Attenuation constant is %.4e neper/m\"%(int(alpha*1e5)*1e-5)\n",

      "print\"Phase constant is %.4e rad/m\"%beta\n",

      "print\"Propagation constant = [ %.4e , %.f degree] m**-1\"%(magnitude,angle)#in polar form(unit is not printed in book)         \n",

      "print\"Intrinsic impedance = [ %.3e , %s degree ] ohm\"%(ni,sqrt_j)#in polar form(unit is not printed in book)\n",

      "print\"Velocity of wave is %.3f Km/s\"%(v/1e3)"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Attenuation constant is 1.5124e+05 neper/m\n",

        "Phase constant is 1.5124e+05 rad/m\n",

        "Propagation constant = [ 2.1389e+05 , 45 degree] m**-1\n",

        "Intrinsic impedance = [ 3.688e-03 , 45 degree ] ohm\n",

        "Velocity of wave is 4.152 Km/s\n"

       ]

      }

     ],

     "prompt_number": 24

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Eg34:pg-255"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "mu=4*math.pi*1e-7  #in H/m\n",

      "sigma=3.54e7       #in S/m\n",

      "d=0.0664           #penetration depth in mm\n",

      "f=1/(math.pi*mu*sigma*(d*1e-3)**2)\n",

      "print\"Frequency is %.2f MHz\"%(f/1e6)\n",

      "#answer is wrong in book because d=0.0644 is taken in calculation which is wrong(given d=0.0664 mm)"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "Frequency is 1.62 MHz\n"

       ]

      }

     ],

     "prompt_number": 25

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [],

     "language": "python",

     "metadata": {},

     "outputs": []

    }

   ],

   "metadata": {}

  }

 ]

}