In [2]:

```
#Given data
C = 0.01 # in µF
C = C *10**-6 # in F
R_A = 2 # in k ohm
R_A = R_A * 10**3 # in ohm
R_B = 100 # in k ohm
R_B = R_B * 10**3 # in ohm
T_HIGH = 0.693*(R_A+R_B)*C # in s
T_HIGH = T_HIGH # in sec
T_LOW = 0.693*R_B*C # in s
T_LOW = T_LOW # in sec
T = T_HIGH + T_LOW # in sec
f = 1/T # in Hz
print "The value of frequency = %0.1f Hz" %f
D = (T_HIGH/T)*100 # in %
print "Duty cycle = %0.1f %%" %D
```

In [5]:

```
#Given data
C = 1 # in µF
C = C * 10**-6 # in F
R_A = 4.7 # in k ohm
R_A = R_A * 10**3 # in ohm
R_B = 1 # in k ohm
R_B = R_B * 10**3 # in ohm
T_on = 0.693*(R_A+R_B)*C # in s
T_on = T_on # in sec
print "Positive pulse width = %0.2f ms" %(T_on * 10**3)
T_off = 0.693*R_B*C # in s
T_off = T_off # in ms
print "Negative pulse width = %0.3f ms" %(T_off * 10**3)
f = 1.4/((R_A+2*R_B)*C) # in Hz
print "Free running frequency = %0.2f Hz" %f
D = ((R_A+R_B)/(R_A+(2*R_B)))*100 # in %
print "The duty cycle = %0.f %%" %D
```

In [7]:

```
#Given data
C = 0.01 # in µF
C = C * 10**-6 # in F
f = 1 # in kHz
f = f * 10**3 # in Hz
R_A = 1.44/(2*f*C) # in ohm
R_A = R_A * 10**-3 # in k ohm
R_B= R_A # in kohm
print "The value of both the resistors required = %0.f kΩ (standard value 68 kohm)" %R_A
```

In [9]:

```
#Given data
f = 700 # in Hz
C = 0.01 # in µF
C = C * 10**-6 # in F
a = 1.44
R_A = a/(2*f*C) # in ohm
R_A = R_A * 10**-3 # in k ohm
R_B =R_A # in k ohm
print "The the value of C = %0.2f µF" %(C*10**6)
print "The value of both the resistors = %0.f kΩ" %R_A
print "(Standard value of resistor is 100 kΩ)"
```

In [11]:

```
#Given data
C = 0.01 # in µF
C = C *10**-6 # in F
R_A = 2 # in k ohm
R_A = R_A * 10**3 # in ohm
R_B = 100 # in k ohm
R_B = R_B * 10**3 # in ohm
T_HIGH = 0.693*(R_A+R_B)*C # in s
T_HIGH = T_HIGH # in sec
T_LOW = 0.693*R_B*C # in s
T_LOW = T_LOW # in sec
T = T_HIGH + T_LOW # in sec
f = 1/T # in Hz
print "The value fo frequency = %0.1f Hz" %f
D = (T_HIGH/T)*100 # in %
print "Duty cycle = %0.1f %%" %D
```

In [14]:

```
#Given data
C = 1 # in µF
C = C * 10**-6 # in F
R_A = 4.7 # in k ohm
R_A = R_A * 10**3 # in ohm
R_B = 1 # in k ohm
R_B = R_B * 10**3 # in ohm
T_on = 0.693*(R_A+R_B)*C # in s
T_on = T_on # in sec
print "Positive pulse width = %0.2f ms" %(T_on * 10**3)
T_off = 0.693*R_B*C # in s
T_off = T_off # in ms
print "Negative pulse width = %0.3f ms" %(T_off * 10**3)
f = 1.4/((R_A+2*R_B)*C) # in Hz
print "Free running frequency = %0.2f Hz" %(f)
D = ((R_A+R_B)/(R_A+(2*R_B)))*100 # in %
print "The duty cycle = %0.f %%" %D
```

In [16]:

```
#Given data
C = 0.01 # in µF
C = C * 10**-6 # in F
f = 1 # in kHz
f = f* 10**3 # in Hz
a = 1.44
R_A = a/(2*f*C) # in ohm
R_A = R_A * 10**-3 # in k ohm
R_B = R_A # in k ohm
print "The value of both the resistors required = %0.f kΩ (standard value 68 kohm)" %R_A
```

In [18]:

```
#Given data
f = 700 # in Hz
C = 0.01 # in µF
C = C * 10**-6 # in F
a = 1.44
R_A = a/(2*f*C) # in ohm
R_A = R_A * 10**-3 # in k ohm
R_B =R_A # in k ohm
print "The the value of C = %0.2f µF" %(C*10**6)
print "The value of both the resistors = %0.f kΩ" %R_A
print "(Standard value of resistor is 100 kΩ)"
```

In [19]:

```
#Given data
f = 800 # in Hz
C = 0.01 # in µF
C =C * 10**-6 # in F
R_A = 1.44/(5*f*C) # in ohm
R_A = R_A * 10**-3 # in k ohm
print "The value of R_A = %0.f kΩ" %R_A
R_B = 2*R_A # in k ohm
print "The value of R_B = %0.f kΩ" %R_B
```

In [21]:

```
#Given data
C = 10 # in µF
C = C*10**-6 # in F
T_ON = 5 # in sec
R = T_ON/(1.1*C) # in ohm
print "The resistor value = %0.1f ohm" %R
```

In [22]:

