# Chapter1 - Free oscillations in one-dimension : Simple harmonic Oscillator¶

## Example 1, page 9¶

In [1]:
from __future__ import division
from math import sqrt, pi
#  FREQUENCY AND TIME PERIOD
#format('v',6)
#ph=50*x**2+100 in joule/kg
m=10 #mass in kg
f=10**3/m #joule/kg
w=sqrt(f) #oscillations
fr=w/(2*pi) #oscillations/sec
tp=1/fr #seconds
print "Frequency of oscillation = %0.1f oscillations/seconds "%fr
print "Time period = %0.3f seconds " %tp

Frequency of oscillation = 1.6 oscillations/seconds
Time period = 0.628 seconds


## Example 3, page 11¶

In [3]:
# ENERGY
ke=5 #joule
pe=5 #joule
rep=10 #joule
eo=rep+ke+pe #joule
print "Energy of the oscillator = %0.f J" %eo

Energy of the oscillator = 20 J


## Example 4, page 12¶

In [6]:
#peroid ,maximum velocity and acceleration
a=3 #cm
b=4 #cm
A=sqrt(a**2+b**2) #cm
w=2 #sec**-1
T=(2*pi)/w #seconds
um=w*A #cm/s
am=w**2*A #cm/s**2
print "Time period = %0.f seconds" %T
print "Maximum velocity  = %0.f cm/s" %um
print "Maximum acceleration = %0.f cm/s2 " %am

Time period = 3 seconds
Maximum velocity  = 10 cm/s
Maximum acceleration = 20 cm/s2


## Example 5, page 12¶

In [10]:
from math import pi
# maximum velocity and acceleration
A=5 #cm
T=31.4#seconds
w=(2*pi)/T #sec**-1
um=w*A #cm/s
am=w**2*A #cm/s**2
print "Maximum velocity  = %0.f cm/s" %um
print "Maximum acceleration = %0.1f cm/s2 " %am

Maximum velocity  = 1 cm/s
Maximum acceleration = 0.2 cm/s2


## Example 6, page 20¶

In [14]:
from math import pi, sqrt
#  Period
#given data :
g=9.8 # constant
l=1 # in m
theta_m1=60 # in degree
T0=round(2*pi*sqrt(l/g))
print "(a) Time period for small displacement, T0 = %0.f seconds " %T0
T=T0*(1+(theta_m**2/16))
print "(b) Time period, T = %0.1f seconds " %T

(a) Time period for small displacement, T0 = 2 seconds
(b) Time period, T = 2.1 seconds


## Example 7, page 20¶

In [16]:
# ENERGY
es=1 #joule
l=2 #metre
am=3 #cm
am1=5 #cm
e1=(am1**2/am**2)*es #joules
l2=1 #meter
e2=(l/l2)*es #joules
print "Energy in first case = %0.3f J" %e1
print "Energy in second case = %0.1f J" %e2

Energy in first case = 2.778 J
Energy in second case = 2.0 J


## Example 8, page 28¶

In [18]:
from math import sqrt, pi
#  Period of motion
#given data :
x=0.16 # in m
m1=4 # in kg
g=9.8
K=m1*g/x
m=0.50 # in kg
T=2*pi*sqrt(m/K) #
print "The period of motion, T = %0.2f seconds " %T
# answer is wrong in textbook

The period of motion, T = 0.28 seconds


## Example 9, page 28¶

In [20]:
from math import sqrt
#foce constant,displacement , acceleration and energy
#given data :
x1=.10 # in m
F1=4 # in N
K=F1/x1
x2=0.12 # in m
print "(a) The force constant, K = %0.2f N/m" %K
F=-K*x2
print "(b) The force, F = %0.2f N" %F
m=1.6 # in kg
T=2*pi*sqrt(m/K)
print "(c) Period of oscillation, T = %0.3f s " %T
A=x2
print "(d) Amplitude of motion, A = %0.2f m " %A
alfa=A*K/m
print "(e) Maximum acceleration, alfa = %0.2f m/s2 " %alfa
x=A/2 # in m
w=sqrt(K/m)
v=w*sqrt(A**2-x**2)
a=w**2*x # in m/s**2
KE=(1/2)*m*v**2 # in J
PE=(1/2)*K*x**2 # in J
TE=KE+PE
print "(f) Velocity = %0.2f m/s " %v
print "(f) Acceleration = %0.2f m/s2 " %a
print "(f) Kinetic energy = %0.2f J " %KE
print "(f) Potential energy = %0.2f J" %PE
print "(g) Total energy of the oscillating system, TE = %0.2f J" %TE
# In textbook part f is inculded in the part e so their is the numbeing error in parts

