Traveling Waves & Superpostion

Joseph E. McEwen, (c) 2020

version 0.1

This is a first draft, therefore errors are likley. Please alert me to any mistakes.

This notebook is not be shared by any other person besides the author. Do not distribute outside the physics 223 class.

Students should ignore code and pay attention to text, figures, and annimations.

These do not substitute your noraml textbook reading

In [1]:
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
from matplotlib import animation
from IPython.display import HTML

from numpy import pi, sin, cos
from traveling_wave_funcs import plot_traveling_wave, traveling_wave, animate_wave, plot_super
from superposition_animations import animate_super, animate_interference

what is $D(x,t)$

The displacemennt $D(x,t)$ is the vertical displacment of the wave at the position $x$ and time $t$, i.e., it is the value of the wave in the y-direction at a specific x-location and time-location. A diffuculty here, is that $D(x,t)$ is multivariate (a function of more than one variable). To think about or visualize $D(x,t)$ it is convienent to consider snapshots of the wave at different points in time. We will do this in figures 1 & 2 below. But, before we do, we will spend some time talking about the expression for a traveling wave.

observing a traveling wave

What can we learn by observing a traveling wave? We can do several things.

One, we can measure the wavelength, $\lambda$, by observing where the wave repeats intself in the x-direciton. Mathematically, this is $D(x,t)= D(x + \lambda,t)$.

We could also pick a fixed point in the x-direction and measure the time it takes for the wave to repeat itself, this is the period $T$. Mathematically, this is $D(x,t)=D(x, t+ T)$.

Third, we could measure the maximum displacement of the wave in the vertical direction, this is the amplitude $A$.

With the period and wavelength in hand we could determine the velocity (actually the phase velocity of the wave). \begin{align} v = \frac{\lambda}{T}= \lambda f ~. \end{align}

mathematical form of the traveling wave

The mathematical form of the traveling wave is \begin{align} D(x,t) = A \sin (kx - \omega t + \phi_0)~, \end{align} where $k=2\pi/\lambda$ is the wave number, $\omega=2 \pi f = 2\pi/T$ is the agular frequency, and $\phi_0$ is the phase shift. The phase of the wave is $\phi=kx-\omega t + \phi_0$.

problem -1

What are the units for $k,~\lambda,~\omega,~f,~T,~A$? (You should not have to look these up.)

We should note that no part of the material of the wave is moving in the x-direction. For example, if we excited travleing waves on a rope, segements of the rope only move in the vertical direction. However, parts of the wave appear to be moving rightward because your mind follows points at fixed vertical distance $D$. This type of wave is an example of transverse wave, the displacement is perpendicular to the direciton of propagation.

problem 0

What are examples of transeverse waves and longitudinal waves?

Fig 1.

In the first figure we plot a traveling wave with no phase shift. The output is 6 panels.

The first 5 panels, from top to bottom plot the wave at 5 different times $t=[0,T/4,T/2,3T/4,T]$. A red dot and a green dot are tracked on the wave, the distance between the red dot and the green dot is one wavelength. The red and green dots are marked by keeping the vertical distance constant. The distance traveld by the red and green dots is $v t$, but we should be sure to remember that there is actually no motion in the x-direction, the movement is from tracking the constant displacement y-position as a function of $x(t)$.

A blue dot in the first five panels marks the displacement at constant $x=6.5$ (an x-position chosen randomly). You should observe that the blue dot returns to it's original value after one period.

The sixth panel, bottom, shows the movement of the blue dot through time.

In [2]:
plot_traveling_wave(10,2,3,0)

problem 1

What is the amplitude, wave number $k$, wavelength $\lambda$, angular frequency $\omega$, frequency $f$, and period $T$ of the traveling wave in figure 1.

Fig 2.

Figure 2 is the same as figure 1, but now the phase angle is non-zero. Be sure to observe the simmilarities and difference between figures 1 and 2.

In [3]:
plot_traveling_wave(10,2,3,pi/4)

problem 2

Estimate (to the best of your abilty by sight) the phase shift (in radians) of the traveling wave in figure 2.

Building up the Mathematical Model