```
#Given data
C = 10 # in µF
C = C * 10**-6 # in F
T_off = 1 # in sec
#Formula T_off= 0.693*R2*C
R2 = T_off/(0.693*C) # in ohm
print "The value of R2 = %0.f Ω" %R2
T_on = 3 # in sec
# Formula T_on= 0.693*(R1+R2)*C
R1 =T_on/(C*0.693)-R2 # in ohm
print "The value of R1 = %0.f Ω" %R1
```

In [26]:

```
from __future__ import division
#Given data
C = 0.22 # in µF
C=C*10**-6 # in F
T_on = 10 # in ms
T_on = T_on * 10**-3 # in s
V_CC = 15 # in V
V_BE = 0.7 # in V
V_EC = 0.2 # in V
V_LED= 1.4 # in V
I_LED= 20*10**-3 # in A
R = T_on/(C*1.1) # in ohm
R = R *10**-3 # in k ohm
print "Values for first circuit : "
print "The value of R = %0.1f kΩ" %R
V_o = V_CC-(2*V_BE) - V_EC # in V
print "The output voltage = %0.1f V" %V_o
R_LED = (V_o - V_LED)/(I_LED) # in ohm
print "The value of R_LED = %0.f Ω" %R_LED
# Part (ii)
f= 1*10**3 # in Hz
C=0.01*10**-6 # in F
D= 95/100 # duty cycle
# Formula f= 1.44/((R1+2*R2)*C)
# R1+2*R2= 1.44/(f*C) (i)
# D= (R1+R2)/(R1+2*R2) or
# R2= (1-D)/(2*D-1)*R1 (ii)
# From eq (i) and (ii)
R1= 1.44/(f*C*(1+2*((1-D)/(2*D-1)))) # in ohm
R2= (1-D)/(2*D-1)*R1 # in ohm
print "\nValues for second circuit : "
print "The value of R1 = %0.1f kΩ" %(R1*10**-3)
print "The value of R2 = %0.2f kΩ" %(R2*10**-3)
```

In [28]:

```
#Given data
T = 5 # in msec
T = T * 10**-3 # in sec
C = 0.1 # in µF
C = C * 10**-6 # in F
R = T/(C*1.1) # in ohm
R = R * 10**-3 # in k ohm
print "The resistor = %0.2f kΩ" %R
```

In [30]:

```
#Given data
f = 1 # in kHz
f = f * 10**3 # in Hz
T = 1/f # in s
T = T * 10**3 # in msec
T_d = T/2 # in msec
T_d = T_d * 10**-3 # in sec
C = 0.1 # in µF
C = C * 10**-6 # in F
R2 = T_d/(0.69*C) # in ohm
R2 = R2 * 10**-3 # in k ohm
print "The value of C = %0.1f µF" %(C*10**6)
print "The value of R2 = %0.2f kΩ" %R2
print "The value of R1 will be 100 Ω +10 kΩ pot"
```

In [32]:

```
#Given data
f = 800 # in Hz
D = 0.6
C = 0.1 # in µF
C = C * 10**-6 # in F
# Formula f= 1.44/((R_A+2*R_B)*C)
# R_A+2*R_B= 1.44/(f*C) (i)
# D= (R_A+R_B)/(R_A+2*R_B) or
# R_B= (1-D)/(2*D-1)*R_A (ii)
# From eq (i) and (ii)
R_A= 1.44/(f*C*(1+2*((1-D)/(2*D-1)))) # in ohm
R_B= (1-D)/(2*D-1)*R_A # in ohm
print "The value of R_A = %0.1f kΩ" %(R_A*10**-3)
print "The value of R_B = %0.1f kΩ" %(R_B*10**-3)
```

In [34]:

```
#Given data
f = 700 # in Hz
D = 0.5
C = 0.1 # in µF
C = C * 10**-6 # in F
# Formula f= 1.44/((R_A+2*R_B)*C)
# R_A+2*R_B= 1.44/(f*C) (i)
# D= (R_A+R_B)/(R_A+2*R_B) or
# R_A+R_B=D*1.44/(f*C)
# From eq (i) and (ii)
R_B=round(1.44/(f*C))*(1-D)
R_A= round(D*1.44/(f*C))-R_B
#R_A= 1.44/(f*C*(1+2*((1-D)/(2*D-1)))) # in ohm
#R_B= (1-D)/(2*D-1)*R_A # in ohm
print "The value of R_A = %0.f Ω" %round(R_A)
print "The value of R_B = %0.3f kΩ" %(R_B*10**-3)
```

In [35]:

```
#Given data
R_A = 20 # in k ohm
R_A = R_A * 10**3 # in ohm
C = 0.1 # in µF
C = C*10**-6 # in F
pulse_width = 1.1*R_A*C # in s
print "The output pulse width = %0.f ms" %(pulse_width*10**3)
```

In [39]:

```
from sympy import symbols, solve
T= symbols('T')
#Given data
n=4
# t_p= X*T, where
X= (0.2+(n-1)) # (assumed)
t_p= X*T
print "The relation between t_p and T is :"
print "t_p = ",t_p
```

In [42]:

```
#Given data
C = 0.02 # in µF
C = C * 10**-6 # in F
f=2*10**3 #frequency in Hz
T = 1/f # in sec
n = 5
t_p = (0.2+(n-1))*T # in sec
R_A = t_p/(1.1*C) # in ohm
print "The value of R_A = %0.2f kΩ (standard value 100 kohm)" %(R_A*10**-3)
```