(a) The force constant, K = 40.00 N/m
(b) The force, F = -4.80 N
(c) Period of oscillation, T = 1.257 s
(d) Amplitude of motion, A = 0.12 m
(e) Maximum acceleration, alfa = 3.00 m/s2
(f) Velocity = 0.52 m/s
(f) Acceleration = 1.50 m/s2
(f) Kinetic energy = 0.22 J
(f) Potential energy = 0.07 J
(g) Total energy of the oscillating system, TE = 0.29 J


## Example 10, page 30¶

In [31]:
from math import sin
from sympy import symbols, pi
# ENERGY
t=8/3 #seconds
v=-10*pi*sin((35*pi)/6)#cm/s
print "Velocity =",v,"cm"

Velocity = 5.0*pi cm


## Example 11, page 30¶

In [35]:
from math import sqrt, pi
#given data :
K1=3 # in N/m
K2=2 # in N/m
m=0.050 # in kg
w=sqrt((K1+K2)/m)
n=w/(2*pi)
print "(i) The frequency, n = %0.2f oscillations/sec " %n
A=0.004 # in m
E=(1/2)*A**2*(K1+K2)
print "(ii) The energy, E = %0.e J " %E
v=sqrt(2*E/m)
print "(iii) The velocity, v = %0.2f m/s" %v

(i) The frequency, n = 1.59 oscillations/sec
(ii) The energy, E = 4e-05 J
(iii) The velocity, v = 0.04 m/s


## Example 12, page 33¶

In [38]:
# Rotational inertia
#given data :
M=0.1 # in m
l=0.1 # in m
I1=M*l**2/12 # in kg-m**2
T1=2 # in s
T2=6 # in s
I2=(I1*T2**2)/T1**2
print "Rotational inertia, I2 = %0.1e kg-m2 " %I2

Rotational inertia, I2 = 7.5e-04 kg-m2


## Example 13, page 34¶

In [39]:
from math import sqrt
# Time period
#given data :
M=4 # in kg
R=0.10 # in m
I=(2/5)*M*R**2 # in kg.m**2
T=2*pi*sqrt(I/C)
print "Time period, T = %0.2f s " %T
# answer is wrong in textbook

Time period, T = 12.57 s


## Example 15, page 41¶

In [41]:
from math import sqrt, pi
# Energy
#given data :
L=10*10**-3 # in H
C=20*10**-6 # in F
n=1/(2*pi*sqrt(L*C))
V=10 #in V
U=(1/2)*C*V**2
print "Frequency, n = %0.2f cycles/s " %n
print "Energy of oscillations,U = %0.1e J " %U
#answer of frequency is calculated wrong in textbook

Frequency, n = 355.88 cycles/s
Energy of oscillations,U = 1.0e-03 J


## Example 16, page 47¶

In [42]:
# distance,binding energy and force constant
print "Equilibrium inter-nuclear distance correspondes to lowest potential enegy is ro= 2*Å"
pet=0 #eV
peb=-4 #eV
be=pet-peb #eV
x1=-2 #eV
x2=-4 #eV
V=x1-x2 #eV
e=1.6*10**-19 #electronic charge
x=0.5 #armstrong
K=((2*V)/x**2) #eV/Å**2
k1=(K*e)/(10**-10)**2 #joule/m**2
print "Binding energy = %0.2f eV " %be
print "Force constant = %0.2f N/m " %k1

Equilibrium inter-nuclear distance correspondes to lowest potential enegy is ro= 2*Å
Binding energy = 4.00 eV
Force constant = 256.00 N/m


## Example 17, page 48¶

In [43]:
# possible values and energy
r1=2 #from graph
r2=4.5 #units from graph
print "Possible values of r are",r1,"units and",r2,"units."
osc=1-(-2.5) #units
print "Maximum energy of oscillations for r=2 units is",osc,"units."
osc1=0.5-(-1) #units
print "Maximum energy of oscillations for r=4.5 units is",osc1,"units."
t=1 #from graph
v=0 #from graph
e=t+v #
print "Total energy = %0.2f unit " %e
print "At infinity V =",v,"therefore T =",t,"unit."

