Chapter 9, Longitudinal acoustic waves in air

Example 1, page 380

In [3]:
from __future__ import division
from math import pi
# Pressure amplitude, Energy density and Energy flux
#given data :
A=1*10**-5 # in m
n=500 # in per sec
v=340 # in m/s
p=1.29 # in kg/m**3
Pa=2*pi*n*v*p*A 
print "Pressure amplitude, Pa = %0.1f N/m^2 "%Pa
Ed=2*pi**2*n**2*p*A**2 
print "Energy density, Ed = %0.1e J/m^3 " %Ed
Ev=Ed*v 
print "Energy flux, Ev = %0.2f J/m^2-s " %Ev
Pressure amplitude, Pa = 13.8 N/m^2 
Energy density, Ed = 6.4e-04 J/m^3 
Energy flux, Ev = 0.22 J/m^2-s 

Example 2, page 381

In [4]:
# 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 3, page 381

In [5]:
from math import sqrt
# The amplitude 
#given data :
n=350 # in Hz
v=330 # in m/s
p=1.293 # in kg/m**3
I=1*10**-6 # in W/m**2
A=sqrt(I/(2*pi*n**2*p*v)) 
print "The amplitude of wave, A = %0.2e m " %A
The amplitude of wave, A = 5.52e-08 m 

Example 4, page 381

In [9]:
# Velocity, Amplitude of pressure and particle velocity amplitude
#given data :
gama=1.4 
P=1.013*10**5 
p1=1.29 # in kg/m**3
A=2.5*10**-7 # in m
v=sqrt(gama*P/p1) 
print "The velocity, v = %0.1f m/s  " %v
n=1000 # in Hz
lamda=v/n 
print "Wavelength, lamda = %0.4f m " %lamda
p=p1*v*2*pi*n*A 
print "Amplitude of pressure, p = %0.2f N/m^2 " % p
u=2*pi*n*A 
print "Particle velocity amplitude, u = %0.2e m/s " %u
The velocity, v = 331.6 m/s  
Wavelength, lamda = 0.3316 m 
Amplitude of pressure, p = 0.67 N/m^2 
Particle velocity amplitude, u = 1.57e-03 m/s 

Example 5, page 382

In [13]:
from math import pi
# Amplitude
#given data :
v=(1/3)*10**3 # in m/s
p=1.25 # in kg/m**3
E=v**2*p 
n=10**4 # in rad/sec
print "Bulk modulus of medium, E = %0.2e N/m^2" %E
I=10**-12 # in W/m**2
A=sqrt(I/(2*pi**2*n**2*p*v)) 
print "Amplitude of wave, A = %0.2e m  " %A
P=sqrt(2*I*p*v) 
print "Pressure amplitude, P = %0.2e N/m^2 " %P
# answer A and E is wrong in textbook
Bulk modulus of medium, E = 1.39e+05 N/m^2
Amplitude of wave, A = 1.10e-12 m  
Pressure amplitude, P = 2.89e-05 N/m^2 

Example 6, page 383

In [15]:
from math import sqrt
# Root mean squre velocity
#given data :
vs=330 # in m/s
gama=1.41 
c=round(sqrt(3/gama)*vs) 
print "The root mean square velocity of modulus, c = %0.f m/s "%c
The root mean square velocity of modulus, c = 481 m/s 

Example 7, page 383

In [16]:
# Acoustic power entering
#given data :
A=1*2 # in m**2
a=80 # in dB
I0=10**-12 # in W/m**2
IbyI0=10**(80/10) 
I=I0*IbyI0 
Ape=I*A 
print "Acoustic power entering the room = %0.e Watt  " %Ape
Acoustic power entering the room = 2e-04 Watt  

Example 8, page 384

In [18]:
from math import log10
# Acoustic intensity level
#given data :
Pr=3 # in W
r=15 # in m
I=Pr/(4*pi*r**2) # in W/m**2
I0=10**-12 # in W/m**2
L=round(10*log10(I/I0)) 
print "Acoustic intensity level, L = %0.f dB " %L
Acoustic intensity level, L = 90 dB 

Example 9, page 391

In [19]:
# frequency
n2=200 #second**-1
l21=2 #
f=l21*n2 #
print "Frequency = %0.f second^-1  " %f
Frequency = 400 second^-1  

Example 10, page 391

In [21]:
# length
l1=66 #cm
v=330 #m/s
nbs=5 #beats/sec
x=(2*(v-(nbs*2*l1*10**-2))/(v*2*l1*10**-2)) #
l2=1/x #cm
print "Length = %0.1f cm  "%(l2*100)
Length = 67.3 cm  

Example 11, page 392

In [22]:
# length
f=110 #Hz
v=330 #m/s
l=v/(2*f) #m
print "Fundamental frequency = %0.f Hz" %f
print "Length = %0.1f m" %l
Fundamental frequency = 110 Hz
Length = 1.5 m

Example 12, page 392

In [23]:
# equation,frequency,amplitude ,wavelength and distance
#y=6*(sin(2*pi*x)/6)*cos(160*pi*t) #given equation
a=3 #cm
T=(2*pi)/(160*pi) #sec
h=((2*pi*6)/(2*pi)) #cm
print "wave equation is 3*sin((160*pi*t)+(2*pi*x)/6)"
print "Amplitude = %0.2f cm " %a
print "Frequency = %0.2f Hz  " %(1/T)
print h,"wavelength is,(cm)="
db=h/2 #
print "Distance between consecutive antinodes = %0.2f cm" %db
wave equation is 3*sin((160*pi*t)+(2*pi*x)/6)
Amplitude = 3.00 cm 
Frequency = 80.00 Hz  
6.0 wavelength is,(cm)=
Distance between consecutive antinodes = 3.00 cm

Example 13, page 393

In [27]:
from math import cos, pi
# length,amlitude,pressure
f=440 #Hz
v=330 #m/s
l=((5*v)/(4*f))*100 #cm
print "Length, L = %0.2f cm " %l
Length, L = 93.75 cm