import math
V_o = 14.5*10**3 #in volts
I_o = 1.4 #in A
f = 10*10**9 #in Hz
p_o = 10**-6 #in c/m**3
p = 10**-8 #in c/m**3
v = 10**5 #in m/s
R = 0.4
#calculations
v_o = 0.593*10**6*math.sqrt(V_o)
k = 2*math.pi*f/v_o
w_p = (1.759*10**11*(10**-6/(8.854*10**-12)))**0.5
w_q = R*w_p
J_o = p_o*v_o
J = p*v_o+p_o*v
#---output---#
print 'Dc electron velocity (in m/s) =',round(v_o,4)
print 'Dc phase constant (in rad/s) =',round(k,4)
print 'Plasma frequency (in rad/s) =',round(w_p,4)
print 'Reduced plasma frequency (in rad/s) =',round(w_q,4)
print 'Dc beam current density (in A/sq. m) =',round(w_q,4)
print 'Instantaneous beam current density(in A/sq. m) =',round(w_q,4)
#Answer in book are wrongly written as: (Dc phase constant =1.41* 10**8 rad/sec)
import math
A_v = 15 #in dB
P_i = 5*10**-3 #in W
R_sh_i = 30000 #in ohms
R_sh_o = 40000 #in ohms
R_l = 20000 #in ohms
#calculations
V_i = math.sqrt(P_i*R_sh_i)
V_o = 10**((A_v/20))*12.25
P_out = V_o**2/R_l
#---output---#
print 'Input rms voltage (in volts) =',round(V_i,4)
print 'Output rms voltage (in volts) =',round(V_o,4)
print 'Power delivered to load (in watts) =',round(P_out,4)
import math
n = 2
V_o = 300 #in volts
I_o = 20*10**-3 #in A
V_i = 40 #in volts
J = 1.25 #J(X')
#calculations
P_dc = V_o*I_o
P_ac = 2*V_o*I_o*J/(2*n*math.pi-math.pi/2)
eff = (P_ac/P_dc)*100
#---output---#
print 'Input power (in watts) =',P_dc
print 'Output power (in watts) =',round(P_dc,4)
print 'Efficiency (in percent) =',round(eff,4)
import math
V_o = 900 #in volts
I_o = 30*10**-3 #in A
f = 8*10**9 #in Hz
d = 0.001 #in m
l = 0.04 #in m
R_sh = 40*10**3 #in ohm
#calculations
v_o = 0.593*10**6*math.sqrt(V_o)
T_o = l/v_o
Theeta_o = (2*math.pi*f)*T_o #Transit angles between cavities(in radian)
Theeta_g = (2*math.pi*f)*d/v_o #Average gap transit angle (in radian)
b = math.sin(Theeta_g/2)/(Theeta_g/2)
V_in_max = V_o*3.68/(b*Theeta_o)
#As, {J(X)/X=0.582}
A_r = b**2*Theeta_o*0.582*R_sh/(30*10**3*1.841)
#---output---#
print 'Electron velocity (in m/s) =',round(v_o,4)
print 'Dc Transit Time (in sec)=',round(T_o,4)
print 'Maximum input voltage (in volts) =',round(V_in_max,4)
print 'Voltage gain (in dB) =',round(A_r,4)
import math
V_o = 1200 #in volts
I_o = 28*10**-3 #in A
f = 8*10**9 #inHz
d = 0.001 #in m
l = 0.04 #in m
R_sh = 40*10**3 #in ohms
Beeta_o = 0.768
J = 0.582 #J(X)
G_o = 23.3*10**-6
#calculations
V_p_max = 1200*3.68*0.593*10**6*math.sqrt(V_o)/(2*math.pi*f*l)
Theeta_g = (2*math.pi*f)*d/(0.593*10**6*math.sqrt(V_o)) #transit angle (in rad)
beeta = math.sin(Theeta_g/2)/(Theeta_g/2)
V_i_max = V_p_max/beeta
A_v = (Beeta_o)**2*97.88*J*R_sh/(1200/(28*10**-3*1.841)) #calculating voltage gain
eff = (0.58*(2*28*10**-3*J*Beeta_o*R_sh)/V_o)*100 #calculating efficiency
G_b = (G_o/2)*(Beeta_o**2-Beeta_o*math.cos(Theeta_g)) #beam loading conducmath.tance
R_b = 1/(G_b*1000) #beam loading resistance(in kilo ohms)
#---output---#
print 'Input microwave voltage(in volts) =',round(V_i_max,4)
print 'Voltage gain =',round(A_v,4)
print 'Effeciency of amplifier (in percentage) =',round(eff,4)
print 'Beam loading resistance(in kilo ohms) =',round(R_b,4)
#Answer in book is wrongly given as: Voltage gain =17.034
import math
e_m_ratio = 1.759*10**11 #(e/m)
V_o = 500 #in volts
R_sh = 20*10**3 #in ohms
f = 8*10**9 #inHz
n = 2 #mode
L = 0.001 #spacing between repeller & cavity (in m)
x = 0.023
Beeta_o = 1 #Assuming
J = 0.582
V_1 = 200 #given (in volts)
j = 0.84 #J(X')
#calculations
w = 2*math.pi*f
volt_diff = math.sqrt(V_o*(x))
V_r = volt_diff+V_o #repeller volatge
I_o = V_1/(R_sh*2*J)
Theeta_o = 2*math.pi*f*J*10**6*2*10**-3*math.sqrt(V_o)/(1.579*10**11*(V_r+V_o))
X = V_1*Theeta_o/(2*V_o) #X'
eff = (2*j/(2*math.pi*2-math.pi/2))*100
#---output---#
print 'Repeller voltage(in volts) =',round(V_r,4)
print 'Necessary beam current (in Amp.s) =',round(I_o,4)
print 'Effeciency (in percentage) =',round(eff,4)
import math
P_dc_in = 40 #in mW
ratio = 0.278 #V_1/V_o;
n = 1
J=2.35
#calculations
X=ratio*(2*n*math.pi-math.pi/2)
eff=ratio*J*100 #in percentage
P_out= 8.91*P_dc_in/100
P_load=3.564*80/100
#---output---#
print 'Effeciency (in percentage) =',round(eff,4)
print 'Total power output (in mW) =',round(P_out,4)
print 'Power delivered to load (in mW) =',round(P_load,4)
import math
e_m_ratio = 1.759*10**11 #(e/m)
R_a = 0.15 #in m
R_o = 0.45 #in m
B_o = 1.2*10**-3 #in weber/m**2
V = 6000 #in volts
#calculations
V_o = ((e_m_ratio)*B_o**2*R_o**2*(1-(R_a/R_o)**2)**2)/8
B_c = math.sqrt(8*V/e_m_ratio)/((1-(R_a/R_o)**2)*(R_o)) #in weber/m**2
w_c = (e_m_ratio)*B_o
f_c = w_c/(2*math.pi) #in Hz
#---output---#
print 'Cut-off voltage (in volts) =',round(V_o,4)
print 'Cut-off magnetic flux density (in milli weber/sq. m) =',round(B_c*10**5,4)
print 'Cyclotron frequency (in GHz) =',round(f_c*10**-9,4)
#Answer in book is wrongly given as: f_c=0.336Hz & V_o=50.666 kV
import math
e_m_ratio = 1.759*10**11 #(e/m)
c = 3*10**8 #in m/s
d = 0.002 #diameter(in m)
pitch = (1./50)/100 #As,50 turns per cm (in m)
#calculations
circum = math.pi*d
v_p = c*pitch/circum
V_o = v_p**2/(2*e_m_ratio)
#---output---#
print 'Axial phase velocity (in m/s) =',round(v_p,4)
print 'Anode Voltage (in kV) =',round(V_o,4)
#Answer in book is wrongly given as V_o=25.92 V
import math
V_o = 900 #in volts
I_o = 30*10**-3 #in A
f = 8*10**9 #in Hz
d = 0.001 #in m
l = 0.04 #in m
R_sh = 40*10**3 #in ohm
#calculations
v_o = 0.593*10**6*math.sqrt(V_o)
T_o = l/v_o
Theeta_o = (2*math.pi*f)*T_o #Transit angles between cavities(in radian)
Theeta_g = (2*math.pi*f)*d/v_o #Average gap transit angle (in radian)
b = math.sin(Theeta_g/2)/(Theeta_g/2)
V_in_max = V_o*3.68/(b*Theeta_o)
#As, {J(X)/X=0.582}
A_r = b**2*Theeta_o*0.582*R_sh/(30*10**3*1.841)
#---output---#
print 'Electron velocity (in m/s) =',round(v_o,4)
print 'Dc Transit Time (in sec)=',round(T_o,4)
print 'Maximum input voltage (in volts) =',round(V_in_max,4)
print 'Voltage gain (in dB) =',round(A_r,4)
import math
V_o = 20*10**3 #in volts
I_o = 2 #in A
f = 10*10**9 #in Hz
p_o = 10**-6 #in c/m**3
p = 10**-8 #in c/m**3
v = 10**5 #in m/s
R = 0.5
#calculations
v_o = 0.593*10**6*math.sqrt(V_o)
k = 2*math.pi*f/v_o
w_p = (1.759*10**11*(10**-6/(8.854*10**-12)))**0.5
w_q = R*w_p
J_o = p_o*v_o
J = p*v_o-p_o*v
#---output---#
print 'Dc electron velocity (in m/s) =',round(v_o,4)
print 'Dc phase constant (in rad/s) =',round(k,4)
print 'Plasma frequency (in rad/s) =',round(w_p,4)
print 'Reduced plasma frequency (in rad/s) =',round(w_q,4)
print 'Dc beam current density (in A/sq. m) =',round(J_o,4)
print 'Instantaneous beam current density(in A/sq. m) =',round(J,4)
import math
V_o = 1000 #Anode voltage(in volts)
gap = 0.002 #in m
f = 5*10**9 #in Hz
L = 2.463*10**-3 #length of drift region (in m)
#calculations
u_o = 5.93*10**5*math.sqrt(V_o) #in m/s
Theeta_g = 2*math.pi*f*2*10**-3/u_o #radians
#---output---#
print 'Transit angle(in radians) =',round(Theeta_g,4)
import math
V_o = 1200 #in volts
I_o = 30*10**-3 #in A
f = 10*10**9 #inHz
d = 0.001 #in m
l = 0.04 #in m
R_sh = 40*10**3 #in ohms
#calculations
v_o = 0.593*10**6*math.sqrt(V_o)
Theeta_o = 2*math.pi*f*l/(20.54*10**6)
X = 1.84 #for maximum output power
V_max = 2*X*V_o/122.347
Theeta_g = 122.347*10**-3/(4*10**-2)
Beeta_i = math.sin(Theeta_g/2)/(Theeta_g/2)
V_1_max = V_max/Beeta_i
J = 0.58
Beeta_o = Beeta_i
I_2 = 2*I_o*J
V_2 = Beeta_o*I_2*R_sh
A_v = V_2/V_1_max #in dB
eff = 0.58*(V_2/V_o)*100 #in percentage
#---output---#
print 'Input rf voltage(in volts) =',round(V_1_max,4)
print 'Voltage gain (in dB) =',round(A_v,4)
print 'Maximum efficiency (in percentage) =',round(eff,4)
#Answer in book is wrongly given as: A_v=24.33 dB
import math
e_m_ratio = 1.759*10**11 #(e/m)
a = 0.04
b = 0.08
V_o = 30*10**3 #in volts
I_o = 80 #in A
B_o = 0.01 #in weber/sq.m
#calculations
w=(e_m_ratio)*B_o
V_c=((e_m_ratio)*B_o**2*b**2*(1-(a/b)**2)**2)/8
B_c=math.sqrt(8*V_o/e_m_ratio)/((1-(a/b)**2)*(b)) #in weber/m**2
#---output---#
print 'Cyclotron angular frequency( in rad/s) =',round(w,4)
print 'Cut-off voltage (in volts) =',round(V_c,4)
print 'Cut-off magnetic flux density (in milli weber/sq. m) =',round(B_c*10**3,4)
import math
n = 2.
V_o = 280. #in volts
I_o = 22.*10**-3 #in A
V_i = 30. #in volts
J = 1.25 #J(X')
#calculations
P_dc = V_o*I_o
P_ac = 2*V_o*I_o*J/(2*n*math.pi-math.pi/2)
eff = (P_ac/P_dc)*100
#---output---#
print 'Input power (in watts) =',round(P_dc,4)
print 'Output power (in watts) =',round(P_ac,4)
print 'Efficiency (in percent) =',round(eff,4)
import math
e_m_ratio = 1.759*10**11 #(e/m)
V_o = 300 #in volts
R_sh = 20*10**3 #in ohms
f = 8*10**9 #inHz
#calculations
w = 2*math.pi*f
n = 2 #mode
L = 0.001 #spacing between repeller & cavity (in m)
x = (e_m_ratio)*(2*math.pi*n-math.pi/2)**2/(8*w**2*L**2)
volt_diff = math.sqrt(V_o/(x))
V_r = (volt_diff)+V_o #repeller volatge
J = 0.582
V_1 = 200 #given (in volts)
I_o = V_1/(R_sh*2*J)
#---output---#
print 'Repeller voltage(in volts) =',round(V_r,4)
print 'Necessary beam current (in milliAmp.s) =',round(I_o*10**3,4)