import math
from numpy import array,log10,sqrt
# Variables
f = array([500., 2000., 10000.]); #frequency in Hz
# Calculations
Af = 1/sqrt(1+(f/1000)**8); #Linear amplitude response
AdBf = 20*log10(Af);
# Results
print ' f,Hz (Af) (AdBf)'
for i in range(3):
print ' %5i Hz %.5f %.3f dB'%(f[i],Af[i],AdBf[i])
import math
# Variables
L = 4.*10**-6; #Henry
C = 9.*10**-12; #Farad
R = 20.*10**3; #ohm
# Calculations and Results
f0 = 1/(2*math.pi*math.sqrt(L*C)); #frequency in Hz
print 'a) The resonant frequency is f0 = %.2f MHz'%(f0*10**-6)
Q = R*math.sqrt(C/L)
print ' b) The Q is %i'%(Q);
B = f0/Q;
print ' c) The 3-dB bandwidth is B = %i KHz'%(B*10**-3);
# Variables
#misprinted example number
pulse_width = 2*10**-6; #second
rise_time = 10*10**-9; #second
# Calculations and Results
B = .5/pulse_width; #in Hz
print 'a) The aproximate bandwidth for coarse reproduction is B = %i KHz'%(B*10**-3)
B = .5/rise_time;
print ' b) The aproximate bandwidth for fine reproduction is B = %i MHz'%(B*10**-6)