#pg 552
#calculate the Ratio and delta_v
#Given :
delta_t = 1; # temperature in degrees
t1 = 27.; # temperature in degrees
v1 = 343;# speed of sound at room temperature in m/s
#calculations
#Ratio = v2/v1 = 1+ (delta_t/(t1+273))
Ratio = 1 + (delta_t /(2*(t1+273)));
v2 = v1*Ratio; # speed of sound in air in m/s
delta_v = v2-v1; # speed in m/s
#results
print "Ratio = ",round(Ratio,4)
print "delta_v (m/s) = ",round(delta_v,1)
#pg 553
#calculate the Maximum displacement amplitude
#Given :
import math
p_rms = 0.0002; # in microbar
p_rms1 = 20.; # in pascal
v = 343.; # speed of sound in m/s
rho_0 = 1.21; # density of air in kg/m^3
f = 1000.; # frequency in Hz
# p_rms = pm_min/(2)^0.5
#1 microbar = 0.1 N/m^2
#calculations
pm_min = math.sqrt(2)*p_rms*0.1; #in N/m^2
# 1 pascal = 1 N/m^2
pm_max =math.sqrt(2)*p_rms1*1; # in N/m^2
# sm = pm/(v*rho_0*omega);
#omega = 2*pi*f
sm_min = pm_min/(v*rho_0*2* math.pi*f); # displacement amplitude in m
sm_max = pm_max/(v*rho_0*2*math.pi*f);# displacement amplitude in m
#results
print "Minimum displacement amplitude =",round(sm_min*10**12,0),"pm"
print "Maximum displacement amplitude =",round(sm_max*10**6),"mu m"
#pg 555
#calculate the ratio of max to min intensity
#Given :
import math
sm_min = 11*10**-12;# Minimum displacement amplitude in m
sm_max = 11*10**-6;# Maximum displacement amplitude in m
v = 343;# speed of sound in m/s
f = 1000; # frequency in Hz
rho_0 = 1.21; # density of air in kg/m**3
# Sound intensity = (rho_0*v*omega**2*sm**2)/2
#omega = 2*pi*f
#calculations
I_max = (rho_0*v*((2*math.pi*f)**2)*(sm_max**2))/2; # Maximum Intensity
I_min = (rho_0*v*((2*math.pi*f)**2)*(sm_min**2))/2; # Minimum Intensity
Ratio = I_max/I_min ;
#results
print "I_max/I_min =",Ratio*10**-12,"x 10**12 "
#pg 556
#calculate the Hearing Threshold,Speech Activity and Pain Threshold
#Given :
I0 = 10**-12; # in W/m**2
beta1 = 0.; # in dB
beta2 = 60.;# in dB
beta3 = 120.; # in dB
#calculations
# Intensity level = beta = 10*log10(I/I0)
I1 = 10**(beta1/10)*I0; # Intensity in W/m**2
I2 = 10**(beta2/10)*I0; # Intensity in W/m**2
I3 = 10**(beta3/10)*I0; # Intensity in W/m**2
#results
print "Hearing Threshold :",I1*10**12,"x 10**-12 W/m^2"
print "Speech Activity :",I2*10**6,"x 10**-6 W/m^2"
print "Pain Threshold (W/m^2) = ",I3
#pg 563
#calculate the reverberation time
#Given :
l = 200.; # in ft
b = 50.; # in ft
h = 30.;# in ft
alpha = 0.25; #average absorption coefficient
#calculations
V = l*b*h; # Volume in ft^3
S = 2*((l*b)+(l*h)+(b*h)); #total surface area in ft^2
a = alpha*S;# in sabins
T = (0.049*V)/a; # reverberation time in s
#400 people present in the auditorium, 1 person is equivalent to 4.5 sabins
a1 = a+ 400*4.5; # in sabins
T1 = (0.049*V)/a1;# reverberation time in s
#results
print "For auditorium reverberation time (s) = ",T
print "When people are present, reverberation time (s) = ",round(T1,2)
#pg 564
#calculate the absorption coefficients
#Given :
V = 9.*10*11; # Volume in ft^3
T = 4.; # reverberation time in s
S = 2*((9*10.)+(10*11)+(11*9));# total surface area in ft^2
S1 = 50.; # total surface area in ft^2
T1 = 1.3; # reverberation time in s
#calculations
#T = (0.049*V)/(alpha*S)
alpha = (0.049*V)/(S*T);#average absorption coefficient
alpha_e =(((0.049*V)/S1)*((1/T1)-(1/T))) + alpha ; # effective absorption coefficient
#results
print "alpha = ",round(alpha,2)
print "alpha_e = ",round(alpha_e,2)
#pg 565
#calculate the frequency
#Given :
v = 343.; # velocity of sound in m/s
lambd = 1; # wavelength in cm
# 1 cm = 1.0*10^-2 m
#calculations
f = v/(lambd*10**-2); #frequency in Hz
#results
print "Frequency is (kHz) = ",f*10**-3
#pg 568
#calculate the frequency required
#Given :
import math
from math import sqrt
E1 = 8.55*10**10; #Modulus of elasticity in N/m**2
E2 = 21.*10**10; # Modulus of elasticity in N/m**2
rho1 = 2650.; # density of Quartz in kg/m**3
rho2 = 8800.;# density of Nickel in kg/m**3
t = 2.; # thickness of crystal in mm
l = 50.; # rod length in mm
#Piezoelectric generator
#calculations and results
print ("Piezoelectric generator");
for n in range(1,4):
# 1 mm = 1.0*10**-3 m
nu1 = (n/(2*t*10**-3))*sqrt(E1/rho1);# frequency in Hz
print "For n =",n,", Frequency (MHz) = ",round(nu1*10**-6,2)
#Magnetostriction generator
print "Magnetostriction generator"
for n1 in range (1,4):
# 1 mm = 1.0*10**-3 m
nu2 = (n1/(2*l*10**-3))*sqrt(E2/rho2);# frequency in Hz
print "For n =",n1,", Frequency (kHz) = ",round(nu2*10**-3,1)
print 'Results differ from those in textbook, because in the formulae (n/(2*t))*sqrt(E/rho) and (n/(2*l))*sqrt(E/rho) , 2 is not multiplied with either t or l.'
#pg 569
#calculate the Amplified Rock Music, Jet plane and Rocket engine
#Given :
I0 = 10**-12; # in W/m**2
beta1 = 110.; # in dB
beta2 = 150.;# in dB
beta3 = 180.; # in dB
#calculations
# Intensity level = beta = 10*log10(I/I0)
I1 = 10**(beta1/10)*I0; # Intensity in W/m**2
I2 = 10**(beta2/10)*I0; # Intensity in W/m**2
I3 = 10**(beta3/10)*I0; # Intensity in W/m**2
#results
print "Amplified Rock Music (W/m^2) = ",I1
print "Jet plane ",I2*10**-3,"x 10^3 W/m^2 "
print "Rocket engine :",I3*10**-6,"x 10^6 W/m^2"
#pg 572
#calculate the depth required
#Given :
v = 1500.; # velocity of ultrasound in m/s
rt = 0.8; # recorded time in s
#calculations
t = rt/2.; # time in s
#Ultrasound velocity = D/t
D = v*t; # sea depth in m
#results
print "Depth (m) = ",D