import math
#Given:
a = 3 #in cm
c = 3*10**10 #in cm/s
f = 10*10**9 #in Hz
P_01 = 2.405
#calculations
d = math.pi/math.sqrt(f**2*4*math.pi**2/c**2-(P_01/a)**2)
#output
print 'Minimum distance (in cm) =', round(d,4)
import math
#Given:
c = 3.*10**10 #in cm/s
a = 2. #in cm
b = 1. #in cm
d = 3. #in cm
m = 1.
n = 0
p = 1.
#calculations
f=(c/2)*((m/a)**2+(n/b)**2+(p/d)**2)**0.5
#---output---#
print 'Dominant mode is TE101'
print 'Lowest resonant frequency(in GHz) =',round(f/10**9,4)
import math
#Given:
d = 12.5 #diameter(in cm)
c = 3*10**10 #in cm/s
l = 5 #length(in cm)
#For TM012 mode:
n = 0
m = 1
p = 2
P = 2.405
#calculations
a = d/2
f = (c/(2*math.pi))*((P/a)**2+(p*math.pi/d)**2)**0.5
#---output---#
print 'Resonant frequency (in GHz) =',round(f/10**9,4)
#Answer in book in wrongly given as 6.27GHz
import math
#Given:
c = 3.*10**10 #in cm/s
a = 3. #in cm
b = 2. #in cm
d = 4. #in cm
#For TE101:
m = 1.
n = 0
p = 1.
#calculations
f = (c/2)*((m/a)**2+(n/b)**2+(p/d)**2)**0.5
#---output---#
print 'Resonant frequency(in GHz) =',round(f/10**9,4)