In [16]:

```
import math
#Variables
R = 100.0 * 10**3 #Resistance (in ohm)
C = 0.4 * 10**-6 #Capacitance (in Farad)
n = 0.57 #Ratio of peak-peak voltage to the supply voltage
#Calculation
f = 1 / (2.3 * R * C * math.log10(1/(1-n))) #Frequency (in Hertz)
#Result
print "Frequency of sweep is ",round(f,2)," Hz."
#Slight variation due to higher precision.
```

In [17]:

```
import math
#Variables
n = 0.62 #Ratio of peak-peak voltage to the supply voltage
R = 5.0 * 10**3 #Resistance (in ohm)
C = 0.05 * 10**-6 #Capacitor (in Farad)
#Calculation
T = 2.3 * R * C * math.log10(1/(1-n)) #Time period of oscillation (in seconds)
f = 1/T #Frequency of oscillation (in Hertz)
f1 = 50.0 #New frequency (in Hertz)
T1 = 1/f1 #New time period of oscillation (in seconds)
R1 = T1 / (2.3 * C * math.log10(1/(1-n))) #New Resistance (in ohm)
f2 = 50.0 #Another new frequency (in Hertz)
C2 = 0.5 * 10**-6 #Capacitance (in Farad)
T2 = 1/f2 #Another new time period (in seconds)
R2 = T2 / (2.3 * C2 * math.log10(1/(1-n))) #New Resistance (in ohm)
#Result
print "The time period and frequency of oscillation in case 1 is ",round(T * 10**3,2)," ms and ",round(f)," Hz."
print "New value of R is ",round(R1 * 10**-3)," kilo-ohm."
print "Value of R with C is 0.5 micro-Farad is ",round(R2 * 10**-3,1)," kilo-ohm."
```