# Input bias and input offset current
import math
#Variable declaration
Ib1 = 18*10**-6 # base current of transistor 1
Ib2 = 22*10**-6 # base current of transistor 2
#Calculations
#(i)
Ib = (Ib1+Ib2)/2
#(ii)
Iios = abs(Ib1-Ib2)
#Result
print("(i) Input bias current = %d micro-A\n(ii) Input offset current = %.0f micro-A"%(Ib*10**6,Iios*10**6))
#Maximum frequency of operation
import math
#Variable declaration
Vin = 3.0 # input voltage
sr = 0.5*10**6 # slew rate in V/Sec
#Calculations
Vm = Vin/2
fm = sr/(2*math.pi*Vm)
fm = fm /1000
#Result
print("Maximum frequency of operation is %.3f kHz"%(math.floor(fm*1000)/1000))
# Slew rate
import math
#Variable declaration
Icq = 15*10**-6 # Maximum op-amp current
C = 35*10**-12 # equivalent capacitance
V = 12.0 # input voltage
#Calculations
S = Icq/C
S = S/10**6
#Result
print("Slew rate = %.4f V/micro-sec"%(math.floor(S*10**4)/10**4))
#Slew rate and maximum possible frequency of input
import math
# Variable declaration
Icq = 10*10**-6 # maximum op-amp current
C = 33*10**-12 # equivalent capacitance
V = 12 # peak value of input voltage
#Calculations
S = Icq/C
fm = S/(2*math.pi*V)
#Result
print("Slew rate = %.3f V/micro-sec\nfm = %.3f kHz"%(S/10**6,fm/1000))
# Common mode rejection ratio(refere to fig 2.24)
import math
#Variable declaration
R1 = 1000.0 # resistance 1
R2_1_E = 90000.0 # resistance R2(1-E)
R2 = 100000.0 # resistance R2
#Calculations
Aid = R2/R1
E = 1-(R2_1_E/R2)
Acm = R2*E/(R1+R2)
CMRR = Aid/Acm
CMRR = 20*math.log10(CMRR)
#Result
print("CMRR = %d dB"%CMRR)