{
 "metadata": {
  "name": "",
  "signature": "sha256:de195a4faed398c9714bc27769421926f24c448f7ad7f1d4cb04dd3cfbb18334"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "2: Electromagnetic Theory"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.1, Page number 46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "from __future__ import division\n",
      "from sympy import *\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "C = 10;    #Capacitance of the capacitor(pF)\n",
      "#given V=0.2*sin(120*math.pi*t) in volts\n",
      "\n",
      "#Calculation\n",
      "C=C*10**-12;     #Capacitance of the capacitor(F)\n",
      "x, y, z, t = symbols('x y z t')\n",
      "k, m, n = symbols('k m n', integer=True)\n",
      "f, g, h = symbols('f g h', cls=Function)\n",
      "#I = C*dV/dt\n",
      "#let dV/dt be a\n",
      "a=diff(0.2*sin(120*math.pi*t),t)     #dV/dt\n",
      "#value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n",
      "#for cosine function peak value occurs when 120*math.pi*t = 0\n",
      "#therefore value of dV/dt becomes d = 75.398223686155\n",
      "d = 75.398223686155;    #value of dV/dt \n",
      "I=C*d;     #displacement current(A)\n",
      "\n",
      "#Result\n",
      "print \"value of dV/dt is\",a\n",
      "print \"displacement current is\",I, \"A\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of dV/dt is 75.398223686155*cos(376.991118430775*t)\n",
        "displacement current is 7.53982236862e-10 A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.2, Page number 46"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "from __future__ import division\n",
      "from sympy import *\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "epsilon_r = 1;    #Relative electrical permittivity of free space\n",
      "epsilon_0 = 8.854*10**-12;    #Absolute electrical permittivity of free space(F/m)\n",
      "#given E=sin(120*math.pi*t) in volts\n",
      "\n",
      "#Calculation\n",
      "x, y, z, t = symbols('x y z t')\n",
      "k, m, n = symbols('k m n', integer=True)\n",
      "f, g, h = symbols('f g h', cls=Function)\n",
      "#J2 = epsilon*dE/dt\n",
      "epsilon=epsilon_0*epsilon_r;\n",
      "#let dE/dt be a\n",
      "a=diff(sin(120*math.pi*t),t)     #dE/dt\n",
      "#value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n",
      "#for cosine function peak value occurs when 120*math.pi*t = 0\n",
      "#therefore value of dE/dt becomes d = 376.991118430775\n",
      "d = 376.991118430775;    #value of dE/dt\n",
      "J2=epsilon*d;     #displacement current density(A/m**2)\n",
      "\n",
      "#Result\n",
      "print \"value of dE/dt is\",a\n",
      "print \"The peak value of displacement current density is\",J2, \"A/m**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "value of dE/dt is 376.991118430775*cos(376.991118430775*t)\n",
        "The peak value of displacement current density is 3.33787936259e-09 A/m**2\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.3, Page number 47 (Theoritical proof)"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.4, Page number 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#importing modules\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "p = 60;    #Power rating of bulb(W)\n",
      "d = 0.5;    #Distance from the bulb(m)\n",
      "\n",
      "#Calculation\n",
      "A=4*math.pi*d**2;    #area(m**2)\n",
      "P = p/A;    #Value of Poynting vector(W/m**2)\n",
      "P = math.ceil(P*100)/100;    #rounding off value of P to 1 decimal\n",
      "\n",
      "#Result\n",
      "print \"The value of Poynting vector is\",P, \"W/m**2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of Poynting vector is 19.1 W/m**2\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example number 2.5, Page number 47"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#importing modules\n",
      "from __future__ import division\n",
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "E_peak = 6;    #Peak value of electric field intensity(V/m)\n",
      "c = 3*10**8;    #Speed of electromagnetic wave in free space(m/s)\n",
      "mew_0 = 4*math.pi*10**-7;    #Absolute permeability of free space(Tm/A)\n",
      "epsilon_0 = 8.854*10**-12;    #Absolute permittivity of free space(F/m)\n",
      "mew_r = 1;    #Relative permeability of medium\n",
      "epsilon_r = 3;    #Relative permittivity of the medium\n",
      "\n",
      "#Calculation\n",
      "v = c/math.sqrt(mew_r*epsilon_r);    #Wave velocity(m/s)\n",
      "v = v/10**8;\n",
      "v = math.ceil(v*10**4)/10**4;     #rounding off the value of v to 4 decimals\n",
      "eta = math.sqrt((mew_0/epsilon_0)*(mew_r/epsilon_r));    #Intrinsic impedance of the medium(ohm)\n",
      "eta = math.ceil(eta*10)/10;     #rounding off the value of v to 1 decimal\n",
      "H_P = E_peak/eta;     #Peak value of the magnetic intensity(A/m)\n",
      "H_P = H_P*10**2;\n",
      "H_P = math.ceil(H_P*10**2)/10**2;     #rounding off the value of v to 2 decimals\n",
      "\n",
      "#Result\n",
      "print \"The wave velocity is\",v,\"*10**8 m/s\"\n",
      "print \"The intrinsic impedance of the medium is\",eta, \"ohm\"\n",
      "print \"The peak value of the magnetic intensity is\",H_P,\"*10**-2 A/m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The wave velocity is 1.7321 *10**8 m/s\n",
        "The intrinsic impedance of the medium is 217.6 ohm\n",
        "The peak value of the magnetic intensity is 2.76 *10**-2 A/m\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}