Waves (comments to: moloney@nextwork.rose-hulman.edu)
MAPLE
text, input lines and worksheet downloads
| This is a problem of dispersion of sound waves on a piano wire.The
dispersion relation of the piano wire is: (omega)^2/(k)^2=T/mu+alpha*(k^2),
where omega is the angular frequency, k the wave vector, T the tension
of the string, and alpha a small constant value. Let us take several individual
waves and observe the wave group behavior.
The small individual 'phase' peaks move forward through the envelope or 'group peak. |
![]() |
The small individual 'phase' peaks move forward through the envelope or 'group peak.
restart; with(plots):
d:=omega^2/k^2=T/(mu)+alpha*k^2;
for n from 0 to 10 do y.n:=sin((k+n*k1)*x-(omega+n*omega1)*t); od;
psi:=simplify(convert({y.(0..10)},`+`),trig);
sol:=solve(d,omega);
v[p]:=simplify(sol[1]/k);
vg:=diff(v[p],k)=omega1/k1; vgr:=solve(vg,omega1);
vphase_over_vgroup:=v[p]/vgr;
psifin:=subs({omega1=solve(vg,omega1),omega=sol[1]},psi);
values:={k=5,k1=5/10,alpha=2/10,T=3,mu=1/100}; m:=subs(values,psifin);
animate(m,x=10..20,t=0..0.2,color=blue,frames=20,numpoints=100); # the
small peaks move forward thru the envelope
The individual peaks come up and move through the 'envelope' or 'group' peak, showing vphase>vgroup
vgval:=evalf(subs(values,lhs(vg)));
vpval:=evalf(subs(values,v[p]));
ratio:=vpval/vgval;
Download piano.mws [Use 'Save File']
Wave Packet Problem RAYtrace.mws
2D Paraxial Ray Trace ABW 7/21/95
Learning objectives: Visualize propagation of multiple rays through simple system
Physical intuition regarding image formation
MAPLE: linalg[matrix], evalm, &*, for..from..to..do..od, plot
| Procedure traces five rays through two lenses
Definition of Variables: x = position along optic axis f = focal length of lens L = distance between lenses y1 = initial height of ray 1 phi1 = initial inclination of ray 1 x0 = start of ray trace xmax = end of ray trace r[i][y[i],phi[i]] = vector with components of height (y) and angle (phi) of ray number i . |
![]() |
restart: with(linalg): with(plots):
##Calculate separations needed for calculations
L1:=x1-x0:L2:=x2-x1:L3:=xmax-x2:
## Calculate matrices that propagate rays
m1:=matrix(2,2,[1,L1,0,1]): #translate ray from
object to first lens m2:=matrix(2,2,[1,0,-1/f1,1]): #bend
ray at first lens
m3:=matrix(2,2,[1,L2,0,1]): #translate from
first lens to second lens m4:=matrix(2,2,[1,0,-1/f2,1]): #bend
ray at second lens
m5:=matrix(2,2,[1,L3,0,1]): #translate to
end of trace
## Define and propagate [height, angle] coordinates for rays
for i from 1 to 5 do
r0[i]:=matrix(2,1,[y[i],phi[i]]):
r1[i]:=evalm(m1&*r0[i]):
r2[i]:=evalm(m2&*r1[i]):
r3[i]:=evalm(m3&*r2[i]):
r4[i]:=evalm(m4&*r3[i]):
r5[i]:=evalm(m5&*r4[i]): od:
## Calculate the (x,y) coordinates of each ray
for i from 1 to 5 do
ray[i]:=[[x0,y[i]],[x1,r1[i][1,1]],[x2,r3[i][1,1]],[xmax,r5[i][1,1]]]:
#x,y pairs for rays
od:
############### Input Numerical Values for Particular System ###########
x0:=0: xmax:=35: # start and end points of plot
# describe the position and focal length of each lens
x1:=10: f1:=5: #lens
1
x2:=25: f2:=15: #lens
2
#specify the initial height and angle of each ray
y[1]:=1:phi[1]:=0: y[2]:=1:phi[2]:=0.5: y[3]:=1:phi[3]:=-.5:
y[4]:=1:phi[4]:=0.25: y[5]:=1:phi[5]:=-0.25:
plot({ray[1],ray[2],ray[3],ray[4],ray[5]},x=15..xmax, title=`Paraxial Ray
Trace`);
Download raytrace.mws [Use 'Save File']
26 Aug 95 An array of hydrophones tracks a russian submarine
Red October submarine (S) is at (8000,0) m when t=0. Its velocity in the y-direction is 10 knots. She has a problem and is radiating sound at a frequency of 3 khz. Your boat has 15 detectors, spaced 0.25 m apart in the y-direction.
a) Write an expression for location of S as a function of time.
b) Determine the distance L[i] from the moving source S to each detector, as a function of the time.
c) Show that at t=0 the distances are the same to a very small fraction of a wavelength.
d) Find the resultant wave R from all 15 detectors as a function of the time
e) Plot the amplitude of R as a function of time from t=-300 s to t=+300s.
Note the time when the detector signal falls to zero.
restart; with(plots): assume(k>0,wavelength>0,t>0);
wavelength:=1500/3000; k:=2*Pi/wavelength;
X:=8000; Y:=t*10*2000*36*100/(3937*3600); N:=15; m:=trunc(N/2);
Determine the distances L[i] from the source to each detector element
for i from 1 to N do L[i]:=sqrt( (Y-spacing*(N-i-m))^2 + X^2); od:
Check that distances are all 'same' well within a wavelength at t=0.
for i from 1 to N do evalf(subs(spacing=1/4,t=0,L[i]) ); od;
Let t=0 and get magnitude of resultant; first obtain x and y components of the resultant, then square.
R_x:=0: R_y:=0:
for i from 1 to N do R_x:=R_x+A*cos(k*L[i]); R_y:=R_y+A*sin(k*L[i]); od:
Rsquared:=R_x^2+R_y^2: values:={A=1,spacing=1/4};
Substitute problem values into the resultant vector squared. This will depend on time since L's do
g:=subs(values,Rsquared): plot(g,t=-100..300,numpoints=200);R_x:=0: R_y:=0:
The signal is a max at t=0 and fades to zero in around 200 sec.
Download redoctbr.mws [Use 'Save File']
20 Aug 95 Note: This problem should be done only after the 'detect'
problem has been done.
Two sources of radio waves in the sky are located at theta =0.600 radians and at theta = 0.67 radians, each at a distance of 10^9 m from a line of N equally-spaced detectors along the y-axis. The detector spacing is 0.10 m, the wavelength is 0.21 m, and the initial number of detectors is N=7.
a) Using what you learned from the 'detect' problem, create two source response functions s1 and s2. Plot both of these together, and also the sum of the two responses, all on the same graph of response vs phase delay D. This is the same type of plot done in 'detect'.
b) By plotting just where the responses are large, determine an accurate value for the angular distance between the peak of one response, and the nearby angle where the response is zero.
c) Draw a sketch of 7 phasors such that their resultant is exactly zero.
d) What angle between adjacent phasors is there in your sketch? Compare this to what you found in part a)
e) Determine the minimum number of detectors N in the array for you to be 'just able' to tell that there are two nearby sources in the sky, and not just one. [Keep the spacing and wavelength and source angles the same.]
restart; assume(k>0,wavelength>0,t>0);
The number of digits is set to 14 because of the 10^9 m distance used later in the problem. It turns out you need at least 4 or 5 more digits available so that the calculated values of kL are accurate. There is a compromise between accuracy and speed. Using more digits improves accuracy, but calculations (and plots) can take a lot longer. Digits:=14:
k:=2*Pi/wavelength: X:=R*cos(Theta): Y:=R*sin(Theta):
N:=7: m:=trunc(N/2):
Determine the distances L[i] from the source to each detector element
for i from 1 to N do L[i]:=sqrt( (Y-spacing*(N-i-m))^2 + X^2); od:
R_x:=0: R_y:=0:
Let t=0 and get magnitude of resultant; first obtain x and y components
of the resultant, then square.
for i from 1 to N do
R_x:=R_x+A*cos(k*L[i]-D*(i-1)):
R_y:=R_y+A*sin(k*L[i]-D*(i-1)): od:
Rsquared:=R_x^2+R_y^2:
values:={R=1*10^9,A=1,spacing=0.10,wavelength=0.21}:
Substitute problem values into the resultant vector squared, except for theta value
g:=subs(values,Rsquared):
Now create the response function from source #1 and #2 in the sky, and plot both
s1:=subs(Theta=0.600,g): s2:=subs(Theta=0.670,g):
plot({s1,s2,s1+s2},D=0..2*Pi,numpoints=100);
Remarks: Put in semicolons instead of colons to see intermediate output. The plot range wants to be cut down so one gets just the region of interest. To get mouse coordinates in the plot, click the left button. Coords are given at lower left. The angular distance in the initial plot is around 0.9 rad, and it should be 2 Pi/ 7 rad (very close!) Around 40 detectors are needed in the array to resolve the two sources.
Download resolve.mws [Use 'Save File']
Wave Packet Problem RIPPLE.MS 2D Plot of Multiple Source Interference
ABW 08/03/95
Learning objectives: Translation of equation for 2D wave to off-origin
source points Physical intuition regarding interference

