import math
#Given:
c = 3*10**10 #in cm/s
a = 4 #in cm
b = 2.5 #in cm
f = 10*10**9 #in Hz
d = 0.1 #distance between 2 minimum power points(in cm)
#calculations
#For TE10 mode:
wl_c = 2*a
wl_o = c/f
wl_g = wl_o/math.sqrt(1-(wl_o/wl_c)**2)
S = wl_g/(math.pi*d)
#---output---#
print 'Voltage standing wave ratio =',round(S,4)
import math
#Given:
P_i = 300 #in mW
P_r = 10 #in mW
#calculations
p = math.sqrt(P_r/P_i)
S = (1+p)/(1-p)
#---output---#
print 'Voltage standing wave ratio =',round(S,4)
import math
#Given:
P_i = 2.5 #in mW
P_r = 0.15 #in mW
#---output---#
p = math.sqrt(P_r/P_i)
S = (1+p)/(1-p)
print 'Voltage standing wave ratio =', round(S,4)
import math
#Given:
P_i=4.5 #in mW
S=2. #VSWR
C=30. #in dB
#calculations
p=(S-1)/(S+1)
P_f=P_i/(10**(C/10))
P_r=p**2*P_i
#---output---#
print 'Reflected power (in watts) =',P_r