# Chapter6:ELECTROMAGNETICS¶

## Eg1:pg-206¶

In :
import math
r=1     #radius in meter
H=2     #magnitude of field vector in amp/meter
pi=1    #let
I=H*2*pi*r
print"Current in the wire is %d*pi amp"%I

Current in the wire is 4*pi amp


## Eg5:pg-212¶

In :
import math
sigma=1e-4           #conductivity in siemen/m
Er=2.25              #relative permittivity
E0=1/(4*math.pi*9e9) #permittivity of free space
#E=5e-6*sin(9e9*t) is the electric field in the material volt/m (given)
#J= sigma*E = 1e-4*5e-6*sin(9e9*t)= 5e-10sin(9e9*t)is Conduction current density in A/m**2
#d(E)/dt= 5e-6*9e9*cos(9e9*t)
#Jd=E0*Er*(d(E)/dt) is Displacement current density in A/m**2
print"Conduction current density is %s*sin(9e9*t) A/m**2"%(sigma*5e-6)
print"Displacement current density is %s*cos(9e9*t) A/m**2"%round((E0*Er*5e-6*9e9),9)

Conduction current density is 5e-10*sin(9e9*t) A/m**2
Displacement current density is 8.95e-07*cos(9e9*t) A/m**2


## Eg13:pg-236¶

In :
import math
H0=1    #magnitude of field vector in amp/meter
mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m
e0=8.85e-12   #permittivity of free space in F/m
E0=H0*math.sqrt(mu_0/e0)
print"Magnitude of electric field for plane wave in free space is ",round(E0,2),"V/m"

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


## Eg14:pg-236¶

In :
import math
E0=1e2    #maximum electric field in plane electromagnetic wave in Newton/coul.
c=3e8     #speed of light in m/sec
B0=E0/c
print"Maximum magnetic field is ",round(B0,9),"Tesla"
print"Maximum magnetic field will be in Z-direction."#this part is not printed in answer in book

Maximum magnetic field is  3.33e-07 Tesla
Maximum magnetic field will be in Z-direction.


## Eg15:pg-236¶

In :
import math
S=2*4.2e4/60   #energy flux per unit area per second at the earth surface
mu_0=4*round(math.pi,2)*1e-7  #permeability of free space in H/m
e0=8.85e-12    #permittivity of free space in F/m
EH=S
E_div_H=math.sqrt(mu_0/e0)
E=math.sqrt(E_div_H*EH)
H=EH/E
E0=round(E,1)*round(math.sqrt(2.),3)
H0=H*math.sqrt(2.)
print"Amplitude of electric field is ",round(E0,1),"V/m"
print"Amplitude of magnetic field is ",round(H0,3),"A-turn m-1"

Amplitude of electric field is  1026.8 V/m
Amplitude of magnetic field is  2.726 A-turn m-1


## Eg16:pg-236¶

In :
import math
P0=1000   #power in watt
r=2       #distance in meter
Sav=P0/(4*round(math.pi,2)*r**2)
mu_0=4*round(math.pi,2)*1e-7   #permeability of free space in H/m
e0=8.85e-12   #permittivity of free space in F/m
EH=Sav
E_div_H=math.sqrt(mu_0/e0)
E=math.sqrt(E_div_H*EH)
H=EH/E
print"Average value of electric field intensity is ",round(E,2),"V/m"
print"Average value of magnetic field intensity is ",round(H,2),"A-turn m-1"

Average value of electric field intensity is  86.59 V/m
Average value of magnetic field intensity is  0.23 A-turn m-1


## Eg17:pg-237¶

In :
import math
S=1.38      #energy flux in KW/m**2
c=3e8       #speed of light in m/sec
mu_0=4*math.pi*1e-7   #permeability of free space in H/m
E0=math.sqrt(2*mu_0*c*S*1e3)
B0=E0/c
print"Peak value of electric field is ",round(E0*1e-3,2),"KV/m"
print"Peak value of magnetic field is ",round(B0,7),"Wb/m**2"

