In [1]:

```
from math import sqrt, pi
from __future__ import division
# to design RC phase shift oscillator for the oscillation frequency f = 1 KHz
f =1 # # KHz
C = 0.01 # # uF
# The oscillation frequency of practical RC phase shift oscillator is defined as
#w = 1/(sqrt(6)*R*C)#
# gain of practical RC phase shift oscillator is
#A = R1/R = 29 equation 1
# the frequency selective element resistor
#R = 1/(sqrt(6)*w*C)#
R = 1/(sqrt(6)*2*pi*f*C)#
print 'the frequency selective element resistor is = %0.2f'%R,' K ohm '
# The feedback resistance
R1 = 29*R # # from equation 1
print 'The feedback resistance is = %0.1f'%R1,' K ohm'
```

In [2]:

```
from math import sqrt, pi
from __future__ import division
# to determine the oscillaton frequency of the phase shift oscillator
C = 0.05 # # uF
R = 2.5 # # K ohm
# the oscillator frequency of practical RC phase shift oscillator f
f = 1/(2*pi*(sqrt(6)*(R*C)))#
print 'the oscillator frequency of practical RC phase shift oscillator f is = %0.2f'%f,' KHz '
```

In [3]:

```
from math import sqrt, pi
from __future__ import division
# to calculate the frequency of a wein bridge oscillator
C = 2400*10**-12 # # F
R = 10*10**3 # # ohm
# the oscillator frequency of practical RC phase shift oscillator f
f = 1/(2*pi*R*C)/1e3#
print 'the oscillator frequency of practical RC phase shift oscillator f is = %0.2f'%f,' kHz '
```

In [4]:

```
from math import sqrt, pi
from __future__ import division
# to design the wien bridge oscillator for the oscillation frequency f = 1 KHz
f = 1 # # K ohm
C = 0.01 # # uF
# the frequency f is define as
# f = 1/(2*pi*R*C)#
# the resistor R is
R = 1/(2*pi*f*C)#
print 'the resistor R is = %0.1f'%R,' K ohm '
# the loop gain of the wien bridge oscillator is unity which is defined as
# A = (1+(R2/R1))*(1/3) = 1 #
# R2/R1 = 2 #
R1 = 10 # # K ohm we assume
R2 = 2*R1 #
print 'The resistor R2 value is = %0.2f'%R2,' K ohm '
```

In [5]:

```
from math import sqrt, pi
from __future__ import division
# to calculate the frequency of a wein bridge oscillator
C = 0.05*10**-6 # # F
R = 20*10**3 # # ohm
R1 = 10*10**3 # # ohm
R2 = 20*10**3 # #ohm
# the frequency of wien bridge oscillator f
f = 1/(2*pi*R*C)#
print 'the frequency of wien bridge oscillator f is = %0.3f'%f,' Hz '
```

In [6]:

```
from sympy import symbols, log, N
R, C = symbols('R C')
# Determine the frequency response of the astable multivibrator circuit
Vsat = 2.5 #
VT = 0.7 #
# The frequency of the astable multivibrator is
f = (1/(2*R*C*log((Vsat+VT)/(Vsat-VT))))#
print 'The frequency of the astable multivibrator is =',N(f,2)
```

In [7]:

```
from math import log
# Design astable multivibrator for the frequency f = 10 KHz
f = 10 # # K ohm
Vsat = 3 #
VT = 0.7 #
# The saturation voltage of an astable multivibrator is defined as
# Vsat = (R1+R2/R1)+VT #
R1 = 10 # # K ohm we choose
R2 = ((Vsat/VT)-1)*R1 #
print 'The value of resistance R2 is = %0.2f'%R2,' K ohm '
# The frequency of an astable multivibrator is defined as
C = 0.01 # # uF
# f = (1/(2*R*C*log(1+(2*R1/R2))))#
R = 1/(2*f*C*log(1+2*R1/R2))#
print 'The value of resistor R is = %0.2f'%R,' K ohm'
```

In [8]:

```
# to design astable multivibrator
f = 25*10**3 #
# The output frequency of practical astable multivibrator is defined as
# f = 1/(2*R*C)#
C = 0.1*10**-6 # # uF we choose
R = 1/(2*f*C)#
print 'The value of resistor R is = %0.2f'%R,'ohm '
```

In [9]:

```
# Design a monostable circuit with frequency f = 25 KHz
f =25*10**3 # # Hz
# The output frequency of monostable multivibrator is defined as
# f = 1/(0.69*R*C)#
C = 0.1*10**-6 #
R = 1/(0.69*f*C)#
print 'The value of resistance R is = %0.1f'%R,' ohm '
# In the practical monostable multivibrator
# ln(1+(R2/R1))= 0.69 #
R1 = 10*10**3 # # we choose
R2 = R1*(1.99372-1)#
print 'The value of resistance R2 is = %0.2f'%(R2/1000),' K ohm ' # Round Off Error
```

In [10]:

```
from math import log
# Determine the frequency of the monostable multivibrator
R1 = 5*10**3 #
R2 =15*10**3 #
C = 0.01*10**-6 #
R = 12*10**3 #
# the output of monostable multivibrator is defined as
f = 1/(R*C*(log(1+(R2/R1))))/1e3 # kHz
print 'the output of monostable multivibrator is = %0.2f'%f,' kHz'
```

In [11]:

```
from __future__ import division
# Determine the frequency of the monostable multivibrator
R1 = 5*10**3 #
R2 =15*10**3 #
C = 0.01 #
R = 25 #
# the output of monostable multivibrator is defined as
f = 1/(R*C)#
print 'the output of monostable multivibrator is = %0.2f'%f,' KHz'
```