Possible values of r are 2 units and 4.5 units.
Maximum energy of oscillations for r=2 units is 3.5 units.
Maximum energy of oscillations for r=4.5 units is 1.5 units.
Total energy = 1.00 unit
At infinity V = 0 therefore T = 1 unit.


## Example 19, page 67¶

In [45]:
from math import sqrt, pi
# Frequency
#given data :
m1=10 # in g
m2=90 # in g
K=10**3 # in N/m
mu=m1*m2*10**-3/(m1+m2)
n=round(sqrt(K/mu)/(2*pi))
print "The frequency, n = %0.2f oscillations/sec " %n
x1=0 #
x2=10 #cm
xb=((m1*x1+m2*x2)/(m1+m2)) #cm
mo=(m1*10**-3)*(xb*10**-2)**2+(m2*10**-3)*(1*10**-2)**2 #
print "Moment of inertia = %0.1e kg-m2 " %mo

The frequency, n = 53.00 oscillations/sec
Moment of inertia = 9.0e-05 kg-m2


## Example 20, page 68¶

In [46]:
from math import sqrt, pi
# frequency and amplitude
c=10**-4 #N-m
m1=9 #gm
m2=1 #gm
mu=((m1*m2)/(m1+m2))*10**-3 #kg
r=20 #cm
I=mu*(r*10**-2)**2 #kg-m**2
fr=((1/(2*pi))*sqrt(c/I)) #vibrations/sec
print "Frequency of vibration = %0.2f vibrations/s " %fr
e=10**-2 #joule
print "Amplitude = %0.2f radians " %thmax

Frequency of vibration = 0.27 vibrations/s


## Example 21, page 69¶

In [48]:
from math import sqrt
# frequency ,energy and maximum velocity
c=1 #N-m
m1=6 #gm
m2=2 #gm
mu=((m1*m2)/(m1+m2))*10**-3 #kg
fr=((1/(2*pi))*sqrt(c/mu)) #vibrations/sec
print "Frequency of oscillations = %0.1f vibrations/s " %fr
td= 1+(1/3) #cm
e=((1/2)*c*(td*10**-2)**2) #joule
print "Energy = %0.1e J " %e
y=((1/2)*m2*10**-3)+((1/2)*(1/3)**2*m1*10**-3) #
v1=sqrt((e/y)) #m/sec
print "Maximum velocity of smaller mass = %0.2f m/s" %v1
#velocity is calculated wrong in the book

Frequency of oscillations = 4.1 vibrations/s
Energy = 8.9e-05 J
Maximum velocity of smaller mass = 0.26 m/s


## Example 22, page 70¶

In [50]:
from math import sqrt, pi
# frequency
k=100 #N/m
m=100 #gm
n1=((1/(2*pi))*sqrt(k/(m*10**-3))) #sec**-1
m1=100 #gm
m2=200 #gm
mu=((m1*m2)/(m1+m2))*10**-3 #kg
fr=((1/(2*pi))*sqrt(k/mu)) #sec**-1
print "In first case frequency = %0.f sec^-1 "%n1
print "In second case frequency = %0.1f sec^-1 "%fr

In first case frequency = 5 sec^-1
In second case frequency = 6.2 sec^-1


## Example 23, page 73¶

In [52]:
# force constant and work done
m1=1 #assume
m2=19 #assume
mh=1.66*10**-27 #kg
mu=((m1*m2)/(m1+m2))*mh #kg
k=mu*(w)**2 #N/m
print "Force constant = %0.1f N/m " %k
x=0.5 #arngstrom
wh=((1/2)*k*(x*10**-10)**2) #joule
print "Work done = %0.3e J" %wh

Force constant = 898.9 N/m
Work done = 1.124e-18 J


## Example 24, page 74¶

In [53]:
from math import sqrt
# frequency
m1=1 #a.m.u
m2=35 #a.m.u
mu1=((m1*m2)/(m1+m2)) #a.m.u
m3=2 #
mu2=((m3*m2)/(m3+m2)) #a.m.u
n1=8.99*10**13 #cycle/sec
n2=(sqrt(mu1/mu2))*n1 #c/s
print "Frequecy of vibrations = %0.2e c/s " %n2

Frequecy of vibrations = 6.44e+13 c/s