Chapter 5, Wave motion and speed of waves in gases

Example 1, page 206

In [2]:
from __future__ import division
# wavelength
#given data :
v=960 # in m/s
n=3600/60 # in per sec
lamda=v/n 
print "The wavelength, lamda = %0.f m " %lamda
The wavelength, lamda = 16 m 

Example 2, page 206

In [3]:
# Frequency
#given data :
c=3*10**8 # in m/s
lamda=300 # in m
n=c*10**-6/lamda 
print "The frequency, n = %0.f MHz " %n
The frequency, n = 1 MHz 

Example 3, page 208

In [4]:
# velocity and direction
#y=1.2*sin(3.5*t+0.5*x) #equation
w=3.5 #from equation
k=0.5 #from equation
v=w/k #m/s
print "wave velocity =",v,"m/s and direction of the wave is along negative X-axis"
wave velocity = 7.0 m/s and direction of the wave is along negative X-axis

Example 4, page 209

In [16]:
from sympy import symbols, pi, sin
#equation of wave propogation
amp=0.02 #m
fr=110 #Hz
v=330 #m/s
w=2*pi*fr #s**-1
k=w/v #constant
t, x = symbols('t x')
y=amp*sin(w*t-k*x) #refrence equation
print "Equation of wave is",y
Equation of wave is 0.02*sin(220*pi*t - 2*pi*x/3)

Example 5, page 211

In [17]:
from numpy import pi
#path difference
v=360 #m/s
fr=500 #Hz
h=v/fr #wavelength in metre
ang=60 #degree
angr=ang*(pi/180) #radian
pth=(h)/(2*pi) #metre
print "Path difference = %0.2f m " %pth
Path difference = 0.11 m 

Example 6, page 211

In [19]:
from math import pi
#path difference
pth=15 #cm
pd=(2*pi)/3 #radians
h=(pth*2*pi)/pd #cm
print "Wavelength = %0.f cm " %h
Wavelength = 45 cm 

Example 8, page 214

In [62]:
from math import sin,degrees
from sympy import pi
#displacement ,particle velocity and acceleration
x=200 #cm
a=3 # cm
v=1000#cm/s
n=25
lamda=v/n 
y=a*sin(2*pi/lamda*(v*t-x))

v=1000 #cm/s
n=25 #vibrations
h=v/n #cm
a=3 #cm
t=2 #seconds
vl=2*pi*a*n #cm/s
acc=0 #
print "Displacement c = %0.f m " %round(abs(y))
print "Velocity =",vl,"cm/s " 
print "Acceleration = %0.2f cm/s^2 " %acc
Displacement c = 0 m 
Velocity = 150*pi cm/s 
Acceleration = 0.00 cm/s^2 

Example 9, page 215

In [66]:
#amplitude,frequency,velocity ,wavelength and speed
#y=5*sin*(4t-0.02x) #given
a=5 #cm 
h=(2*pi)/0.02 #
v=0.02*10000 #cm/s
n=v/h #cycles/seconds
print "Amplitude = %0.2f cm " %a
print "Frequency = %0.3f cycles/s " %n
print "Velocity = %0.f cm/s " %v
print "Wavelength = %0.f cm " %h
ma1x=a*4 #cm/s
print "Maximum speed = %0.2f cm/s " %ma1x
Amplitude = 5.00 cm 
Frequency = 0.637 cycles/s 
Velocity = 200 cm/s 
Wavelength = 314 cm 
Maximum speed = 20.00 cm/s 

Example 10, page 216

In [67]:
from math import pi
#wave intensity
nt=1 #watt source
r=1 #n
Is=(nt/(4*pi*r**2)) # joule/sec-m**2
print "Intensity on the surface = %0.2f J/s-m^2 " %Is
Intensity on the surface = 0.08 J/s-m^2 

Example 14, page 225

