# Given data 
Ri = 10*10**3
R1 = 10*10**6
Acl = 10
# Solution 
Rf = Acl * R1
Rt = 47*10**3
Rs = (Rt**2)/(Rf - (2*Rt))
# Displaying the results
print "The value of Rf = ",Rf/10**6,"Mega Ohms"
print "Thevalue of Rs  = ",Rs,"Ohms"
# Given data
Rf = 10*10**3
R1 = 10**3
Vios = 10*10**-3
Ib = 300*10**-9
Ios = 50*10**-9
# Solution 
# Solution for part a
Vot1 = (1 + (Rf/R1))*Vios + Rf*Ib
# Solution for part b 
Rcomp = (Rf * R1)/(Rf + R1)
# Solution for part c
Vot2 = (1+(Rf/R1))*Vios + Rf*Ios 
# Displaying the values 
print "The value of maximum output offset due to Vios and Ib    = ", int( Vot1*10**3),"mV"
print "The value of Rcomp                                       = ",Rcomp,"Ohms" # Given answer in the textbook is not correct please make the change 
print "The value of maximum output offset if Rcomp is connected = ",Vot2*10**3,"mV"
# Given data 
Acl = 100
Temp0 = 25
Temp1 = 50
Vodrift = 0.15*10**-3
# Solution 
Vos = Vodrift * (Temp1 - Temp0)
Vo = Vos * Acl
# Displaying the results 
print "The value of Input offset voltage = ",Vos*10**3,"mV"
print "The value of Ooutput voltage      = ",int(Vo*10**3),"mV"
# Given data 
from scipy import signal
import matplotlib.pyplot as plt
import numpy as np
Vpp = 6.0
Frequency = 2*10**6
# Solution 
WL = 1.0/Frequency # Calculating the wavelength 
SR = Vpp/(WL/2)  # Calculating the slew rate
# Displaying the results 
print "The value of slew rate is =",int(SR*10**-6),"V/us"
# Ploting the result 
Vp = 3
t = np.linspace(0, 1, 500)
plt.plot(t, -Vp*abs(signal.sawtooth(2 * np.pi * 2 * t)))  # Note : Triangular wave is the absolute of sawtooth wave
plt.ylim(-3,0)
plt.title("Output wave form of example 3.4")
plt.ylabel("Amplitude (V)")
plt.xlabel("Time(t)")
plt.show()
import math 
# Given data 
Acl = 50
Slew_rate = 0.5
frequency = 20*10**3
# solution 
Vm = round((Slew_rate * 10**6)/(2*math.pi * frequency),2)
Vo = 2 * Vm
Vpeak_to_peak = Vo/Acl
# Displaying the outputs 
print "The peak voltage is                   =",Vm,"V peak"
print "The peak to peak voltage              =",Vo,"V peak to peak"
print "The value of maximum input voltage is =",int(Vpeak_to_peak*10**3),"mVpeak to peak " 
# Given data 
Vptpi = 500*10**-3  #input peak to peak voltage 
Vptpo = 3
Tr = 4*10**-6
# Solution 
Vdelta  = (0.9 - 0.1) * Vptpo
SR = (Vdelta / Tr ) * 10**-6
# Display the values 
print "The value of delta V  = ",Vdelta,"V"
print "The slew rate is      = ",SR,"V/us"