Chapter 4: Electromagnetic Fields and Waves

Example 4.3, Page 112

In [1]:
import math

#Variable declaration
Eo=8.854*10**-12
uo=4*math.pi*10**-7

#Calculations
W=2/math.sqrt(uo*Eo)

#Result
print "W=%.e rad/s"%W
W=6e+08 rad/s

Example 4.4, Page 113

In [8]:
import math
import scipy
from scipy.integrate import dblquad

#Calculations
def f(x,y):
    return ((math.cos((math.pi/2)*math.cos(x*math.pi/180)*math.pi/180)**2)*60*math.pi)/math.sin(x*math.pi/180)
r,e = scipy.integrate.dblquad(f,0,math.pi,lambda x:0,lambda x:2*math.pi)

#Result
print "The radiated power is %.1f kW"%(r/1000)
#Answer differs due to use of python libraries
The radiated power is 1413.0 kW

Example 4.5, Page 116

In [9]:
import math

#Variable declaration
B=2*math.pi
C=3*10**8    #m/s

#Calculations
lamda=2*math.pi/B   #m
f=C/lamda           #Hz
W=2*math.pi*f
uo=4*math.pi*10**-7
k=2*math.pi
n=W*uo/k

#Results
print "(a)lambda=%.0f m\n(b)f=%.0f MHz\n(c)n=%.4f ohm"%(lamda,f*10**-6,n)
(a)lambda=1 m
(b)f=300 MHz
(c)n=376.9911 ohm

Example 4.6, Page 116

In [10]:
import math

#Variable declaration
uo=1.2567*10**-6
f=10**4        #Hz
W=2*math.pi*f
a=4            #S/m

#Calculations
k=complex(math.sqrt(W*uo*a/2),math.sqrt(W*uo*a/2))
B=k.real
a=k.imag
lamda=2*math.pi/B   #m
Vp=W/B
delta=1/a

#Results
print "k=",k,"m^-1"
print "lambda=%.4f m\nVp=%.4e m/s\ndelta=%.4f m"%(lamda,Vp,delta)
k= (0.397393481968+0.397393481968j) m^-1
lambda=15.8110 m
Vp=1.5811e+05 m/s
delta=2.5164 m

Example 4.7, Page 118

In [11]:
import math

#Variable declaration
ky=6
kz=8

#Calculations&Results
kr=math.sqrt(ky**2+kz**2)
print "kr=%.0f m^-1"%kr

#(a)
O=180/math.pi*math.asin(ky/kr)
theta=(180-O)*math.pi/180
Vr=3*10**8   #m/s
print "(a)\ntheta=%.2f degree"%O

#(b)
lr=2*math.pi/kr
ly=2*math.pi/ky
lz=2*math.pi/kz
print "(b)\nlr=%.4f m\nly=%.4f m\nlz=%.4f m"%(lr,ly,lz)

#(c)
W=Vr*kr
f=W/lr
Vpy=W/ky
Vpz=W/kz
print "(c)\nW=%.0e rad/s\nf=%.2e Hz\nVpy=%.1e m/s\nVpz=%.2e m/s"%(W,f,Vpy,Vpz)

#(d)
Ver=3*10**8   #m/s
Vey=Ver*math.sin(theta)
Vez=Ver*math.cos(theta)
print "(d)\nVey=%.1e m/s\nVez=%.1e m/s"%(Vey,Vez)
kr=10 m^-1
(a)
theta=36.87 degree
(b)
lr=0.6283 m
ly=1.0472 m
lz=0.7854 m
(c)
W=3e+09 rad/s
f=4.77e+09 Hz
Vpy=5.0e+08 m/s
Vpz=3.75e+08 m/s
(d)
Vey=1.8e+08 m/s
Vez=-2.4e+08 m/s

Example 4.10, Page 125

In [1]:
import math

#Variable declaration
Er=2.25
ur=1
W=10**9
p=0.2
uo=4*math.pi*10**-7
Eo=8.854*10**-12

#Calculations
ko=W*math.sqrt(uo*Eo)  #rad/m
k2=W*math.sqrt(uo*Eo*Er) #rad/m
n1=math.sqrt(uo/Eo)     #ohm
n2=math.sqrt(uo/Eo/Er)  #ohm
R=(n2-n1)/(n1+n2)
T=2*n2/(n1+n2)
VSWR=(1+p)/(1-p)
Pav=3.84**2/(2*n2)

#Results
print "ko=%.4f rad/m\nk2=%.4f rad/m\nn1=%.4f ohm\nn2=%.4f ohm\nR=%.2f\nT=%.2f \nVSWR=%.2f\nPav=%.4f W/m^2"%(ko,k2,n1,n2,R,T,VSWR,Pav)
ko=3.3356 rad/m
k2=5.0034 rad/m
n1=376.7343 ohm
n2=251.1562 ohm
R=-0.20
T=0.80 
VSWR=1.50
Pav=0.0294 W/m^2

Example 4.11, Page 135

In [13]:
import math

#Variable declaration
qo=2.5*10**-2

#Calculations&Results
for m in range(1,5):
    fc=3*10**8*m/(9*10**-2)
    qc=2*4.5*10**-2/m
    print "m=%d\nfc=%.4e Hz\nlambdaC=%.2e m"%(m,fc,qc)
    print "TM0=%.4e Hz"%fc
    q=qo/math.sqrt(abs(1-(qo/qc)**2))
    print "lambda=%.4f m\n"%(q*10**2)

print "Since cut-off frequqency for TM40 is higher than signal frequency, the TM40 mode will not exist"
m=1
fc=3.3333e+09 Hz
lambdaC=9.00e-02 m
TM0=3.3333e+09 Hz
lambda=2.6024 m

m=2
fc=6.6667e+09 Hz
lambdaC=4.50e-02 m
TM0=6.6667e+09 Hz
lambda=3.0067 m

m=3
fc=1.0000e+10 Hz
lambdaC=3.00e-02 m
TM0=1.0000e+10 Hz
lambda=4.5227 m

m=4
fc=1.3333e+10 Hz
lambdaC=2.25e-02 m
TM0=1.3333e+10 Hz
lambda=5.1619 m

Since cut-off frequqency for TM40 is higher than signal frequency, the TM40 mode will not exist

Example 4.12, Page 142

In [14]:
import math

#Variable declaration
a=0.0158     #m
b=0.0079     #m
f=15.8*10**9  #Hz

#Calculations&Results
#TE10
m=1.
n=0
fc=3*10**8*math.sqrt((m/2/a)**2+(n/2/b)**2)
print "(a)\nfor TE10 \n\tfc=%.4f GHz"%(fc*10**-9)
Vp=3*10**8/math.sqrt(1-(fc/f)**2)

#TE20
m=2.
n=0
fc=3*10**8*math.sqrt((m/2/a)**2+(n/2/b)**2)
print "for TE20 \n\tfc=%.4f GHz"%(fc*10**-9)

#TE01
m=0
n=1.
fc=3*10**8*math.sqrt((m/2/a)**2+(n/2/b)**2)
print "for TE01 \n\tfc=%.4f GHz"%(fc*10**-9)
#TE11
m=1.
n=1.
fc=3*10**8*math.sqrt((m/2/a)**2+(n/2/b)**2)
print "for TE11 \n\tfc=%.4f GHz"%(fc*10**-9)
print "(c)\nVp=%.4e m/s"%Vp
(a)
for TE10 
	fc=9.4937 GHz
for TE20 
	fc=18.9873 GHz
for TE01 
	fc=18.9873 GHz
for TE11 
	fc=21.2285 GHz
(c)
Vp=3.7530e+08 m/s