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
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
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)
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)
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)
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)
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"
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