Chapter 3, Forced harmonic oscillator & resonance

Example 1, page 135

In [7]:
from __future__ import division
from math import sqrt, degrees, atan, pi
# Phase shift
#given data :
F0=25 # in N
m=1 
f0=F0/m 
K=1*10**3 # in N/m
w0=sqrt(K/m) 
b=0.05 # in N-s/m
r=b/(2*m) # in s**-1
A=f0*10**3/sqrt(9*w0**4+(16*r**2*(w0)**2)) 
print "The amplitude, A = %0.2f mm " %A
p=2*w0 
fi=atan(2*r*p/(w0**2-p**2)) # radian 
fi = degrees(fi) # degree
print "Phase shift is",round(fi,2),"degree or",round(fi*(pi/180),3),"radian."
#phase shift is converted wrong into radians
The amplitude, A = 8.33 mm 
Phase shift is -0.06 degree or -0.001 radian.

Example 2, page 136

In [9]:
from numpy import array
# A/Amax
x1=array([0.99,0.98,0.97]) #
wt=50 #
wo=1 #assume
fo=1 #assume
for x in x1:
    a=((fo/((wo**2)*((1-x**2)**2+((1/wt**2)*x**2))**(1/2)))) #
    am=fo/((wo**2)*(1/wt**2)**(1/2)) #
    z=a/am #
    print "For p/wo",x,", value of A/Amax is",round(z,2)
For p/wo 0.99 , value of A/Amax is 0.71
For p/wo 0.98 , value of A/Amax is 0.45
For p/wo 0.97 , value of A/Amax is 0.32

Example 3, page 154

In [11]:
from math import pi, sqrt
# Reactance and impedence
#given data :
n=50 # in cycles
w=2*pi*n # in rad/sec
L=1/pi # in H
XL=w*L 
print "The reactance, XL = %0.0f ohm " %XL
R=100 # in ohm
Z=sqrt(R**2+XL**2) 
print "The impedence, Z = %0.1f ohm " %Z
The reactance, XL = 100 ohm 
The impedence, Z = 141.4 ohm 

Example 4, page 155

In [13]:
from math import sqrt, pi
# Current and Capacity
#given data :
E=110 # in V
R=10 # in ohm
L=1*10**-3 # in H
C=1*10**-6 # in F
n=10000 # in Hz
w=2*pi*n 
I=E/sqrt(R**2+((w*L)-(1/(w*C)))**2) 
print "The current, I = %0.2f A " %I
L1=1/(w**2*C) 
print "The value of capacity, L1 = %0.2e F " %L1
#Capacitance  is calculated wrong in the textbook
The current, I = 2.29 A 
The value of capacity, L1 = 2.53e-04 F 

Example 5, page 155

In [16]:
from math import sqrt
# Resonent frequency and Separation
#given data :
L=1*10**-3 # in H
C=0.1*10**-6 # in F
w0=1/sqrt(L*C) 
print "Resonant frequency, w0 = %0.e rad/s " %w0
R=10 # in ohm
w2_w1=R/L 
print "The separation = %0.e rad/s " %w2_w1
S=w0/w2_w1 
print "The sharpness = %0.f " %S
Resonant frequency, w0 = 1e+05 rad/s 
The separation = 1e+04 rad/s 
The sharpness = 10