Let us imagine that we have a very long rope pulled taut. The left end of the rope is attached to a piston that moves up and down with an amplitude $A$ and a frequency $f$. (You can equally imagine that your hand is the piston moving one end of the rope up and down.) Therefore we can describe the vertical position of the left end of the rope as $D(x=0,t)=A \cos(\omega t)$. The movement of the left end of the rope will excite a travleing wave on the rope. The frequency of the wave is equal to the frequency of the source, this is general phenomena, the frequency of the disturbance is equal to the frequency of the source. In this case the source is the moving piston (or your hand if you prefer that analogy).

problem 3

How are $f$ and $\omega$ related? So, it does make sense to write $A \cos(\omega t)$ in the paragraph above even though the frequency of the piston is $f$.

As the piston moves up and down a traveling wave on the rope will move to the right. A traveling wave is periodic is both space and time. Therefore the displacement of the wave at some time $t$ at postion $x$ must be equal to the displacement of the wave at $x=0$ at some earlier time $t^*=t- x/v$. Thus $D(x,t)=D(0,t^*)= A \cos(\omega(t-x/v)) = A \cos(\omega t - \omega x/v)$. Defining $k=\omega/v$ or $v=\omega/k$, we have $D(x,t)= A \cos(\omega t - kx)$.

Of course a phase shift could always be thrown in. A phase shift simply sets the value of the cosine function at $t=0$. But, we could also include a phase shift that swaps a cosine for a sine, since, sines and cosines have the same shape but are shifted by $\pi/2$. So, we could equally write our traveling wave expression as \begin{align} D(x,t) = A \sin(kx - \omega t + \phi_0)~, \end{align} which now matches the expression in the book by Knight.

The animation below shows a traveling wave with two points marked on it. The red dot follows the disturbance of the medium (perhaps one segment of a rope) at a constant $D(x,t)$ value. It is the motion of the red dot that gives the impression that something is moving to the right. The blue dot is the motion of a segment of the medium (perhaps one segment of the rope) through time. The blue dot only moves up and down, as this is the the only actual motion of medium. Tracking the time it takes the blue dot to return to its orginal location would be a measurement of the period $T$.

In [4]:
anim=animate_wave(10,.5,4.3,pi/4)
#anim.save('traveling_wave.mp4')
HTML(anim.to_html5_video())
Out[4]:

Superpostion

Waves obey a superpostion principle, \begin{align} D(x,t)= D_1(x,t) + D_2(x,t), \end{align} where $D_1$ and $D_2$ are two traveling waves. The figure below shows snapshots of the super postion of two traveling waves. The frist wave is colored blue, the second red, and the superpostion of the two in black. These snapeshots are at a fixed time (that is part of the definition of term snapshot). The horizontal axis represents the postion $x$. We need to be sure that we understand that the superpostion of the two waves means the resulting wave is the addition of the two waves at each point in space and time. To help you undestand this, I have included a blue vertial line (I randomly selected a point in space). This way you can follow one specific point in space to see the addition.

Below is snapshot of the superpostion of two idential traveling waves. This is an example of what we call complete constructive interference.

problem 4

What is the amplitude, wavelength, wave number, and phase shift of each of the waves below? Can you determine the frequency and period from the figure?

In [5]:
plot_super(1,1,10,10,3,3,0,0)

Below is an example which one of the waves has a non-zero phase shift. This is an example of complete destructive interference.

problem 5

What is the amplitude, wavelength, wave number, and phase shift of each of the waves below?

problem 6

In your own words define complete constructive and destructive interference.

In [6]:
plot_super(1,1,10,10,2,2,0,pi)

Below is a more complicated example. We will talk about the details of an example like this latter in these notes.

problem 6

What is the amplitude, wavelength, and wave number of the waves $D_1$ and $D_2$ below?

In [7]:
plot_super(2,4,10,10,2,5,pi/10,pi/3)

The Mathematics of Interference

Consider two traveling waves with the same wave number $k$ and same angular frequencey $\omega$. However, we don't require the sources for the two waves to be at the same location or for the two waves to have the same phase shift. The distance from source 1 to the observer is $x_1$ and the distance from source 2 to the observer is $x_2$. The phase shifts will be denoted as $\phi_{1,0}$ and $\phi_{2,0}$.

The phase of a traveling wave is $\phi = kx - \omega t + \phi_0$. The difference in phases at the observation location is \begin{align} \begin{split} \Delta \phi & = \phi_2 - \phi_1 \\ & = kx_2 - \omega_t + \phi_{2, 0} - k x_1 + \omega t - \phi_{1,0} \\ & = k \Delta x - \Delta \phi_0~, \end{split} \end{align} where $\Delta x= x_2- x_1$ and $\Delta \phi_0 = \phi_{2,0} - \phi_{1,0}$.

