{
 "metadata": {
  "name": "",
  "signature": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 17, Electromagnetic waves"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1, page 550"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from __future__ import division\n",
      "from numpy import pi\n",
      "# magnitude\n",
      "#given data :\n",
      "R=7*10**8 # in m\n",
      "P=3.8*10**26 # in Watt\n",
      "S=P/(4*pi*R**2) \n",
      "print \"Magnitude of poynting vector, S = %0.3e W/m^2 \" %S"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Magnitude of poynting vector, S = 6.171e+07 W/m^2 \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2, page 551"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# Poynting vector\n",
      "#given data :\n",
      "R=1.5*10**11 # in m\n",
      "P=3.8*10**26 # in Watt\n",
      "S=P/(4*pi*R**2) # in W/m**2\n",
      "Se=round(S*60/(4.2*10**4)) \n",
      "print \"Poynting vector, Se = %0.2f cal/cm^2-m \" %Se"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Poynting vector, Se = 2.00 cal/cm^2-m \n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3, page 560"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import sqrt\n",
      "# Amplitude and magnetic field\n",
      "#given data :\n",
      "S=2 # in cal/cm**2- min\n",
      "EH=S*4.2*10**4/60 # joule/m**2 sec\n",
      "mu0=4*pi*10**-7 \n",
      "epsilon0=8.85*10**-12 \n",
      "EbyH=sqrt(mu0/epsilon0) \n",
      "E=sqrt(EH*EbyH) \n",
      "H=EH/E \n",
      "E0=E*sqrt(2) \n",
      "H0=H*sqrt(2) \n",
      "print \"E = %0.2f V/m \"%E\n",
      "print \"H  = %0.3f Amp-turn/m \"%H\n",
      "print \"Amplitude of electric fields of radiation, E0 = %0.f V/m  \" %E0\n",
      "print \"Magnetice field of radition, H0 = %0.2f Amp-turn/m \" %H0"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "E = 726.32 V/m \n",
        "H  = 1.928 Amp-turn/m \n",
        "Amplitude of electric fields of radiation, E0 = 1027 V/m  \n",
        "Magnetice field of radition, H0 = 2.73 Amp-turn/m \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4, page 560"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from numpy import pi\n",
      "# electric and magnetic field\n",
      "#given data :\n",
      "r=2 # in m\n",
      "mu0=4*pi*10**-7 \n",
      "epsilon0=8.85*10**-12 \n",
      "EbyH=sqrt(mu0/epsilon0) \n",
      "EH=1000/(4*r**2*pi**2) # in W/m**2\n",
      "E=sqrt(EH*EbyH) \n",
      "H=(EH/E) \n",
      "print \"Intensities of electric, E = %0.2f V/m\" %E\n",
      "print \"Magnetic field of radiation, H = %0.4f Amp-turn/m  \" %H"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Intensities of electric, E = 48.85 V/m\n",
        "Magnetic field of radiation, H = 0.1296 Amp-turn/m  \n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5, page 593"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import degrees, pi, asin, sin, tan\n",
      "# Degree of polarization\n",
      "#given data :\n",
      "thetai=45 # in degree\n",
      "n=1.5 #/ index\n",
      "thetar=asin(sin(thetai*pi/180)/n) # radian\n",
      "thetar= degrees(thetar)\n",
      "Rl=sin((thetai-thetar)*pi/180)**2/sin((thetai+thetar)*pi/180)**2 \n",
      "Rp=tan(thetai-thetar*pi/180)**2/tan((thetai+thetar)*pi/180)**2 \n",
      "D=((Rl-Rp)/(Rl+Rp))*100 \n",
      "print \"Degree of polarization, D = %0.2f %%\" %D\n",
      "# answer is wrong in the textbook"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Degree of polarization, D = 49.44 %\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6, page 594"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Frequency\n",
      "#given data :\n",
      "Del=1 # in m\n",
      "mu=4*pi*10**-7 # in H/m\n",
      "sigma=4 # in siemen/m\n",
      "v=1*10**-3/(pi*Del**2*mu*sigma) \n",
      "print \"Frequency, v = %0.1f kHz \" %v"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Frequency, v = 63.3 kHz \n"
       ]
      }
     ],
     "prompt_number": 16
    }
   ],
   "metadata": {}
  }
 ]
}