Animates wave motion explored in BMSTEER and BMWIDTH MAPLE: for..from..to..do..od, subs, plot3d
Arbitrary units used throughout k0 = wave number a0 = distance between sources phi = is relative phase of adjacent sources A0 = amplitude of individual sources xmax, ymax used to set plot range dimensions
Remarks: Set animation to run continuously! Very nice effect of waves flowing outward from the source. Takes quite a while to run.
restart; with(linalg): with(plots):
for j from 1 to 4 do
m:=(2*j-5)/2: r[j]:=((x-m*a0)^2+y^2)^0.5:
A[j]:=(A0)*cos(k0*r[j]-omega*t+m*phi): od:
A1234:=A[1]+A[2]+A[3]+A[4]: # pattern due
to all four sources
Animate the motion of waves
xmax:=4: ymax:=4: #Set plot area scale
f2:= subs({A0=3, k0=6, a0=0.5, omega=1,phi=0}, A1234):
animate3d(f2, x=-xmax..xmax, y=-ymax/5..9*ymax/5,t=0..6, grid=[40,40],style=patchnogrid,
shading=zgreyscale, scaling=constrained, orientation=[0,0], tickmarks=[0,0,0],frames=12);
Download ripple.mws [Use 'Save File']
( CW and CCW rotating vectors added and animated) [ This version does
not run properly in Maple V release 4]
a) Show that two counter-rotating circular polarizations yield a linearly polarized beam. b) Show that when the two counter-rotating beams travel thround a thickness x of material at different wavelengths, the plane of linearly polarized light is rotated.
Remarks. Circular polarizations give linear polarization oriented horizontally when x=0. But different wavelengths give a phase shift when x>0 so that we get a rotation of the plane of polarization.
By plotting at different colors and thicknesses, then combining and displaying, a more flexible animation is done.
NOTE runs ok in Maple V release 3, but not in release 4.
restart; with(plots): kval:=2*Pi/wavelength;
Two different values of k:
k[2]:=subs(wavelength=11/10,kval); k[1]:=subs(wavelength=1,kval);
Distance x travelled through the medium with different wavelengths. (Change x and restart from here.)
x:=1/80;
clockwise rotating wave
Qx1:=5.0*cos(k[1]*x+3*t+phi[1]);
Qy1:=5.0*sin(k[1]*x+3*t+phi[1]);
counterclockwise rotating wave
Qx2:=5.0*cos(k[2]*x-3*t+phi[2]);
Qy2:=5.0*sin(k[2]*x-3*t+phi[2]);
phi[1]:=0; phi[2]:=0; # initial phases of the
waves
NN:=40; # of pieces in the animation
for i from 0 to NN do
t:=i/10; # t = time
g.(i):=plot([[0,0],[Qx1,Qy1]],color='red',thickness=3):
h.(i):=plot([[0,0],[Qx2,Qy2]],color='blue',thickness=3):
j.(i):=plot([[0,0],[Qx1+Qx2,Qy1+Qy2]],color='black',thickness=5):
s.(i):=display({g.(i),h.(i),j.(i)}): od:
Animation of CW, CCW, and their sum - looks very nice when run continuously Go back and reset the x value to see a 'rotated' plane of polarization
display([s.(0..NN)],insequence=true);
Download rotpol.mws [Use 'Save File']
8/30/95
A 'starter' program in maple release 4 to show how one can animate rotating
and coounter-rotating vectors to obtain a combination which is a linearly
polarized wave.
This is to help in the writing of a program which adds a clockwise and counterclockwise circularly-polarized wave as they travel into a medium where the two circular polarizations have different wavelengths. The new program should show linear polarization along the x-axis (as this program does) when x=0. As x > 0, the program should show that the two circular polarizations add together along a line which is at an angle to the x-axis. The this angle to the x-axis increases with x.
NOTE: 7/6/96 This runs fine in Maple V release 3, but the plots are messed up in release 4.
Qx is the x-component of both the CW and CCW rotating waves.
restart; with(plots):
Qx:=5.0*cos(3*t);
Qy2:=5.0*sin(-3*t);
Qy1:=5.0 * sin(3*t);
Nframes:=20;
for i from 0 to Nframes do
j:=2/Nframes;
g.(i):=plot(subs(t=i*j,[[0,0],[Qx,Qy1]]),color='red',thickness=3):
h.(i):=plot(subs(t=i*j,[[0,0],[Qx,Qy2]]),color='blue',thickness=3):
j.(i):=plot(subs(t=i*j,[[0,0],[Qx+Qx,Qy1+Qy2]]),color='black',thickness=5):
k.(i):=display({g.(i),h.(i),j.(i)}):
od:
display([k.(0..Nframes)],insequence=true);
Download rotvec.mws [Use
'Save File']
stantrav.mws
7/25/95
For all parts of this problem, use a wavelength of 1 m and a frequency of 1 Hz.
a) Create an animation of a wave traveling to the right. Show at least one cycle of the motion.
b) Repeat part a) for a wave traveling to the left, same amplitude as in part a).
c) Repeat part a), adding together the traveling waves to the left and to the right.
d) Repeat part c), but have the amplitudes of the two traveling waves unequal.
e) Write down the equation of a standing wave. Animate this for one or more cycles.
Paste in the plots at the end of each animation on the sheet you turn in. Indicate on the plot what happened during the animation. optional: f) put the two traveling waves (equal amplitudes) and their sum on the same animation
Here is a sample animate command to try out.
restart; with(plots):
wavelength is 1 meter; frequency is 1 hz;
k:=2*Pi; Omega:=2*Pi;
sr:=sin(k*x-Omega*t); # going to the right
sl:=sin(k*x+Omega*t); # going to the left
animate(sr,x=0..2,t=0..1,frames=20,numpoints=200); # traveling wave to
the right
animate(sl,x=0..2,t=0..1,frames=20,numpoints=200); # traveling wave to
the left
animate({sl,sr},x=0..2,t=0..1,frames=20,numpoints=200,color=green); # both
trav waves
animate(sl+sr,x=0..2,t=0..1,frames=20,numpoints=200,color=blue); #
add the trav waves
w:=sin(k*x)*cos(Omega*t); # explicit standing wave
animate(w,x=0..2,t=0..1,frames=20,numpoints=200,color=black);
If you animate several functions at once, you get only one color. Here is a way to animate several things at once, with separate colors and other stuff.
Nframes:=20;
for i from 0 to Nframes-1 do
j:=1/(Nframes):
pr.(i):= plot(subs(t=i*j,sr),x=0..2,numpoints=100,color=red,thickness=2):
pl.(i):= plot(subs(t=i*j,sl),x=0..2,numpoints=100,color=blue):
ps.(i):=plot(subs(t=i*j,sr+sl),x=0..2,numpoints=100,color=black,thickness=3):
ptot.(i):=display({pr.(i),pl.(i),ps.(i)}); od:
display([ptot.(0..Nframes-1)],insequence=true);
Download stantrav.mws [Use 'Save File']
20 Aug 95 An array of detectors tracks a rotating source of radio waves.
[No detector phase delay.]
A source of radio waves in the sky is rotating through the sky at an angular rate of 7.27*10^(-5) rad/sec at a distance of 4.2 *10^9 m from a linear array of detectors. The detector array is along the y-axis, and the source passes through the x-axis at t=0. The spacing between detectors is 2.75 m, the source wavelength is 0.21 m, and the initial number of detectors is N=7.
a) Determine the distance L[i] from the moving source to each detector, as a function of the time.
b) Since the radio waves oscillate around 10^9 times/sec, the distances from source to detector elements change little in the time of one radio-frequency oscillation. An easy way to sum up the detector responses is to select a time t when wt = 2*Pi*(integer). Then from detector 1 we have y = A cos(kL[1]-wt) = A cos(kL[1]-2*Pi*integer) = A cos(kL[1]). At this instant of time it will be fairly simple to add up the detector phasors into a resultant phasor. This resultant phasor rotates at around 10^9 times/sec, but its magnitude will change only slowly as all the L[i] gradually change, due to the source moving through the sky.
Find the resultant phasor amplitude by summing x and y components of the N detectors. This should be straightforward because you already have the L[i].
c) Plot the phasor amplitude squared vs the time to observe the detector response as the source moves across the sky. Let the time run from -1/2 hour to + 1/2 hour. You should see an expected peak at t=0. At what other times do you see a very large peak, as large as the one at t=0? Why do these other peaks occur? > restart;
The number of digits is set to 14 because of the 10^9 m distance used later in the problem. It turns out you need at least 4 or 5 more digits available so that the calculated values of kL are accurate. There is a compromise between accuracy and speed. Using more digits improves accuracy, but calculations (and plots) can take a lot longer.
restart; with(plots):
assume(k>0,wavelength>0,t>0);
Digits:=14: k:=2*Pi/wavelength;
Theta:=(727/100)*10^(-5)*t;
X:=R*cos(Theta); Y:=R*sin(Theta);
N:=7; # start with 7 sources -- can change it later
m:=trunc(N/2);
Determine the distances L[i] from the source to each detector element
for i from 1 to N do L[i]:=sqrt( (Y-spacing*(N-i-m))^2 + X^2); od:
Let t=0 and get magnitude of resultant; first obtain x and y components of the resultant, then square.
R_x:=0: R_y:=0:
for i from 1 to N do
R_x:=R_x+A*cos(k*L[i]);
R_y:=R_y+A*sin(k*L[i]); od:
Rsquared:=R_x^2+R_y^2:
values:={R=1*10^9,A=1,spacing=11/4,wavelength=0.21};
Substitute problem values into the resultant vector squared. This will depend on time since theta does.
g:=subs(values,Rsquared):
plot(g,t=-1800..1800,numpoints=200);
Remarks. The max's are spaced about 1000 sec apart, or around 15 min. [Actually, the angular velocity of the source is that of the rotating Earth. The apparent motion of the source is due to the Earth's rotation. The source is placed beyond the Moon, but closer than the Sun. This is too close to be realistic, but it keeps the computation time down for doing the plot.] The additional max's occur because the detector spacing is much larger than a wavelength. (We are getting 'aliasing' of the detector response.) If the detector array were a transmitter array, we would be seeing different 'orders' of interference from the 'grating' at the various angles.
Download traksrc.mws [Use 'Save File']