problem 7

Show that $\Delta \phi$ can also be written as $\Delta \phi = 2\pi \Delta x/\lambda - \Delta \phi_0$.

Sine functions repeat themselves everytime the phase is a multiple of $2\pi$, $\sin(\phi) = \sin(\phi + m 2 \pi)$, where $m=0,1,2,3,...$. Multiples of $\pi$, however, introduce an overall negative sign $\sin(\phi) = -\sin(\phi + m \pi)$, where $m=0,1,2,3,...$.

problem 8

Randomly pick three angles between 0 and $2 \pi$. Write down these angles. Write down the value of sine for each angle. Then add $\pi$ and $2\pi$ to each angle. Write down the values of sine for each of these angles.

problem 9

Make an argument, your own, not the book's, that the criteria for complete constructive and destructive interference is

\begin{align} \frac{2 \pi}{\lambda} \Delta x- \Delta \phi_0 = m 2 \pi~, \quad m=0,1,2,3,...,\quad \text{constructive interference} \end{align}

\begin{align} \frac{2 \pi}{\lambda} \Delta x - \Delta \phi_0 = (m +\frac{1}{2})2 \pi~, \quad m=0,1,2,3,...\quad \text{destructive interference} \end{align}

problem 10

Suppose $\Delta \phi_0=0$ and $\lambda=10 ~m$. What is the minimum non-zero value for $\Delta x$ so that two waves will constructively interfere? What is another non-zero value $\Delta x$ that will also give constructive interference?

problem 11

Suppose $\Delta \phi_0=\pi$ and $\lambda=10 ~m$. What is the minimum value for $\Delta x$ so that two waves will destructively interfere? What is another value $\Delta x$ that will also give destructive interference?

Modulation of the Amplitude and Beats

We will continue to stick with the case in which the two waves have the same wave number and frequency and the same amplitude, but the locations of the sources can differ as well as the phase shifts. Let's work on the full mathematics of this situation \begin{align} \begin{split} D & = D_1 + D_2 \\ & = A \sin(kx_1 - \omega t + \phi_{1,0} ) + A \sin(kx_2 - \omega t + \phi_{2,0} )~. \\ \end{split} \end{align}

problem 12

Use the trig identity $\sin \alpha + \sin \beta = 2 \cos[\frac{1}{2}(\alpha - \beta)] \sin[\frac{1}{2}(\alpha +\beta)]$ to show that $$D= \left[ 2 A \cos\left( \frac{\Delta \phi}{2}\right) \right]\sin(k x_{avg} - \omega t + \phi_{0,avg} ) ~, $$ where $x_{avg}= (x_1 + x_2)/2$ and $\phi_{0,avg}= (\phi_{1,0} + \phi_{2,0})/2$. We can consider the composite amplitude to be \begin{align} \left[ 2 A \cos \left(\frac{\Delta \phi}{2} \right) \right] \end{align}

problem 13

Maximum constructive interference is achieved when the magnitude of composite amplitude is a maximum. Maximum destructive interference is achieved when the magnitude of composite amplitude is a minimum. What are the conditions on $\Delta \phi$ for constructive and destructive interference?

We will now consider the case in which the freqeuncies are not the same, but the sources are at the same location $x=0$, and we will consider the waves to have the same phase shifts $\phi_{1,0}= \phi_{2,0}=\pi$, \begin{align} D= A\sin(kx - \omega_1 t + \pi) + A\sin(kx - \omega_2 t + \pi)~. \end{align}

problem 14

Using the same trig identity as before, show that the superpostion of the two waves is given by \begin{align} 2 A \cos(\omega_{mod} t) \sin (\omega_{avg} t) ~, \end{align} where $\omega_{mod}= |\omega_1 - \omega_2|/2$ and $\omega_{avg}=(\omega_1 + \omega_2)/2$ (mod stands for modulation).

beats

When the two frequencies $\omega_1$ and $\omega_2$ are very near each other, $\omega_{mod}$ is very small (a large modulation period) and ther term $\cos(\omega_{mod} t)$ very slowly. The consequence is that the term $2 A \cos(\omega_{mod} t)$ proivdes a slowly changing amplitude, called the modulation, while the term $\sin(\omega_{avg} t)$ oscillates very quickly.

