import math
##Example 14.2
R2=10000.;
Ri=10000.
Aol=10**5;
Rif=1./(1./Ri+(1.+Aol)/R2);
print"%s %.2f %s"%('\nclosed loop input resistance = ',Rif,'Ohm\n')
import math
##Example 14.3
Aol=10**5;
Ri=10.;
R1=10.;
R2=R1;
Rif=(Ri*(1.+Aol)+R2*(1.+Ri/R1))/(1.+R2/R1);
Rif=Rif*0.001;##Mohm
print"%s %.2f %s"%('\ninput resistance ',Rif,'MOhm\n')
import math
##Example 14.5
Ao=2*10**5;
fPD=5.;
fT=fPD*Ao;
print"%s %.2f %s"%('\nunity gain bandwidth= ',fT,' Hz\n')
f3dB=20.*10**3;
Acl=fT/f3dB;
print"%s %.2f %s"%('\nclosed loop gain=\n',Acl,'')
import math
##Example 14.6
Iq=19*10**-6;
C1=30*10**-12;
SR=Iq/C1;
SR=SR*10**-6;
print"%s %.2f %s"%('\nslew rate= ',SR,' V/micros\n')
import math
##Example 14.7
fT=1000.;##KHz
Aclo=10.;
SR=1.*10**3;
Vpo=10.;
f3dB=fT/Aclo;
print"%s %.2f %s"%('\nsmall signal closed loop bandwidth= ',f3dB,' KHz\n')
fmax=SR/(2.*math.pi*Vpo);
print"%s %.2f %s"%('\nfull power bandwidth= ',fmax,' KHz\n')
import math
##Example 14.8
Is1=10**-14;
Is2=1.05*10**-14;
Vt=0.026;
Vos=Vt*math.log(Is2/Is1);
print"%s %.2e %s"%('\nthe offset voltage = ',Vos,'V\n')
import math
##Example 14.10
Kn1=105.;
Kn2=100.;
Iq=200.;
dKn=Kn1-Kn2;
print"%s %.2f %s"%('\ndifference in conduction parameter= ',dKn,' microA/V^2\n')
Kn=(Kn1+Kn2)/2.;
print"%s %.2f %s"%('\naverage of the conduction parameter= ',Kn,' microA/V^2\n')
Vos=math.sqrt(Iq/(2.*Kn))*dKn/(2.*Kn);
print"%s %.2f %s"%('\noffset voltage= ',Vos,' V\n')
import math
##Example 14.11
Rs=100.;
R4=100000.;
R3=100000.;
V1=15.;
V2=-15.;
Vy=Rs*V1/(Rs+R4);
Vy=Vy*1000.;##mV
print"%s %.2f %s"%('\nVoltage Vy = ',Vy,'mV\n')
import math
##Example 14.13
R1=10.;
R2=100.;
Ib1=1.1*10**-3;
Ib2=1.*10**-3;
vo=Ib1*R2;
print"%s %.2f %s"%('\noutput voltage = ',vo,'V\n')
R3=R1*R2/(R1+R2);
print"%s %.2f %s"%('\nR3= ',R3,' KOhm\n')
vo=R2*(Ib1-Ib2);
print"%s %.2f %s"%('\noutput voltage= ',vo,' V\n')