from math import sqrt,pi
from __future__ import division
rp=2*pi*10**6*250*300*10**-9
print "R_p = omega_0 * L * Q =%0.2f kohm"%rp
rs=(2*pi*250)/300
print "R_s = omega_0*L / Q =%0.2f ohm"%rs
from math import sqrt,pi
from __future__ import division
print "From equation 9 we have"
print " BW = 1 / 2*pi*R*C"
rc=1/(2*pi*10*10**3)
print "Therefore, R*C = 1 / 2*pi*BW =%0.2f"%rc
print "From equation 3 we have"
print " R = r_i || R_p || r_b''e"
print "where r_i = 4 k-ohm"
rbe=100/0.04
print "r_b''e = h_fe / g_m =%0.2f ohm"%rbe
print "R_p = Q_c * omega_0 * L = Q_c / omega_0*C"
print "Therefore, R = 4*10**3 || 2500 || Q_c/omega_0*C"
print "C = 1 / 2*pi*10*10**3*R"
print "Therefore, C = 1 / 2*pi*10*10**3*[4*10**3 || 2500 || Q_c/2*pi*500*10**3*C]"
print "The typical range for Q_c is 10 to 150. However, we have to assume Q such that value of C_p should be positive. Let us assume Q = 100"
print "Therefore, C = 1 / 2*pi*10*10**3*[1538.5 || 1/2*pi*5000*C]"
print " = 1 / 2*pi*10*10**3*[1 / 1/1538.5+2*pi*5000*C]"
print "Solving for C we get"
print " C = 0.02 uF"
print "We have"
print " C = C'' + C_b''e + (1+g_m*R_L)*C_b''e"
print "Therefore, C'' = C - [C_b''e + (1+g_m*R_L)*C_b''e]"
c=((0.02*10**-6)-((1000*10**-12)+((1+(0.04*510))*100*10**-12)))*10**6
print "Therefore, C'' = %0.2f uF"%c
print "We have,"
print "omega_0**2 = 1 / L*C"
l=(1/(((2*pi*500*10**3)**2)*(0.02*10**-6)))*10**6
print "Therefore, L = 1 / omega_0**2*C =%0.2f uH"%l
print "From equation 2 we have,"
rp=2*pi*500*5*100*10**-3
print "R_p = omega*L*Q_c =%0.2f ohm"%rp
r=(4000*1570*2500)/((1570*2500)+(4000*2500)+(4000*1570))
print "Therefore, R = r_i || R_p || r_b''e =%0.2f ohm"%r
print "We have mid frequency gain as"
av=-0.04*777
print "A_v(max) = -g_m*R =%0.2f"%av
from math import sqrt,pi
from __future__ import division
print "(i) We know that,"
bw=((20*10**3)*sqrt(((2)**(1/3))-1))*10**-3
print "BW_n = BW_1 * sqrt(2**1/n - 1) =%0.2f kHz"%bw
bw1=((20*10**3)*sqrt(((2)**(1/4))-1))*10**-3
print "(ii) BW_n = BW_1 * sqrt(2**1/n - 1) =%0.2f kHz"%bw1
from math import sqrt,pi
from __future__ import division
print "a) We have,"
print "A_vmid=(-g_m*R)= -15"
r=15/(5*10**-3)
print "Therefore R(in ohms)=(-15)/(-5*10**-3)= %0.2f"%r
print "b) The Miller effect capacitance is given by "
print "C_d = C_gs+(1+g_m*R)*(C_g*d)"
c=(10**-12)+((1+15)*(3*10**-12))
print " = (1*10**-12)+(1+15)*(3*10**-12)=%0.2f F"%c
print "c) The limit frequency of the uncompemsated amplifier is "
f=1/(2*pi*49*3*10**-9)
print "f2 =1/(2*pi*C_d*R)= %0.2f Hz"%f
l=0.414*((3*10**3)**2)*(49*10**-12)
print "d) L =q*C_d*R**2= %0.2f H"%l
print "e) Possible extension of frequency range"
e=1.72*1.08*10**6
print "f''2 =1.72*f2= %0.2f Hz"%e
from math import sqrt,pi
from __future__ import division
print "(i) Resonant frequency:"
fr=(1/(2*pi*sqrt(20*500*10**-18)))*10**-6
print "f_r = 1 / 2*pi*sqrt(LC) =%0.2f MHz"%fr
print "(ii) We know that"
print "Q_r = R_p / omega_r*L"
rp=30*2*pi*1.59*20
print "Therefore, Impedance of tuned circuit R_p = Q_r * omega_r * L =%0.2f"%rp
print "(iii) Voltage gain of stage A_v,"
av=(-50*((5994*1500)/(5994+1500)))/200
print "A_v = A_I*R''_L / R''_i =%0.2f"%av
from math import sqrt,pi
from __future__ import division
print "i) f_r=Resonant frequency"
f=1/((2*pi)*sqrt(0.0004*2500*10**-12))
print "= 1/(2*pi*sqrt(L*C))= %0.2f"%f
print "ii) Tuned circuit dynamic resistance=R_p=L/CR"
r=(80*10**6)/2500
print "= (400 microH)/(2500pF)*(5ohm)= %0.2f"%r
print "iii) Gain at resonance=A_v=(-g_m*R_L)=(-g_m*R_p)"
a=-6*32
print " = 6mA/V * 32kohm = %0.2f"%a
print "iv) The signal bandwidth =BW=(f_r)/Q"
q=(2*pi*0.159*400)/5
print "Q=(omega_r*L)/R= %0.2f"%q
b=159000/79.92
print "BW =(f_r)/Q= %0.2f Hz"%b
from math import sqrt,pi
from __future__ import division
print "(i) R_L = r_d || R_p"
print "R_p = Tank circuit impedance at resonance = L / CR"
print "f_r = 1 / 2*pi*sqrt(L*C)"
c=(1/(4*pi**2*200*1.59**2*10**6))*10**12
print "Therefore, C = 1 / 4*pi**2*f_r**2*L =%0.2f pF"%c
print "Q = omega_r*L / R = 2*pi*f_r*L / R"
r=(2*pi*200*1.59)/50
print "Therefore, R = 2*pi*f_r*L / Q =%0.2f ohm"%r
rf=((200*10**-6)/(50*40*10**-12))*10**-3
print "R_F = L / C*R =%0.2f kohm"%rf
rl=(500*100)/600
print "R_L = r_d*R_p / r_d+R_p =%0.2f kohm"%rl
av=5*83.33
print "A_v = -g_m*R_L = %0.2f at resonance frequency omega_r"%av
print "(ii) At f = f_r+10 kHz = 1.6 MHz"
print "|A_v / A_v(at resonance)| = 1 / sqrt(1+(f/f_r)**2)"
ava=416.67/sqrt(1+((1.6/1.59)**2))
print "Therefore, |A_v| = |A_v(at resonance| / sqrt(1+(f/f_r)**2) =%0.2f"%ava
from math import sqrt,pi
from __future__ import division
fr=1/(2*pi*sqrt(100*1000*10**-18))
print "(i) Resonant frequency f_r = 1 / 2*pi*sqrt(L*C) =%0.2f kHz"%fr
print "(ii) Tank circuit impedance at resonance can be given as"
rp=((100*10**6)/5000)*10**-3
print "R_P = L / C*R =%0.2f kohm"%rp
av=(-5*10**-3)*((500*20*10**3)/(520))
print "(iii) A_v = -g_m*R_L = -g_m*(r_d||R_P) =%0.2f"%av
bw=(5/(2*pi*100*10**-6))*10**-3
print "(iv) BW = f_r/Q"
print " BW = f_r*R / omega_r*L Therefore, Q = omega_r*L / R"
print " BW = R / 2*pi*L =%0.2f kHz"%bw
from math import sqrt,pi
from __future__ import division
print "BW = f_r / Q"
q=10700/200
print "Therefore, Q = f_r / BW =%0.2f"%q
print "Q = omega_r*L / R = 2*pi*f_r*L / R"
lr=53.5/(2*pi*10.7*10**6)
print "Therefore, L/R = Q / 2*pi*f_r =%0.2f"%lr
print "|A_v| = g_m*R_L = 30"
rl=(30/5)
print "Therefore, R_L = (r_d || R_p) =%0.2f kohm"%rl
print "Therefore, R_p = 6383 ohm"
print "We know that"
print "R_p = L/C*R"
c=((795*10**-9)/6383)*10**12
print "Therefore, C = %0.2f pF"%c
print "We know that"
l=(1/(4*pi**2*((10.7*10**6)**2)*124.5*10**-12))*10**6
print "f_r = 1 / 2*pi*sqrt(L*C)"
print "Therefore, L = %0.2f uH"%l
print "We have"
print "R_p = L / C*R"
r=(1.777*10**-6)/(6383*124.5*10**-12)
print "Therefore, R = L / C*R_p =%0.2f ohm"%r
print "Therefore, elements of tank circuit are:"
print "L = 1.777 uH, C = 124.5 pF and R = 2.236 ohm"