Peak value of electric field is  1.02 KV/m
Peak value of magnetic field is  3.4e-06 Wb/m**2


## Eg18:pg-237¶

In :
import math
E0=100      #in Newton/coul.
A=1e-3      #area in m**2
l=100       #length in cm
e0=8.85e-12 #permittivity of free space in F/m
V=A*l*1e-2
U=e0*E0**2*V/2
print"Energy contained in cylinder is ",U,"Joule"

Energy contained in cylinder is  4.425e-11 Joule


## Eg19:pg-238¶

In :
import math
E0=0.05   #amplitude of electric field strength in V/m
v=6       #frequency in MHz
c=3e8     #speed of light in m/sec
mu_0=4*math.pi*1e-7 #permeability of free space in H/m
e0=8.85e-12         #permittivity of free space in F/m
T=round(1/(v*1e6),9)
lamda=c/(v*1e6)
H0=E0/math.sqrt(mu_0/e0)
Sx_av=E0*round(H0,6)/2
print"E=",E0,"*sin(","{:.2e}".format(2*math.pi/T),"t -",(2*round(math.pi,2)/lamda),"x) V/m"
print"H=","{:.2e}".format(H0),"*sin(","{:.2e}".format(2*math.pi/T),"t -",(2*round(math.pi,2)/lamda),"x) A/m"
print"B=",round(E0/c,12),"*sin(","{:.2e}".format(2*math.pi/T),"t -",(2*round(math.pi,2)/lamda),"x) Wb/m**2"
print"Average poynting vector S=",Sx_av,"Wb/m**2"

E= 0.05 *sin( 3.76e+07 t - 0.1256 x) V/m
H= 1.33e-04 *sin( 3.76e+07 t - 0.1256 x) A/m
B= 1.67e-10 *sin( 3.76e+07 t - 0.1256 x) Wb/m**2
Average poynting vector S= 3.325e-06 Wb/m**2


## Eg20:pg-239¶

In :
import math
lamda=7   #wavelength in mm
E0=42     #maximum magnitude of electric field in V/m
c=3e8     #speed of light in m/sec
print"E=",E0,"*sin(2*pi*(ct-x)/",lamda,") V/m"
print"B=",E0/c,"*sin(2*pi*(ct-x)/",lamda,") Wb/m**2 \nThe magnetic field is along Z-axis."
#unit is not mentioned in answer in book

E= 42 *sin(2*pi*(ct-x)/ 7 ) V/m
B= 1.4e-07 *sin(2*pi*(ct-x)/ 7 ) Wb/m**2
The magnetic field is along Z-axis.


## Eg21:pg-239¶

In :
import math
er=81  #relative permittivity of distilled water
e0=1   #let, permittivity of free space
mu_0=1 #let, permeability of free space
e=e0*er
c=3e8  #speed of light in m/sec
mu=mu_0#for distilled water
MU=math.sqrt((mu*e)/(mu_0*e0))
v=c/MU
print"Refractive index is ",MU
print"Velocity of light in distilled water is ","{:.2e}".format(v),"m/s"

Refractive index is  9.0
Velocity of light in distilled water is  3.33e+07 m/s


## Eg23:pg-241¶

In :
import math
E0=7.5     #electric field intensity in KV/m
w=2e9      #angular frequency in rad/sec
c=3e8      #speed of light in m/sec
mu_0=4*round(math.pi,2)*1e-7 #permeability of free space in H/m
e0=8.85e-12                  #permittivity of free space in F/m
f=w/(2*round(math.pi,2))
lamda=c/f
T=1/f
H0=E0*1e3/math.sqrt(mu_0/e0)
print"Wavelength is ",lamda,"m"
print"Frequency is ",round(f*1e-6,1),"MHz"
print"Time period is ",T,"sec"
print"Amplitude of magnetic field intensity is ",round(H0,2),"A/m"
print"Therefore, Hz=",round(H0,2),"*cos( (%.e*t)-(beta*x)) A/m"%w#unit is not printed in book

