In [2]:

```
from __future__ import division
#Given data
V_CC = 15 # in V
V_sat = V_CC # in V
R1 = 120 # in ohm
R2 = 51 # in k ohm
R2 = R2 * 10**3 # in ohm
V_in = 1 # in V
V_UT = (V_sat*R1)/(R1+R2) #in V
print "When supply voltage is +15V then threshold voltage = %0.1f mV" %(V_UT*10**3)
V_ULT = ((-V_sat)*R1)/(R1+R2) # in V
V_ULT = V_ULT # in V
print "When supply voltage is -15V then threshold voltage = %0.1f mV" %(V_ULT*10**3)
```

In [3]:

```
from __future__ import division
#Given data
V_sat = 12 # in V
V_H = 6 # in V
R1 = 10 # in k ohm
R1 = R1 * 10**3 # in ohm
# Formula V_H= R1/(R1+R2)*(V_sat-(-V_sat)) and Let
V = V_H/(V_sat-(-V_sat)) # in V (assumed)
R2= (R1-V*R1)/V
print "The value of R1 = %0.f kΩ" %(R1*10**-3)
print "The value of R2 = %0.f kΩ" %(R2*10**-3)
```

In [11]:

```
from numpy import pi
from math import asin
#Given data
V_P = 5 # in V
V_LT = -1.5 # in V
V_H = 2 # in V
f = 1 # in kHz
f = f * 10**3 # in Hz
V_UT = V_H-V_LT # in V
V_m = V_P/2 # in V
# Formula V_LT= V_m*sind(theta)
theta= asin(-V_LT/V_m) *180/pi
T = 1/f # in sec
theta1 = theta+180 # in degree
T1 = (T*theta1)/360 # in sec
T2 = T-T1 # in sec
print "The value of T1 = %0.3f ms" %(T1*10**3)
print "The value of T2 = %0.3f ms" %(T2*10**3)
```

In [12]:

```
#Given data
V_H = 10 # in V
V_L = -10 # in V
I_max = 100 # in µA
I_max = I_max * 10**-6 # in A
V_HV = 0.1 # in V
V_sat = 10 # in V
R2 = 1 # in k ohm
R1 = 199 # in k ohm
R = (R1*R2)/(R1+R2) # in k ohm
print "The resistance = %0.f Ω" %(R*10**3)
# Note: The unit of the answer in the book is wrong
```

In [13]:

```
#Given data
V_sat = 12 # in V
R1 = 1 # in k ohm
R2 = 3 # in k ohm
V_LT = ((-V_sat)*R1)/R2 # in V
print "The value of V_LT = %0.f V" %V_LT
V_UT = (-(-V_sat) * R1)/R2 # in V
print "The value of V_UT = %0.f V" %V_UT
V_H = (R1/R2)*(V_sat - (-V_sat)) # in V
print "The value of V_H = %0.f V" %V_H
```

In [15]:

```
#Given data
R1 = 80 # in k ohm
R2 = 20 # in k ohm
V_sat = 12.5 # in V
V_UT = (R2/(R1+R2))*V_sat # in V
print "Upper threshold voltage = %0.1f V" %V_UT
V_LT = (R2/(R1+R2))*(-V_sat) # in V
print "Lower threshold voltage = %0.1f V" %V_LT
V_HV = (R2/(R1+R2))*(2*V_sat) # in V
print "The hysteresis voltage = %0.f V" %V_HV
```

In [17]:

```
from math import log
#Given data
R1 = 86 # in k ohm
V_sat = 15 # in V
R2 = 100 # in k ohm
V_UT = (R1/(R1+R2))*V_sat # in V
print "The value of V_UT = %0.2f V" %V_UT
V_LT = (R1/(R1+R2))*(-V_sat) # in V
print "The value of V_LT = %0.2f V" %V_LT
R_F = 100 # in k ohm
R_F= R_F*10**3 # in ohm
C = 0.1 # in µF
C = C * 10**-6 # in F
f_o = 1/(2*R_F*C*log( (V_sat-V_LT)/(V_sat-V_UT) )) # in Hz
print "Frequency of oscillation = %0.f Hz" %f_o
```

In [19]:

```
#Given data
del_Vin = 5 # in V
FRR = 80 # in dB
# Formula FRR= 20*log10(del_Vin/del_Vout)
del_Vout=del_Vin/(10**(FRR/20)) # in V
print "Change in output voltage = %0.1f mV" %(del_Vout*10**3)
```