#example 15.1
#calculation of the velocity,function f(t) giving displacement,function g(x) giving shape
#given data
#y = y0*exp-(((t/T) - (x/lambda))**2)
y0=4.*10.**-3.#value of y0(in m)
T=1#value of T(in s)
lambd=4.*10.**-2.#value of lambda(in m)
#calculation
v=lambd/T#velocity of the wave
#by putting x=0 in equation (1)......f(t) = y0*exp-((t/T)**2)
#by putting t=0 in equation (1)......g(x) = y0*exp-((x/lambda)**2)
print '%s %.2f %s' %('the velocity of the wave is',v*10**2,'cm/s\n')
print '%s' %('the function f(t) giving displacement is -->> f(t) = y0*exp-((t/T)**2)\n')
print '%s' %('the function g(x) giving shape of the string at t=0 is --->> g(x) = y0*exp-((x/lambda)**2)\n')
#example 15.2
#calculation of the amplitude,wave number,wavelength,frequency,time period,wave velocity
#given data
#given equation......y = (5mm)*sin((1cm**-1)*x - (60 s**-1)*t)
w=60.#angular frequency
import math
#calculation
A=5.#amplitude(in cm)
k=1.#wave number(in cm**-1)
lambd=(2.*math.pi)/k#wavelength(in cm)
nu=w/(2.*math.pi)#frequency(in Hz)
T=1./nu#Time period(in s)
v=nu*lambd#wave velocity(in cm/s)
print '%s %.2f %s' %('the amplitude is',A,'mm\n')
print '%s %.2f %s' %('the wave number is',k,'cm**-1\n')
print '%s %.2f %s' %('the wavelength is',lambd,'cm\n')
print '%s %.2f %s' %('the frequency is',nu,'Hz\n')
print '%s %.2f %s' %('the time period is',T,'s\n')
print '%s %.2f %s' %('the wave velocity is',v,'cm/s\n')
#example 15.3
#calculation of the time taken by the pulse in travelling through a distance
#given data
import math
m=1.#mass(in kg) of the block
mu=1.*10.**-3.*10.**2.#mass density(in kg/m)
l=50.*10.**-2.#disatnce(in m) travelled
g=10.#gravitational acceleration(in m/s**2) of the earth
#calculation
F=m*g#tension in the string
v=math.sqrt(F/mu)#wave velocity
T=l/v#time taken
print '%s %.2f %s' %('the time taken by the pulse in travelling through a distance of 50 cm is',T,'s\n')
#example 15.4
#calculation of the power transmitted through a given point
#given data
P1=.20#average power(in W)
A1=2.#amplitude(in mm) at this point
A2=3.#amplitude(in mm)
#calculation
#transmitted power is proportional to the square of the amplitude
P2=P1*(A2/A1)**2.
print '%s %.2f %s' %('the power transmitted through the given point is',P2,'W\n')
#example 15.5
#calculation of the phase difference between the waves and amplitude of the resultant wave
#given data
#equations of the wave are
#y1 = A1*sin(k(x-v*t))...........(1)
#y2 = A2*sin(k(x-v*t+x0))........(2)
k=6.28*10.**2.#wave number(in m**-1)
x0=1.50*10.**-2.#value of x0(in m)
A1=5.*10.**-3.#amplitude(in m) of wave 1
A2=4.*10.**-3.#amplitude(in m) of wave 2
#calculation
deltaP=k*x0#phase difference
deltaA=abs(A1-A2)#amplitude of the wave
print '%s %.2f %s' %('the phase difference between the waves is',deltaP,'rad\n')
print '%s %.2f %s' %('the amplitude of the resultant wave is',deltaA*10**3,'mm\n')
import math
#example 15.6
#calculation of the velocity,node closest to origin,antinode closest to origin,amplitude at x
#given data
#equation of the wave is......y = A*cosd(k*x)*sind(w*t)
A=1.#amplitude(in mm)
k=1.57#value of k(in cm**-1)
w=78.5#angular velocity(in s**-1)
x=2.33#value of x(in cm)
#calculation
v=w/k#wave velocity
xn=math.pi/(2*k)#for a node ...cosd(kx) = 0
xa=math.pi/k#for a antinode ...|cosd(kx)| = 1
Ar=A*abs(math.cos(k*x))
print '%s %.2f %s' %('the velocity of the wave is',v,'cm/s\n')
print '%s %.2f %s' %('the node closest to the origin is located at x=',xn,'cm\n')
print '%s %.2f %s' %('the antinode closest to the origin is located at x=',xa,'cm\n')
print '%s %.2f %s' %('the amplitude at x=2.33 is',Ar,'mm\n')
#example 15.7
#calculation of the fundamental frequency of the portion of the string between the wall and the pulley
#given data
import math
m=1.6#mass(in kg) of the load
mw=20.*10.**-3.#mass(in kg) of the wire
l=50.*10.**-2.#length(in kg/m) of wire
g=10.#gravitational acceleration(in m/s**2) of the earth
L=40.*10.**-2.#length(in m) of the string between the wall and the pulley
#calculation
F=m*g#tension in the string
mu=mw/l#linear mass density
nu0=(1./(2.*L))*math.sqrt(F/mu)#fundamental frequency
print '%s %.2f %s' %('the fundamental frequency of the portion of the string between the wall and the pulley is',nu0,'Hz\n')
#example 15.8
#calculation of the length of the experimental wire to get the resonance
#given data
nu1=256.#frequency(in Hz) of the tunning fork 1
nu2=384.#frequency(in Hz) of the tunning fork 2
l1=21.#length(in cm) of the wire for tunning fork 1
#calculation
l2=(nu1/nu2)*l1#law of length
print '%s %.2f %s' %('the length of the experimental wire to get the resonance is',l2,'cm\n')
#example 15.1w
#calculation of the amplitude,wavelength,frequency,speed of the wave
#given data
#given wave equation is.....y = (3.0cm)*sin(6.28(.50*x - 50*t))
#calculation
#comparing with standard equation of wave....y = A*sin*2*%pi*((x/lambda) - (t/T)),we get
A=3.#amplitude(in cm)
lambd=(1./0.50)#wavelength(in cm)
T=1./50.#time period(in s)
nu=1./T#frequency(in Hz)
v=nu*lambd#wave velocity(in cm s**-1)
print '%s %.2f %s' %('the amplitude is',A,'cm\n')
print '%s %.2f %s' %('the wavelength is',lambd,'cm\n')
print '%s %.2f %s' %('the frequency is',nu,'Hz\n')
print '%s %.2f %s' %('the wave velocity is',v,'cm/s\n')
#example 15.2w
#calculation of the maximum velocity and acceleraion of the particle
#given data
#given wave equation is.....y = (3.0cm)*sind((3.14cm**-1)x - (3.14 s**-1)*t))
import math
t=0#time taken(in s)
t1=.11#time(in s) for acceleration
def f(t):
yv = (3.0)*math.sin(-(3.14)*t)
return yv
#calculation
#V = dy/dt
vmax=-9.42;#derivative(f,t)
#vn=(-9.4)*(314)*(sin((3.14*x)+(314*t)))......take x=6(after derivative)...for acceleration at x=6 cm
a=-(2952)*math.sin(6.*math.pi-11.*math.pi)
print '%s %.2f %s' %('the maximum velocity is',vmax,'m/s\n')
print '%s %.2f %s' %('\nthe acceleration at t=0.11 s and x= 6 cm is',a,'cm**2/s\n')
#developed in windows XP operating system 32bit
#calculation of the speed and displacement of the particle
#given data
import math
A=.80*10.**-6.#area(im m**2) of the string
rho=12.5*10.**-3.*10.**6.#density(in kg/m**3)
nu=20.#transverse frequency(in Hz)
F=64.#tension(in N)
#calculation
mu=A*1.*rho#mass of 1 m of the string = linear mass density
v=math.sqrt(F/mu)#wave speed
w=2.*math.pi*nu#angular velocity
#substituting above values equation becomes.....y = (1.0cm)*cos(125*(t-(x/v)))
def f(t,x):
y=1.*math.cos(2.*math.pi*nu*(t-(x/v)))
return y
t=0.05#time taken(in s)
x=50.*10.**-2. #displacement(in m)
yn=f(t,x)
def yfv(t,x):
yfv=1*math.cos(2*math.pi*nu*(t-((50.*10.**-2.)/v)))
return yfv
vn=88.9;#derivative(ffv,t)
print '%s %.2f %s' %('the wave speed is',v,'m/s\n')
print '%s %.2f %s %.2f %s' %('the wave equation is --->> y = (1.0cm)*cos(',w,'*(t-(x/',v,')))\n')
print '%s %.2f %s' %('the displacement of the particle at x=50 cm at time t=0.05 s is',yn,'cm\n')
print '%s %.2f %s' %('the velocity of the particle at that position is',round(vn),'cm/s\n')
#example 15.4w
#calculation of the extension of the wire over its natural length
#given data
m=5.*10.**-3.#mass(in kg) of the wire
L=50.*10.**-2.#length(in cm) of the wire
v=80.#speed(in m/s) of the wave
Y=16.*10.**11.#Young modulus(in N/m**2)
A=1*10**-6#area(in m**2) of cross section of the wire
#calculation
mu=m/L#linear mass density
F=mu*v**2#tension in the wire
deltaL=(F*L)/(A*Y)#extension in the length of wire
print '%s %.2f %s' %('the extension of the wire over its natural length is',deltaL*10**3,'mm\n')
#example 15.5w
#calculation of the wavelength of the pulse when it reaches the top of the rope
#given data
import math
lr=12.#length(in m) of the rope
mr=6.#mass(in kg) of the rope
mb=2.#mass(in kg) of the block
lambd=.06#wavelength(in m) of the wave produced at the lower end
#calculation
#from equation .......v = nu*lambda
#putting v = sqrt(F/lambda)....we get
#sqrt(F/lambda) = nu*sqrt(mu)....using this equation,we get
lambda1=lambd*math.sqrt((mr+mb)/mb)
print '%s %.2f %s' %('the wavelength of the pulse when it reaches the top of the rope is',lambda1,'m\n')
#example 15.6w
#calculation of the displacement of the particle
#given data
#given equations are
#y1 = (1.0 cm)*sin((3.14 cm-1)*x - (157 s**-1)*t)...........(1)
#y2 = (1.5 cm)*sin((1.57 cm-1)*x - (314 s**-1)*t)...........(2)
#calculation
import math
def f1(t,x):
y1=1.*math.sin((3.14*x)-(157*t))
return y1
def f2(t,x):
y2=1.5*math.sin((1.57*x)-(314*t))
return y2
x=4.5#given value of x(in cm)
t=5.*10.**-3.#given value of t(in s)
#y = y1 + y2.......net displacement
y=f1(t,x)+f2(t,x)
print '%s %.2f %s' %('the displacement of the particle at x=4.5 cm and t=5.0 ms is',y,'cm\n')
#example 15.7w
#calculation of the maximum displacement,wavelengths and wave speed,velocity,nodes and antinodes,number of loops
#given data
#given equation is ....y = (5.00 mm)*sin(1.57 cm**-1)*sin((314 s**-1)*t)
#calculation
#at x=5.66 cm
import math
A=(5.*10.**-3.)*math.sin(1.57*5.66)#amplitude
k=1.57#value of k(in cm**-1)
w=314.#angular frequency(in s**-1)
lambd=(2.*math.pi)/k#wavelength
nu=(w)/(2.*math.pi)#frequency
#v = dy/dt = (157 cm/s)*sin(1.57 cm**-1*x)*cos((314 s**-1)*t)
def f(t,x) :
v=157*math.sin(1.57*x)*math.cos((314)*t)
return v
x=5.66#value of x (in cm)
t=2.#value of t (in s)
vn=f(t,x)#velocity of the particle
#for nodes......sin(1.57 cm**-1)*x = 0..........gives x=2*n
#since l=10 cm..nodes occur at 0 cm,2 cm,4 cm,6 cm,8 cm,10 cm
#antinodes occur in between at 1 cm,3 cm,5 cm,7 cm,9 cm
nloops=10.*(1./2.)
print '%s %.2f %s' %('the amplitude is',10**3*A,'mm\n')
print '%s %.2f %s' %('the wavelength is',lambd,'cm\n')
print '%s %.2f %s' %('the velocity is',vn,'cm/s\n')# Textbook Correction : correct answer is 76.48 cm/s
print '%s' %('nodes occur at 0 cm,2 cm,4 cm,6 cm,8 cm,10 cm\n')
print '%s' %('antinodes occur in between at 1 cm,3 cm,5 cm,7 cm,9 cm\n')
print '%s %.2f %s' %('the number of loops is',nloops,'\n')
#example 15.8w
#calculation of the pressing in the guitar to produce required fundamental frequency
#given data
L1=90.#length(in cm) of the guitar string
nu1=124.#fundamental frequency(in Hz) for L1
nu2=186.#required fundamental frequency(in Hz)
#calculation
#from equation of fundamental frequency....nu = (1/(2*L))*sqrt(F/mu)
L2=L1*(nu1/nu2)
print '%s %.2f %s' %('the pressing in the guitar to produce the fundamental frequency of 186 Hz is',L2,'cm\n')
#example 15.9w
#calculation of the position of bridges in sonometer wire
#given data
#nu1 : nu2 : nu3 = 1 : 2 : 3
L=1.#length(in m) of the sonometer wire
m1=1.#taking value from ratio
m2=2.#taking value from ratio
m3=3.#taking value from ratio
#calculation
#from formula of fundamental frequency.....nu = (1/(2*L))*sqrt(F/mu)
L1=L/((1./m1)+(1./m2)+(1./m3))#position of bridge 1 from one end
L2=L1/2.
L3=L1/3.#position of bridge 2 from the other end
print '%s %.2f %s' %('the position of bridge 1 from one end is',L1,'m\n')
print '%s %.2f %s' %('the position of bridge 2 from the other end is',L3,'m\n')
#example 15.10w
#calculation of the length of the wire
#given data
import math
mu=5.*10.**-3.#mass density(in kg/m) of the wire
F=450.#tension(in N) produced in the wire
nu1=420.#frequency(in Hz) of nth harmonic
nu2=490.#frequency(in Hz) of (n+1)th harmonic
#calculation
#from formula of fundamental frequency.....nu = (1/(2*L))*sqrt(F/mu)......(1)
n=nu1/(nu2-nu1)#value of n
L=(n/(2.*nu1))*math.sqrt(F/mu)#erom equation (1)
print '%s %.2f %s' %('the length of the wire is',L,'m\n')