import math
#Variable declaration
A=(-100.)#A=voltage gain of an amplifier
B=(-0.04)#B=feedback ratio
#Calculations&Results
Af=A/(1+(A*B))#Af=voltage gain with feedback
print "1.Voltage gain with feedback Af=%.f"%Af
F=20*math.log10(abs(Af/A))#F=amount of feedback
print "2.Amount of feedback F=%.2f dB"%F
Vi=40*(10**-3)#Vi=input voltage
Vo=Af*Vi#Vo=output voltage
print "3.Output voltage Vo=%.1f V"%Vo
f=(-A*B)#f=feedback factor
print "4.Feedback factor f=%.f"%f
Vf=B*Vo#Vf=feedback voltage
print "5.Feedback voltage is Vf=%.f mV"%(Vf/10**-3)#Vf is converted in terms of mV
#Variable declaration
print "Negative feedback has to be applied for gain stability"
#A=open loop gain of an amplifier
#B=feedback ratio
#Calculations&Results
Af=10.#Af=voltage gain with feedback
#dAf/Af=(1/(1+(A*B)))*(dA/A)
y=2#(dAf/Af)=y=percent change of gain that is allowable
x=20.#(dA/A)=x=percent change in open loop gain of an amplifier
a=(x/y)#(1+(A*B))=a
print "(1+(A*B))=%.f"%a
#Af=A/((1+(A*B)))
A=(Af*a)
print "Open loop gain A=%.f"%A
#1+(A*B)=a
B=(a-1)/A
print "Minimum value of feedback ratio B=%.2f"%B
#Variable declaration
VD=0.1#VD=outputdistortion voltage
VDf=0.05#VDf=output distortion voltage with feedback
A=-80#A=open loop gain of an amplifier
#Calculations
#VDf=VD/(1+(A*B))
B=((VD/VDf)-1)/A#B=reverse transmission factor
#Result
print "Reverse transmission factor B=%.4f"%B
#Variable declaration
B=50.#B=reverse transmission factor for silicon transistor T1
#Calculations&Results
VB=((640.)*10)/(640+360)#calculating voltage at point B i.e VB by applying voltage divider rule in the given circuit
print "VB=%.1f V"%VB
VBE=VB-5.6#VBE=base emitter voltage drop for silicon transistors T1 and T2 both
print "VBE=%.1f V"%VBE
VA=10-0.8#VA=voltage at point A in the given circuit
print "VA=%.1f V"%VA
I1=10./(360+640)#I1=current through resistor of 360 ohm
print "I1=%.2f A"%I1
IE1=I1+1#IE1=emitter current of transistor T1
print "IE1=%f A"%IE1
#IC1=-IB1+IE1
IB1=IE1/(B+1)#IB1=base current of transistor T1
print "IB1=%.2f mA"%(IB1/10**-3)#IB1 is converted in terms of mA
I2=(20-VA)/300#I2=current through resistor of 300 ohm
print "I2=%.f mA"%(I2/10**-3)#I2 is converted in terms of mA
IC2=I2-IB1#IC2=collector current of transistor T2
print "IC2=%.2f mA"%(IC2/10**-3)#IC2 is converted in terms of mA
#Assuming the base current IB2 of transistor T2 is negligibly small
IE2=IC2#IE2=emitter current of transistor T2
print "IE2=%.2f mA"%(IE2/10**-3)#IE2 is converted in terms of mA
I3=(20-5.6)/1000#I3=current through 1000 ohm resistor
print "I3=%.1f mA"%(I3/10**-3)#I3 is converted in terms of mA
IZ=I3+IE2#IZ=current through zener diode
print "IZ=%.2f mA"%(IZ/10**-3)#IZ is converted in terms of mA
VCE=20-10#VCE=collector emitter voltage drop for transistor T1
print "VCE=%.f V"%VCE
IC1=B*IB1
P=VCE*IC1#P=power dissipation in transistor T1
print "P=%.1f W"%P
#Variable declaration
A=50.#A=voltage gain of transistor amplifier
Ri=1000#Ri=input resistance of transistor amplifier without feedback
Ro=40*1000#Ro=output resistance of transistor amplifier feedback
#Calculations&Results
#Vf=0.1*Vo (given) where Vf=feedback voltage and Vo=output voltage
B=0.1#B=(Vf/Vo)=feedback fraction
Af=A/(1+(A*B))#Af=gain of the feedback amplifier
print "Gain of feedback amplifier Af=%.2f"%Af
Rif=Ri*(1+(A*B))#Rif=input resistance of the feedback amplifier
Rof=Ro/(1+(A*B))#Rof=output resistance of the feedback amplifier
print "Input resistance with feedback Rif=%.f K ohms"%(Rif/10**3)#Rif is converted in terms of kilo ohm
print "Output resistance with feedback Rof=%.2f K ohms"%(Rof/10**3)#Rof is converted in terms of kilo ohm