bending of wavefronts due to velocity increasing with height. Use a sequence of parametric plots.
restart; with(plots):
N:=20: radius:=5; h:=10;
for k from 1 to N do
circ.k:=[(radius+k/h)*cos(t),k+(radius+k/h)*sin(t),t=-Pi/2..Pi/2];
od:
plot({circ.(1..N)},color=black,title=`wave speed increases with height`);
for k from 1 to N do
circ.k:=[(radius-k/h)*cos(t),k+(radius-k/h)*sin(t),t=-Pi/2..Pi/2];
od:
plot({circ.(1..N)},color=black,title=`wave speed decreases with height`);
Download wvbend.mws [Use 'Save File']
| Bending of wavefronts due to wind speed increasing with height. At
higher elevations the spherical wavefronts are dragged farther to the right
by the wind.
A vertical wavefront heading into the wind will bend upward, as the graph shows, and a vertical wavefront heading away from the wind will bend down, as also shown in the graph. This means that if wind speed increases with increasing height over the water, upwind of a sound source sounds will quickly fade since the wavefronts bend up going into the wind. But downwind of a sound source, the waves bend down and will be heard a great deal farther away. |
![]() |
restart; with(plots):
N:=20: radius:=20; h:=10;
for k from 1 to N do
circ.k:=[k/5+radius*cos(t),2*k+radius*sin(t),t=-Pi..Pi];
od:
plot({circ.(1..N)},color=black,title=`wind speed increases with height`);
Download windbend.mws [Use 'Save File']
Go
to the previous Waves Maple Page
Back
to the Waves Resource Page