In [6]:

```
# Given data
C= 0.01 # in µF
C=C*10**-6 # in F
R_A= 2 # in kΩ
R_A=R_A*10**3 # in Ω
R_B= 100 # in kΩ
R_B=R_B*10**3 # in Ω
T_HIGH= 0.693*(R_A+R_B)*C #charging period in second
T_LOW= 0.693*R_B*C # discharging period in second
T= T_HIGH+T_LOW # overall period of oscillations in second
f= 1/T # frequency of oscillations in Hz
D= T_HIGH/T*100 # duty cycle in %
print "The frequency of oscillations = %0.1f Hz" %f
print "Duty cycle = %0.1f %%" %D
```

In [8]:

```
# Given data
C= 1 # in µF
C=C*10**-6 # in F
R_A= 4.7 # in kΩ
R_A=R_A*10**3 # in Ω
R_B= 1 # in kΩ
R_B=R_B*10**3 # in Ω
T_on= 0.693*(R_A+R_B)*C #positive pulse width in second
T_on= T_on*10**3 # in ms
T_off= 0.693*R_B*C # pulse width in second
T_off= T_off*10**3 # in ms
f= 1.4/((R_A+2*R_B)*C) # free running frequency in Hz
D= round((R_A+R_B)/(R_A+2*R_B)*100) # in %
print "The positive pulse width = %0.2f ms" %T_on
print "The negative pulse width = %0.3f ms" %T_off
print "The frequency of oscillations = %0.1f Hz" %f
print "Duty cycle = %0.f %%" %D
```

In [10]:

```
# Given data
C= 0.01 # in µF
C= C*10**-6 # in F
f= 1 # in kHz
f= f*10**3 # in Hz
# For 50% duty cycle, Ton= Toff = T/2 and R_A= R_B
# From equation, f= 1.44/((R_A+R_B)*C)= 1.44/(2*R_A*C)
R_A= 1.44/(2*f*C) # in Ω
R_A= R_A*10**-3 # in kΩ
R_B= R_A # in kΩ
print "The value of R_A and R_B = %0.f kΩ (Standard value 68 kΩ)" %R_A
```

In [12]:

```
# Given data
f= 700 # in Hz
C= 0.01 # in µF (assumed)
C= C*10**-6 # in F
# For 50% duty cycle, Ton= Toff = T/2 and R_A= R_B
# From equation, f= 1.44/((R_A+R_B)*C)= 1.44/(2*R_A*C)
R_A= 1.44/(2*f*C) # in Ω
R_A= R_A*10**-3 # in kΩ
R_B= R_A # in kΩ
C= C*10**6 # in µF
print "The value of R_A and R_B = %0.f kΩ (Standard value 100 kΩ)" %R_A
print "The value of C = %0.2f µF" %C
```

In [13]:

```
# Given data
f= 800 # in Hz
C= 0.01 # in µF (assumed)
C= C*10**-6 # in F
D= 60 # in duty cycle in %
# D= (R_A+R_B)/(R_A+2*R_B)*100= 60 or
# R_B= 2*R_A
R_A= 1.44/(f*5*C) # in Ω (From f=1.44/((R_A+2*R_B)*C))
R_A= R_A*10**-3 #in kΩ
R_B= 2*R_A # in kΩ
C= C*10**6 #in F
print "The value of R_A = %0.f kΩ" %R_A
print "The value of R_B = %0.f kΩ" %R_B
print "The value of C = %0.2f µF" %C
```

In [8]:

```
from numpy import pi
import math
# Given data
Rs= 5*10**3 #series resistance in Ω
Ls= 0.8 # seried inductance in H
Cs= 0.08*10**-12 #series capacitance in F
Cp= 1.0*10**-12 # parallel capacitance in F
fs= 1/(2*pi*math.sqrt(Ls*Cs)) # series resonant frequency in Hz
fs= fs*10**-3 # in kHz
fp= 1/(2*pi)*math.sqrt((1+Cs/Cp)/(Ls*Cs)) # parallel resonant frequency in Hz
fp= fp*10**-3 # in kHz
print "The series resonant frequency = %0.f kHz" %fs
print "The parallel resonant frequency = %0.f kHz" %fp
```

In [9]:

```
# Given data
C1= 1000*10**-12 # in F
C2= 100*10**-12 # in F
f= 1*10**6 # in Hz
R1= 1*10**6 # in Ω (assume)
R2= 10*10**3 # in Ω (assume)
Rs= 800 # in Ω
VDD= 5 # in V
C_T= C1*C2/(C1+C2) #total capacitance in F
# At resonance, X_L= X_CT or 2*pi*f*L= 1/(2*pi*f*C_T), So
L= 1/((2*pi*f)**2*C_T) # in H
L= L*10**3 # in mH
print "The value of inductance = %0.3f mH" %L
i_p= VDD/(R1+R2+Rs) #current through crystal in A
# Power dissipated in the crystal,
P_D= (0.707*i_p)**2*Rs # in W
P_D= P_D*10**9 #in nW
print "The power dissipated in the crystal = %0.1f nW" %P_D
```

In [18]:

```
from __future__ import division
# Given data
R= 12*10**3 # in Ω
R1= 120*10**3 # in Ω
Rf= 1*10**6 # in Ω
C= 0.1*10**-6 # in F
Vsupply= 12 # in V
Vsat= 10 #in V
#Part (i) : Signal frequency,
f= Rf/(4*R1*R*C) # in Hz
f= f*10**-3 # in kHz
print "Part (i) : The signal frequency = %0.3f kHz" %f
# Part (ii) : Amplitude of triangular wave,
Vpp= 2*R1/Rf*Vsat # Vp-p
print "Part (ii) : Amplitude of the triangular wave = %0.1f Vp-p" %Vpp
# Amplitude of square wave,
Vpp= Vsat-(-Vsat) #Vp-p
print "Amplitude of the square wave = %0.f Vp-p" %Vpp
```

In [5]:

```
from numpy import pi
from __future__ import division
# Given data
I_Bmax= 500 # in nA
I_Bmax= I_Bmax*10**-9 # in A
VCC= 10 # in V
f= 10*10**3 # in Hz
I1= 500*10**-6 # current through R1 in A (assume)
Vout= (VCC-1) #output voltage in V
# Rf+R1= Vout/I1 and Rf= 2*R1, so
R1= Vout/(3*I1) # in Ω
R1= R1*10**-3 # in kΩ
print "The value of R1 = %0.1f kΩ (standard value 5.6 kΩ)" %R1
R1= 5.6 # in kΩ (standard value)
Rf= 2*R1 # in kΩ
print "The value of Rf = %0.1f kΩ (standard value 12 kΩ)" %Rf
R= R1 # in kΩ
R= R*10**3 # in Ω
C= 1/(2*pi*f*R) # in F
C= C*10**12 # in pF
print "The value of C = %0.f pF (Standard capacitor 2700 pF)" %C
```

In [6]:

```
# Given data
R= 1*10**3 # in Ω
C= 4.7*10**-6 # in F
omega= 1/(R*C) # radians/second
f= omega/(2*pi) # in Hz
print "The frequency of oscillation = %0.2f Hz" %f
```