#Calculate minimum distance between two plates
import math
#Variable declaration
a = 3 #radius of circular waveguide(cm)
fo = 10*10**9 #frequency for TM011 mode(Hz)
P01 = 2.405
c = 3*10**10 #velocity of proapagation(m/s)
#Calculation
d = math.sqrt((math.pi**2)/(((4*math.pi**2)/9)-((P01/a)**2)))
#Result
print "The minimum distance between two plates is",round(d,2),"cms"
#Calculate lowest resonating frequency of a circular resonator
a = 2.
b = 1.
d = 3.
#For dominant mode TE101,
m = 1.
n = 0
p = 1.
c = 3*10**10 #velocity of propagation(m/s)
#Calculation
fo = (c/2)*(((m/a)**2+(n/b)**2+(p/d)**2))**0.5
#Result
print "The lowest resonating frequency of a rectangular cavity resonator is",round((fo/1E+9)),"Ghz"
#Calculate resonating frequency of a circular resonator
import math
#Variable declaration
D = 12.5 #diameter of resonator(cm)
d = 5 #length of resonator(cm)
P01 = 2.405 #dominant mode TM01
c = 3*10**10 #velocity of propagation(m/s)
#For TM012 mode,
m = 1
n = 0
p = 2
#Calculation
a = D/2
fo = (c/(2*math.pi))*((P01/a)**2+((p*math.pi)/d)**2)**0.5
#Result
print "The resonanat frequency of a circular resonator is",round((fo/1E+9),2),"GHz"
#Calculate lowest resonating frequency of a circular resonator
a = 3.
b = 2.
d = 4.
#For dominant mode TE101,
m = 1.
n = 0
p = 1.
c = 3*10**10 #velocity of propagation(m/s)
#Calculation
fo = (c/2)*(((m/a)**2+(n/b)**2+(p/d)**2))**0.5
#Result
print "The lowest resonating frequency of a circular resonator is",round((fo/1E+9),2),"Ghz"