# Chapter 12, Doppler's Effect¶

## Example 1, page 457¶

In :
from __future__ import division
# Speed
#given data :
vl=166 #m/s
v=(2*vl) #m/s
print "Speed = %0.f m/s " %v

Speed = 332 m/s


## Example 2, page 458¶

In :
# frequency
#given data :
f1=90 #vibrations/second
f2=(1+(1/10))*f1 #vibrations/s
print "Frequency = %0.f vibrations/s "%f2

Frequency = 99 vibrations/s


## Example 3, page 458¶

In :
# frequency
#given data :
N=400 #hZ
V=340 #M/S
VS=60 #M/S
N2=((V/(V-VS))*N) #Hz
print "Frequency when engine is approaching to the listner = %0.f Hz " %round(N2)
N3=((V/(V+VS))*N) #Hz
print "Frequency when engine is moving away from the listner = %0.f Hz " %N3

Frequency when engine is approaching to the listner = 486 Hz
Frequency when engine is moving away from the listner = 340 Hz


## Example 4, page 459¶

In :
#WAVELENGTH
x=1/5 #
h=60 #cm
h1=((1-x)*h) #cm
h2=((1+x)*h) #cm
print "Wavelength of waves in north-direction = %0.f cm " %h1
print "Wavelength of waves in south-direction = %0.f cm" %h2

Wavelength of waves in north-direction = 48 cm
Wavelength of waves in south-direction = 72 cm


## Example 5, page 460¶

In :
#frequency
v=340 #m/s
n=600 #Hz
vs=36 #km h**-1
vs1=vs*(1000/3600) #m/s
apf=((v)/(v-vs1))*n #Hz
vs2=54 #km h**-1
vs3=vs2*(1000/3600) #m/s
apf1=((v)/(v+vs3))*n #Hz
print "Two apparent frequencies are",round(apf,1),"Hz and",round(apf1,2),"Hz."
df=apf-apf1 #Hz
print "Difference in frequencies = %0.2f Hz" %df
#second apparent frequency and difference is calculated wrong in the textbook

Two apparent frequencies are 618.2 Hz and 574.65 Hz.
Difference in frequencies = 43.53 Hz


## Example 6, page 460¶

In :
#frequency
v=330 #m/s
n=500 #Hz
vs=30 #km h**-1
vs1=vs*(1000/3600) #m/s
n3=((v+vs1)/(v-vs1))*n #Hz
print "Frequency when cars are approaching = %0.f Hz " %round(n3)
n1=((v-vs1)/(v+vs1))*n #Hz
print "Frequency when cars have crossed = %0.f Hz" %round(n1)

Frequency when cars are approaching = 526 Hz
Frequency when cars have crossed = 475 Hz


## Example 7, page 461¶

In :
#frequency
v=330 #m/s
n=600 #Hz
vs=20 #m/s
apf=((v)/(v+vs))*n #Hz
print "Frequency when source is moving away from the observer = %0.f Hz " %round(apf)
apf1=((v)/(v-vs))*n #Hz
print "Frequency when siren reaching at the cliff = %0.f Hz " %round(apf1)
bf=apf1-apf #Hz
print "Beat frequency = %0.f Hz " %round(bf)

Frequency when source is moving away from the observer = 566 Hz
Frequency when siren reaching at the cliff = 639 Hz
Beat frequency = 73 Hz


## Example 8, page 461¶

In :
from math import pi
#frequency
r=3 #m
w=10 #s**-1
vs=r*w #m/s
A=6 #m
fd=5/pi #s**-1
vmax=A*2*pi*fd #m/s
v=330 #m/s
n=340 #Hz
nmax=((v+vmax)/(v-vs))*n #Hz
nmin=((v-vmax)/(v+vs))*n #Hz
print "Maximum frequency = %0.f Hz " %nmax
print "Minimum frequency = %0.f Hz " %nmin

Maximum frequency = 442 Hz
Minimum frequency = 255 Hz


## Example 9, page 462¶

In :
#speed
n12=3 #
n=340 #Hz
v=340 #m/s
vs=((n12*v)/(2*n)) #m/s
print "Speed = %0.2f m/s " %vs

Speed = 1.50 m/s


## Example 10, page 463¶

In :
from math import sqrt
#frequency
sa=1.5 #km
oa=1 #km
so=sqrt(oa**2+sa**2) #km
csd=sa/so #
v=0.33 #km/s
n=400 #Hz
vlov=120*(1000/3600) #m/s
vs1=(1/30)*csd #km/s
nd=((v)/(v-vs1))*n #vibrations/sec
print "Apparent frequency = %0.f vibrations/second  " %round(nd)

Apparent frequency = 437 vibrations/second


## Example 11, page 464¶

In :
#frequency
v=1200 #km/h
w=40 #km/h
vs=40 #km/h
n=580 #Hz
nd=((v+vs)/((v+vs)-vs))*n #Hz
print "Frequency of the whistle as heared by an observer on the hill = %0.2f Hz " %nd
x=29/30 #km
print "Distance = %0.2f m " %(x*1000)
ndd=((v-w)+vs)/((v-w))*nd #Hz
print "Frequency heared by driver = %0.2f Hz " %ndd
#distance is calculated wrong in the textbook

Frequency of the whistle as heared by an observer on the hill = 599.33 Hz
Distance = 966.67 m
Frequency heared by driver = 620.00 Hz


## Example 12, page 469¶

In :
#doppler shift and velocity
h1=6010 #Å
h2=6000 #Å
ds=h1-h2 #Å
print "Doppler shift = %0.f Å " %ds
c=3*10**8 #m/s
v=((ds/h2)*c) #m/s
print "Speed = %0.e m/s " %v

Doppler shift = 10 Å
Speed = 5e+05 m/s


## Example 13, page 469¶

In :
#doppler shift and velocity
h1=3737 #Å
h2=3700 #Å
ds=h1-h2 #Å
print "Doppler shift = %0.f Å " %ds
c=3*10**8 #m/s
v=((ds/h2)*c) #m/s
print "Speed = %0.e m/s " %v
#speed is  calculated wrong in the textbook

Doppler shift = 37 Å
Speed = 3e+06 m/s


## Example 14, page 469¶

In :
#speed
dv=10**3 #Hz
v=5*10**9 #Hz
c=3*10**8 #m/s
v=((dv)/(2*v))*c #m/s
print "Velocity = %0.f m/s " %v

Velocity = 30 m/s