Wavelength is  0.942 m
Frequency is  318.5 MHz
Time period is  3.14e-09 sec
Amplitude of magnetic field intensity is  19.91 A/m
Therefore, Hz= 19.91 *cos( (2e+09*t)-(beta*x)) A/m


## Eg24:pg-241¶

In :
import math
mu_0=4*math.pi*1e-7  #permeability of free space in H/m
e0=8.854e-12         #permittivity of free space in F/m
#E=45*sin(6e8*pi*t-(2*pi*x))j+15*cos(6e8*pi*t-(2*pi*x))k  volt/m   (given equation)
#E=Ey*sin((w*t)-(beta*x))j + Ez*cos((w*t)-(beta*x))k   (standard form)
#compairing given equation with above equation
pi=1      #let
beta=2*pi
w=6e8*pi
f=w/(2*pi)
n0=math.sqrt(mu_0/e0)
print"Phase constant is %d*pi rad/s"%beta
print"Angular frequency is %.e*pi rad/s"%w
print"Frequency is %.e Hz"%f
print"Intrinsic impedance is %d Ohm"%round(n0)
print"Magnetic field is [0  %s*cos(6*pi*10**8*t-(2*pi*x))  %s*sin(6*pi*10**8*t-(2*pi*x))] A/m"%(round(15/n0,4),round(45/n0,3))  #unit is not printed in book

Phase constant is 2*pi rad/s
Angular frequency is 6e+08*pi rad/s
Frequency is 3e+08 Hz
Intrinsic impedance is 377 Ohm
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


## Eg25:pg-242¶

In :
from sympy import symbols,diff,cos,sin
import math
x,y,B,Y=symbols('x y B Y')
Hz=(6*x*cos(B))+(12*y*sin(Y))
a=diff(Hz,y)
b=diff(-Hz,x)
c=0
d=array([a,b,c])
print"J =", d

J = [12*sin(Y) -6*cos(B) 0]


## Eg26:pg-244¶

In :
import math
A=1.3   #area in m**2
t=3     #time in hours
S=1.1   #intensity of sun rays in KW/m**2
c=3e8   #speed of light in m/sec
p=A*(t*3600)*(S*1000)/c
print"Momentum is %se-4 Kg-m/s"%(p*10000)

Momentum is 514.8e-4 Kg-m/s


## Eg27:pg-245¶

In :
import math
S=10      #energy flux in watt/m**2
A=1       #area in m**2
t=1       #time in hour
c=3e8     #speed of light in m/sec
p=2*S*A*(t*3600)/c
F=2*S*A/c
print"Momentum is %.1e Kg-m/s"%p
print"Force is %.2e N"%F

Momentum is 2.4e-04 Kg-m/s
Force is 6.67e-08 N


## Eg29:pg-251¶

In :
import math
mu=4*math.pi*1e-7  #permeability in H/m
f=71.6             #frequency in MHz
sigma=3.54e7       #conductivity in siemens/m
d=1/sqrt(math.pi*f*1e6*mu*sigma)
print"Depth of penetration is ",int(round(d*1e6)),"micro meter"

Depth of penetration is  10 micro meter


## Eg30:pg-251¶

In :
import math
f=3e6    #frequency in Hz
mu_r=1
mu_0=4*round(math.pi,2)*1e-7  # in H/m
sigma=38e6                    # in S/m
mu=mu_r*mu_0
d=1/math.sqrt(round(math.pi,2)*f*mu*sigma)
alpha=1/(d)
beta=alpha
magnitude=math.sqrt(alpha**2+beta**2)
angle=math.degrees(math.atan(beta/alpha))
v=2*round(math.pi,2)*f/round(beta)
print"Skin depth is ",round(d*1e3,5),"mm"
print"Propagation constant =[ %.4e , %s degree] m**-1"%(magnitude,int(angle)) #in polar form
print"Wave velocity is ",round(v,2),"m/s"

Skin depth is  0.04716 mm
Propagation constant =[ 2.9987e+04 , 45 degree] m**-1
Wave velocity is  888.51 m/s


## Eg31:pg-252¶

