import math
from numpy import pi
from math import sqrt
# Given data
f=200 # in Hz
# Let us take
C=0.1 # in micro F
C=C*10**-6 # in F
R=1/(2*pi*f*C*sqrt(6)) # in ohm
R=R*10**-3 # in k ohm
# R1>=10*R, Let
R1=10*R # in kohm
R_f= 29*R1 # in k ohm
R_f=R_f*10**-3 # in M ohm
R_f=math.ceil(R_f)
print "Resistor of phase-shift oscillator = %0.f Mohm" %R_f
# Given data
f=1 # in kHz
f=f*10**3 # in Hz
V_CC= 10 # in volt
I_B_max= 500 # in nA (for 741 IC op-amp)
I_B_max= I_B_max*10**-9 # in A
I1= 100*I_B_max # in A
V_out= (V_CC-1) # in volt
V_in= V_out/29
R1= V_in/I1 # in ohm
R1=R1*10**-3 #in k ohm
# 5.6 k ohm resistor may be used for R1, being standard value resistor
R1=5.6 # in k ohm (standard value)
A=29
R_f= A*R1
# 180 k ohm resistor may be used to provide A > 29
R_f=180 # in k ohm (standard value)
R_comp= R_f
R=R1 # in k ohm
R=R*10**3 # in ohm
C=1/(2*pi*f*R*sqrt(6)) # in F
C=C*10**6 # in micro F
print "Value of R_comp = R_f = %0.f kohm" %R_comp
print "Value of R = R1 = %0.1f in kohm" %(R*10**-3)
print "Value of capacitor = %0.2f micro F" %C
# Given data
f=10 # in kHz
f=f*10**3 # in Hz
I_Bmax= 500 # in nA
I_Bmax= I_Bmax*10**-9 # in amphere
# Let current through resistor R1 be equal to 100 times I_Bmax, so
I_1= 100*I_Bmax # in amp
Vcc= 10 # in volt
Vout= Vcc-1 # in volt
Addition_RfR1= Vout/(500*10**-6) # value of Rf+R1 in ohm
Addition_RfR1=Addition_RfR1*10**-3 # in kohm
# Rf= 2*R1, So
R1= Addition_RfR1/3 # (used 5.6 kohm Standard value resistor)
print "Value of R1 = %0.f kohm (Standard value 5.6 k ohm)" %R1
R1= 5.6 # in kohm (used 5.6 kohm Standard value resistor)
Rf= 2*R1 # in kohm# (used 12 kohm standard value resistor)
print "Value of Rf = %0.1f kohm (Standard value 12 k ohm)" %Rf
Rf= 12 # k ohm (used 12 kohm standard value resistor)
R=R1 # in kohm
C= 1/(2*pi*f*R) # in F (Used 2700pF standard value)
C=2700 # in pF
print "Value of R = %0.1f kohm" %R
print "Value of C = %0.f pF" %C
# Given data
R= 1 # in kohm
R=R*10**3 # in ohm
C= 4.7 # in micro F
C=C*10**-6 # in F
omega=1/(R*C) # in radians/second
f=omega/(2*pi) # in Hz
print "Frequency of the oscillation of the circuit = %0.2f Hz" %f
# Given data
R= 10 # in kohm
R=R*10**3 # in ohm
C= 100 # in pF
C=C*10**-12 # in F
f=1/(2*pi*R*C) # in Hz
print "Frequency of the oscillation of the circuit = %0.2f kHz" %(f*10**-3)
# Given data
fo= 318 # in Hz
C= 0.015 # in microF
C=C*10**-6 # in F
R=0.159/(fo*C) # in ohm
R=R*10**-3 # in kohm
R=int(R)
print "Value of C1 = C2 = C3 = %0.3f micro F" %(C*10**6)
print "Value of R1 = R2 = R3 = %0.f in kohm" %R
# Given data
fo= 1.5 # in kHz
fo=fo*10**3 # in Hz
C= 0.01 # in microF
C=C*10**-6 # in F
R=0.159/(fo*C) # in ohm
R=R*10**-3 # in kohm
R=int(R)
print "Value of C1 = C2 = C3 = %0.2f micro F" %(C*10**6)
print "Value of R1 = R2 = R3 = %0.f in kohm" %R
# Given data
C= 0.1 # in microF
C=C*10**-6 # in F
R=12 # in kohm
R=R*10**3 # in ohm
R1=120 # in kohm
R1=R1*10**3 # in ohm
Rf=1 # in Mohm
Rf=Rf*10**6 # in ohm
V_sat= 10 # in volt
# Part(i)
f=Rf/(4*R1*R*C) #in Hz
print "(i) : Signal Frequency = %0.3f kHz" %(f*10**-3)
# Part(ii)
Vp_p= float(2*R1*V_sat)/Rf # in Vp_p
print "(ii) : Amplitude of the triangular wave = %0.1f Vp_p" %Vp_p
# Part(iii)
Vp_p= (V_sat)-(-V_sat)
print "(iii) : Amplitude of the square wave = %0.f Vp_p" %Vp_p
# Given data
C1= 0.01 # in microF
C1=C1*10**-6 # in F
R1=120 # in kohm
R1=R1*10**3 # in ohm
R2=1.2 # in kohm
R2=R2*10**3 # in ohm
R3=6.8 # in kohm
R3=R3*10**3 # in ohm
V_sat= 15 # in volt
# Part(a)
Vp_p= 2*(R2/R3)*V_sat #in volt
print "(a) : Peak to peak amplitude of triangular wave = %0.3f volt" %Vp_p
# Part(b)
fo= R3/(4*R1*C1*R2) #in Hz
print "(b) : Frequency of triangular wave = %0.2f kHz" %(fo*10**-3)
from math import log
# Given data
T= 100 # in micro sec
T=T*10**-6 #in se
V_sat= 12 # in volt
V1= 0.7 # in volt
V= 0.7 # in volt
V_D1= V
V_D2=V_D1
C1= 0.1 # in microF
C1=C1*10**-6 # in F
Bita1= 0.1
# Formula T= R3*C1*log((1+V1/V_sat)/(1-Bita1))
R3= T/(C1*log((1+V1/V_sat)/(1-Bita1))) # in ohm
print "Value of R3 = %0.3f kohm (Standard value 6.8 kohm)" %(R3*10**-3)