The absolute value in the difference in frequencies is the beat frequency $|f_1 - f_2|$. The figure below plots illustrate the beat phenomena. The orange dashed line represents the slowly oscillating modulation. The blue lines represent the full wave that oscillates rapidly with $\omega_{avg}$/

In [8]:
def beat_plot():

    f1=37*1000
    f2=43*1000
    w1=2*pi*f1
    w2=2*pi*f2
    wmod=.5*(w1-w2)
    wavg=.5*(w1+w2)
    A=1

    T=1/f1
    t=np.linspace(0,40*T,2000)

    fig=plt.figure(figsize=(10,5))
    ax=fig.add_subplot(111)
    ax.set_xlabel("time", size=20)
    D=2*A*cos(wmod*t)*sin(wavg*t)
    ax.plot(t,D, label=r"$D(x,t)$")
    ax.plot(t,2*A*cos(wmod*t),"--", label="slow modulation ")
    ax.grid()
    ax.legend(fontsize="large")

beat_plot()

Examples

Below are a set of examples of the superpostion principle at play. There are two traveling waves colored in blue and red. The superposition of the two waves is in black.

standing wave

A standing wave is composed of two traveling waves moving in opposite directions. Observe how the blue and red waves move in opposite directions. Observe how the black wave appears to be have zero velocity.

In [9]:
# standing wave example 
phi1=0
phi2=0

lam1=1
lam2=1
k1=2*pi/lam1
k2=2*pi/lam2

w1=5
w2=-5

a1=10
a2=10
anim=animate_super(a1,a2,k1,k2,w1,w2,phi1,phi2)
HTML(anim.to_html5_video())
Out[9]:

destructive interference

We can have two traveling waves with a phase shift difference of $\pi$ to get complete destructive interference.

In [10]:
# destructive interference example 
phi1=0
phi2=pi

lam1=1
lam2=1
k1=2*pi/lam1
k2=2*pi/lam2

w1=1
w2=1

a1=1
a2=1
anim=animate_super(a1,a2,k1,k2,w1,w2,phi1,phi2)
HTML(anim.to_html5_video())
Out[10]:

Below is an example of when the frequencies of the two waves are different.

In [11]:
f1=3.7/10
f2=4.3/10
w1=1
w2=10

anim=animate_super(10,10,2*pi,2*pi,w1,w2,pi,pi)
HTML(anim.to_html5_video())
Out[11]:
In [12]:
def animate_interference(A,k,omega,x1,x2,phi1,phi2):

    n=300
    n_frames=100

    lam=2*pi/k

    x_obs=4*lam
    xmin=np.min([x1,x2])
    xmax=np.max([x1,x2])

    X=np.linspace(xmin,x_obs,n)

    idx=np.where(X >=xmax)[0]



    X1=X[X >=x1]
    X2=X[X >=x2]
    X3=X[idx]

    T=2*pi/omega
    tmax=4*T
    dt=tmax/n_frames

    fig=plt.figure(figsize=(14,5))

    ax=fig.add_subplot(211)
    ax.grid()
    ax.set_xlim(xmin-1,x_obs)
    ax.set_ylim(-2.5*A, 2.5*A)
    ax.set_ylabel("D(x,t)",size=20)
    ax.set_xlabel("x",size=20)

    ax.axvline(x1,lw=4,color="blue")
    ax.axvline(x2,lw=4,color="red")

    line1, = ax.plot([], [], lw=2,color="blue",alpha=.4)
    line2, = ax.plot([], [], lw=2,color="red",alpha=.4)
    line3, = ax.plot([], [], lw=2,color="black",alpha=.8)


    plt.close()

    def init():
        line1.set_data([], [])
        line2.set_data([], [])
        line3.set_data([], [])


        return line1, line2, line3

    def animate(i):

        t=i*dt


        d1=traveling_wave(A,k,omega,phi1,X1-x1,t)
        d2=traveling_wave(A,k,omega,phi2,X2-x2,t)

        line1.set_data(X1,d1)
        line2.set_data(X2,d2)


        d1=traveling_wave(A,k,omega,phi1,X3-x1,t)
        d2=traveling_wave(A,k,omega,phi2,X3-x2,t)
        d3=d1 + d2
        line3.set_data(X3,d3)


        return line1, line2, line3

    interval=omega*25 # interval between frames proportional to omega 

    anim = animation.FuncAnimation(fig, animate, init_func=init,
                               frames=n_frames, interval=interval, blit=True)

    return anim