In :
import math
mu=4*math.pi*1e-7   # in H/m
e0=8.854e-12        # in F/m
e=70*e0
sigma=5
d=(2./sigma)*math.sqrt(e/mu)
alpha=1/round(d,4)
print"skin depth is ",round(d,4),"m"
print"Attenuation constant is ",round(alpha,2),"Np/m"

skin depth is  0.0089 m
Attenuation constant is  112.36 Np/m


## Eg32:pg-253¶

In :
import math
import cmath
sigma=2e-3    #in S/m
e0=8.854e-12  #in F/m
e=80*e0
f=10          #in KHz
mu=4*math.pi*1e-7  #in H/m
ratio=sigma/(2*round(math.pi,2)*f*1e3*e)

#since ratio= sigma/(w*e) = 44.96 >>1,therefore, medium is a good conductor.
#So calculations will be done considering medium as a good conductor.

alpha=math.sqrt(2*math.pi*f*1e3*mu*sigma/2)
beta=int(alpha*1e5)*1e-5
magnitude=math.sqrt(alpha**2+beta**2)
angle=math.degrees(math.atan(beta/alpha))
ni=round(round(math.sqrt(2*math.pi*f*1e3*mu/sigma),2)/round(math.sqrt(2),2),3)*(1+1j)
lamda=2*round(math.pi,2)/beta
v=2*math.pi*f*1e3/beta
print"Attenuation constant is %.2e neper/m"%(int(alpha*1e5)*1e-5)
print"Phase constant is %.2e rad/m"%beta
print"Propagation constant = [ %.3e , %.f degree] m**-1"%(magnitude,angle)#in polar form(unit is not printed in book)
print"Intrinsic impedance is ",ni,"ohm"
print"Wavelength is %.2f m"%lamda
print"Velocity of wave is %.2e m/s"%v

Attenuation constant is 8.88e-03 neper/m
Phase constant is 8.88e-03 rad/m
Propagation constant = [ 1.256e-02 , 45 degree] m**-1
Intrinsic impedance is  (4.454+4.454j) ohm
Wavelength is 707.21 m
Velocity of wave is 7.08e+06 m/s


## Eg33:pg-254¶

In :
import math
f=100      #in MHz
mu_r=1
mu_0=4*round(math.pi,2)*1e-7  #in H/m
mu=mu_0*mu_r
sigma=58e6                    #in S/m
alpha=math.sqrt(round(math.pi,2)*f*1e6*mu*sigma)
alpha=int(alpha/10)*10
beta=alpha
magnitude=math.sqrt(alpha**2+beta**2)
angle=math.degrees(math.atan(beta/alpha))
sqrt_j=45
ni=sqrt(2*round(math.pi,2)*f*1e6*mu/sigma)
v=2*round(math.pi,2)*f*1e6/beta
print"Attenuation constant is %.4e neper/m"%(int(alpha*1e5)*1e-5)
print"Phase constant is %.4e rad/m"%beta
print"Propagation constant = [ %.4e , %.f degree] m**-1"%(magnitude,angle)#in polar form(unit is not printed in book)
print"Intrinsic impedance = [ %.3e , %s degree ] ohm"%(ni,sqrt_j)#in polar form(unit is not printed in book)
print"Velocity of wave is %.3f Km/s"%(v/1e3)

Attenuation constant is 1.5124e+05 neper/m
Phase constant is 1.5124e+05 rad/m
Propagation constant = [ 2.1389e+05 , 45 degree] m**-1
Intrinsic impedance = [ 3.688e-03 , 45 degree ] ohm
Velocity of wave is 4.152 Km/s


## Eg34:pg-255¶

In :
import math
mu=4*math.pi*1e-7  #in H/m
sigma=3.54e7       #in S/m
d=0.0664           #penetration depth in mm
f=1/(math.pi*mu*sigma*(d*1e-3)**2)
print"Frequency is %.2f MHz"%(f/1e6)
#answer is wrong in book because d=0.0644 is taken in calculation which is wrong(given d=0.0664 mm)

Frequency is 1.62 MHz