#Example 14_1
import math
#To find the speed of sound in neon
gama=1.66 #units in Constant
r=8314 #Units in J/Kmol
t=273 #Units in K
m=20.18 #Units in Kg/Kmol
v=math.sqrt((gama*r*t)/m) #Units in meters/sec
print "The speed of the sound in neon is v=",round(v)," meters/sec"
#Example 14_2
import math
#To find the sound level of a sound wave
i1=10**-5 #Units in W/meter**2
i2=10**-12 #Units in W/meter**2
level=10*math.log10(i1/i2) #units in dB
print "The sound level of the sound wave is=",round(level)," dB"
#Example 14_3
import math
#To find the intensity of sound
level=3.5 #Units in dB
i2=10**-12 #Units in W/meter**2
i=10**(level+math.log10(i2)) #Units in W/meter**2
print "The intensity of sound is I="
print i
print "W/meter**2"
#Example 14_4
import math
#To find how far it has to be moved before the sound becomes weak
lamda=70 #units in cm
lamda1=0.5*lamda #Units in cm
print "The distance it has to be moved is=",round(lamda)," cm"
#Example 14_5
import math
#To find the frequency heard and the receding
f=500 #Units in Hz
vw=340.0 #Units in meters/sec
dist=20 #Units in meters/sec
f1=f*(vw/(vw-dist)) #Units in Hz
print "The frequency we hear is f=",round(f1)," Hz\n"
f1=f*(vw/(vw+dist)) #Units in Hz
print "The frequency of the receding is f=",round(f1)," Hz\n"
#Example 14_6
import math
#To find the difference between the frequency of wave reaching the officer and the car
fo=10**10 #Units in Hz
vw=3*10.0**8 #Units in meters/sec
vc=25 #Units in meters/sec
f1=fo*((vw+vc)/(vw-vc)) #Units in Hz
f1=f1-10**10 #Units in Hertz
print "The difference between the both frequencies is=",round(f1)," Hz"
#In text book answer printed wrong as 1670 Hz correct answer is 1666 Hz