Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Waves

Types of Waves

applied photoelectric

Figure 1:1D traveling and standing waves. Traveling waves move with respect to a fixed reference frame, while standing waves oscillate in place.

applied photoelectric

Figure 2:Transverse waves carry a disturbance perpendicular to the direction of propagation. Longitudinal waves carry a disturbance along the direction of propagation.

Defining a wave mathematically

u=f(x,t)u = f(x, t)
x=x+vtx=x'+vt
f(x,t)=f(x)f(x,t)=f(x')
u(x,t)=f(xvt)u(x,t) = f(x-vt)
Source
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML, display

# Wave shape (Gaussian)
def f(x):
    return np.exp(-x**2)

# Parameters
v = 1.0
x = np.linspace(-10, 10, 600)
t_step = 0.08
n_frames = 150

# Figure
fig, ax = plt.subplots(figsize=(6, 4))
(line_right,) = ax.plot([], [], lw=2, label=r"$f(x-vt)$ (right)")
(line_left,)  = ax.plot([], [], lw=2, ls="--", label=r"$f(x+vt)$ (left)")
ax.set_xlim(-10, 10)
ax.set_ylim(-0.1, 1.1)
ax.set_xlabel("x")
ax.set_ylabel("u(x,t)")
ax.legend(loc="upper right")
ax.set_title("Traveling waves: $f(x\mp vt)$")

def init():
    line_right.set_data([], [])
    line_left.set_data([], [])
    return line_right, line_left

def update(frame):
    t = frame * t_step
    line_right.set_data(x, f(x - v*t))  # right-moving
    line_left.set_data(x,  f(x + v*t))  # left-moving
    return line_right, line_left

ani = FuncAnimation(fig, update, frames=n_frames, init_func=init, blit=True, interval=40)

# >>> Display as inline HTML (no saving needed)
display(HTML(ani.to_jshtml()))
plt.close(fig)
<>:25: SyntaxWarning: invalid escape sequence '\m'
<>:25: SyntaxWarning: invalid escape sequence '\m'
/tmp/ipykernel_2971/574773477.py:25: SyntaxWarning: invalid escape sequence '\m'
  ax.set_title("Traveling waves: $f(x\mp vt)$")
Loading...

Periodic traveling waves

applied photoelectric

Figure 3:A wave that is periodic in both space and time.

y(x,t)=Asin(kx+ϕ)y(x,t)= A \sin(kx+\phi)
y(x,t)=Asin(k(xvt)+ϕ)=Asin(kxωt+ϕ)y(x,t)= A \sin(k(x-vt)+\phi)=A \sin(kx-\omega t+\phi)
Source
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
from IPython.display import HTML, display

# -----------------------
# Parameters
# -----------------------
k = 2 * np.pi / 5.0         # wavenumber
omega = 2 * np.pi / 3.0     # angular frequency
x = np.linspace(-10, 10, 600)
x0 = 0.0                    # fixed position for phasor
t_step = 0.08
n_frames = 140              # keep size reasonable for inline JS

# -----------------------
# Figure with two subplots
# -----------------------
fig, (ax_wave, ax_phasor) = plt.subplots(1, 2, figsize=(10, 4))

# Left subplot: real and imaginary parts
(line_real,) = ax_wave.plot([], [], lw=2, label="Re$\\{e^{i(kx-\\omega t)}\\}$")
(line_imag,) = ax_wave.plot([], [], lw=2, ls="--", label="Im$\\{e^{i(kx-\\omega t)}\\}$")
ax_wave.set_xlim(x.min(), x.max())
ax_wave.set_ylim(-1.2, 1.2)
ax_wave.set_xlabel("x")
ax_wave.set_ylabel("Amplitude")
ax_wave.set_title("Real and Imaginary Parts vs x")
ax_wave.legend(loc="upper right")

# Right subplot: phasor
theta = np.linspace(0, 2*np.pi, 400)
ax_phasor.plot(np.cos(theta), np.sin(theta), lw=1)  # unit circle
(point_line,) = ax_phasor.plot([], [], lw=2)        # line from origin to tip
(point_tip,) = ax_phasor.plot([], [], marker='o', lw=0)
ax_phasor.set_aspect('equal', 'box')
ax_phasor.set_xlim(-1.2, 1.2)
ax_phasor.set_ylim(-1.2, 1.2)
ax_phasor.set_xlabel("Re")
ax_phasor.set_ylabel("Im")
ax_phasor.set_title(f"Phasor at x0 = {x0}")

def init():
    line_real.set_data([], [])
    line_imag.set_data([], [])
    point_line.set_data([], [])
    point_tip.set_data([], [])
    return (line_real, line_imag, point_line, point_tip)

def update(frame):
    t = frame * t_step
    phase = k * x - omega * t
    # Left subplot updates
    line_real.set_data(x, np.cos(phase))
    line_imag.set_data(x, np.sin(phase))
    # Right subplot updates (phasor at x0)
    angle = k * x0 - omega * t
    z = np.cos(angle) + 1j*np.sin(angle)
    point_line.set_data([0, z.real], [0, z.imag])
    point_tip.set_data([z.real], [z.imag])
    return (line_real, line_imag, point_line, point_tip)

ani = FuncAnimation(fig, update, frames=n_frames, init_func=init, blit=True, interval=40)

# Display as inline HTML JS animation; then close to avoid duplicate static rendering
display(HTML(ani.to_jshtml()))
plt.close(fig)
Loading...

Periodicity in space and time

Sine and cosine traveling waves are periodic in space and in time. We introduce two quantities that quantify these periodicities.

u(x,t)=Asin[2π(xλtT)]u(x,t) = Asin\Big[2\pi \Big(\frac{x}{\lambda} - \frac{t}{T}\Big)\Big]

Wave equation

Combining waves: interference

applied photoelectric

Figure 4:Constructive vs. destructive interference of two cosine waves Acos(kxωt)Acos(kx-\omega t) and Acos(kxωt+ϕ)Acos(kx-\omega t+\phi) differing only in phase ϕ\phi. When the waves differ in phase by ϕ=π/2\phi=\pi/2, they completely cancel each other. When the waves are fully in phase (ϕ=0\phi=0), constructive interference doubles the amplitude: y(x,t)=2Acos(kxωt)y(x,t)=2A \cos(kx-\omega t).

applied photoelectric

Figure 5:Combining waves produces a new wave, shown in both the complex and real representations.

applied photoelectric

Figure 6:Illustration of wave interference.

Problems

Problem 1: Traveling or standing

Problem 2: Wavelength and frequency

Given a traveling sine wave u(x)=sin(2x10t+π/2)u(x) = sin(2x-10t+\pi/2), extract its wavelength, frequency, velocity, and amplitude.