In [69]:
# Energy flux 
#given data :
A=.10 # in m
w=4 # in per sec
k=0.1 # in per cm
p=1.25*10**3 # in kg/m**3
v=w*10**-2/k # in m/s
n=w/(2*pi) 
Ef=2*pi**2*n**2*A**2*p*v 
print "Energy flux of the wave, Ef = %0.f W/m^2 " %Ef
Energy flux of the wave, Ef = 40 W/m^2 

Example 15, page 225

In [71]:
# Energy radiated and energy current
#given data :
p=1.29 # in kg/m**3
a=.15*10**-2 # in m/s
n=76 # in Hz
E=2*pi**2*n**2*a**2*p 
print "(a) Energy radiated, E = %0.3f J/m^3 " %E
v=332 # in m/s
Ev=E*v 
print "(b) The energy current, Ev = %0.2f W/s " %Ev
# energy current is calculated wrong in the textbook
(a) Energy radiated, E = 0.331 J/m^3 
(b) The energy current, Ev = 109.87 W/s 

Example 16, page 234

In [74]:
# Pressure amplitude, Energy density and energy flux
#given data :
a=10**-5 # in m
n=500 # in per sec
p=1.29 # in kg/m**3
v=340 # in m/s
Pa=2*pi*a*n*v*p 
print "(i) Pressure amplitude, Pa = %0.1f N/m^2 " %Pa
Ed=2*pi**2*a**2*n**2*p 
print "(ii) Energy density, Ed = %0.1e J/m^3 "%Ed
Ef=2*pi**2*a**2*n**2*p*v 
print "(iii) The energy flux, Ef = %0.2f J/m^2-s " %Ef
(i) Pressure amplitude, Pa = 13.8 N/m^2 
(ii) Energy density, Ed = 6.4e-04 J/m^3 
(iii) The energy flux, Ef = 0.22 J/m^2-s 

Example 17, page 235

In [77]:
# Pressure 
#given data :
gama=1.4 
u=10**-3 # in m/s
v=340 # in m/s
P=10**5 # in N/m**2
p=gama*P*u/v 
print "The pressure, p = %0.2f N/m^2  " %p
The pressure, p = 0.41 N/m^2  

Example 18, page 238

In [80]:
from math import sqrt
#speed
sa=332 #m/s
pa=16 #density of air
ph=1 #density of hydrogen
vn=sa*sqrt(pa/ph) #m/s
t1=0 #degree celsius
t2=546 #degree celsius
t1k=0+273 #kelvin
t2k=t2+273 #kelvin
v2=vn*sqrt(t2k/t1k) #m/s
print "Speed of sound in first case = %0.f m/s " %vn
print "speed of sound in second case is = %0.f m/s" %v2
Speed of sound in first case = 1328 m/s 
speed of sound in second case is = 2300 m/s

Example 19, page 239

In [81]:
#temperature
t1=0 #degree celsius
t1k=t1+273 #kelvin
rt=2 #
tk=rt**2*t1k #Kelvin
t=tk-273 #degree celsius
print "Temperature = %0.f degree-celsius " %t
Temperature = 819 degree-celsius 

Example 20, page 239

In [82]:
#temperature
rtd=16/14 #ratio of densities
tk=15+273 #degree celsius
x=(tk*rtd)-273 #degree celsius
print "Temperature = %0.2f degree-celsius " %x
Temperature = 56.14 degree-celsius 

Example 21, page 240

In [84]:
#speed
rt=4/1 #
ss=332 #m/s
rd=32/28 #ratio of densities
rt1=((1+(1/rt)*rd)/(1+(1/rt))) #
v1=ss*sqrt(rt1) #m/s
print "Speed of sound in nitrogen = %0.1f m/s " %v1
Speed of sound in nitrogen = 336.7 m/s 

Example 22, page 241

In [86]:
#speed
gm=1.41 #
vs=330 #m/s
vrms=sqrt(3/gm)*vs #m/s
print "Root mean square velocity of molecules of gas = %0.f m/s " %vrms
Root mean square velocity of molecules of gas = 481 m/s