examples of sources at different locations

Below are examples of when the two sources emitting the waves are at different locations. I have marked the source locations as red and blue vertical lines, their corresponding waves are colored red and blue as well. The superpostion of the red and blue source waves is colored in black.

Below is an example of neither fully constructive or destructive interference.

In [13]:
# neither fully constructive or destructive interference. 
k=2
omega=2
x1=0
x2=-4
phi1=0
phi2=0
anim=animate_interference(10,k,omega,x1,x2,phi1,phi2)
HTML(anim.to_html5_video())
Out[13]:

Fully destructive interference in which $\Delta x \neq0$ and $\Delta \phi_0 \neq0$.

In [14]:
# fully destructive interference 
k=2
omega=2
x1=0
x2=-3.7
dx=x2-x1
phi1=0
phi2=pi+k*dx
anim=animate_interference(10,k,omega,x1,x2,phi1,phi2)
HTML(anim.to_html5_video())
Out[14]:

Fully constructive interference in which $\Delta x \neq0$ and $\Delta \phi_0 \neq0$.

In [15]:
# fully constructive 
k=2
omega=2
x1=0
x2=-3.7
dx=x2-x1
phi1=0
phi2=2*pi+k*dx
anim=animate_interference(10,k,omega,x1,x2,phi1,phi2)
HTML(anim.to_html5_video())
Out[15]:

The Wave Equation

We want a traveling wave on a rope. Our analysis will require a few assumptions:

  • The tension $T$ in the rope is uniform.
  • The amplitude is much smaller than the wave length, which means all angles are small.

Our method to build up the wave equation will rely a Newton second law approach. First we need and expression for the mass of a small segment of the rope. A small segment of mass $\Delta m$ is constructed by multiplying the total mass times the fraction of the segments size to the total length \begin{align} \begin{split} \Delta m & = \text{total mass} \times \frac{\Delta x}{\text{total length}} \\ & = \frac{\text{total mass}} {\text{total length}} \Delta x \\ & = \mu \Delta x ~, \end{split} \end{align} where $\mu$ is the linear mass density.

There is no change in motion in the x-direction-no part of the rope moves in the horizontal direction. Therefore, we need not worry about a force analysis in the x-direction.

The force equation in the y-direction $\sum F_y = \Delta m a_y $ is \begin{align} \begin{split} \Delta m ~a_y & = T\left(\sin \theta_R - \sin \theta_L \right) \\ & \frac{\partial ^2 D}{\partial t^2} = \frac{T}{\Delta m} \left(\sin \theta_R - \theta_L\right) ~, \end{split} \end{align}

Since the angles are small we have $\sin \theta \approx \tan \theta$ and we can describe $\tan \theta$ as small change in the y-direction divided by the small change in the x-direction or $\tan \theta \approx \partial D/\partial x$.

problem 15 Show that \begin{align} \begin{split} \frac{\partial ^2 D}{\partial t^2} & = \frac{T}{\Delta m} \left(\sin \theta_R - \sin \theta_L\right) & = \frac{T}{\mu} \frac{1}{\Delta x} \left[ \frac{\partial D}{\partial x} \Big|_{x + \Delta x} - \frac{\partial D}{\partial x} \Big|_{x} \right] ~, \end{split} \end{align} where $\Big|_{x + \Delta x}$ means that the funtion is evalutated at the point $x + \Delta x$. In the limit as $\Delta x \to 0$ the term on the right hand side evalutes to second partial derivative with respect to $x$ and we now have \begin{align} \frac{\partial ^2 D}{\partial t^2}=\frac{T}{\mu} \frac{\partial ^2 D}{\partial x^2}~, \end{align} which is the wave equation for traveling wave on a rope.

In general the wave equation is \begin{align} \frac{\partial ^2 D}{\partial t^2}=v^2 \frac{\partial ^2 D}{\partial x^2}~, \end{align} where $v$ is the phase velocity of the wave.

problem 16

Show by direct substitution into the wave equation that $D(x,t)=A\sin(kx - \omega t + \phi_0)$ is a solution to the wave equation, where $v=\omega/k$.