The idea: three jobs in one formula
Take a plain sine wave sin(mx), stretch it by a function g(x) and lift it by a function h(x):
y = h(x) + g(x) · sin(mx)
Each piece has one job. h is the midline: the wave swings around it. g is the envelope: how far the wave may swing away from h at each x. m is the frequency: how fast it swings. Pick h and g and you pick a band; m only decides how densely the curve fills it.
Why the curve stays inside the envelope
A sine is never above 1 or below −1. Multiply by g and add h:
h(x) − |g(x)| ≤ y ≤ h(x) + |g(x)|
These two bounds are the dashed orange curves on the canvas. They don't contain m, so they stay put while m changes. The curve touches them where sin(mx) = ±1, at x = (k + ½)·π/m, and it crosses the midline where sin(mx) = 0, at x = kπ/m. Those crossings depend only on m: change g and they stay exactly where they are (Demo: g doesn't move the zeros).
| piece | what it decides | try |
|---|---|---|
| h(x) | where the wave is: the line it swings around | 0, x/2, x²/4, ∛(x²), sin x |
| g(x) | how tall the wave is at each x, and where it is pinned | 1, 2e^(−x²/2), 1.5·cos x, x/2, √(3 − x²) |
| m | how many swings: period 2π/m, about m·D/π waves on −D … D | 0 … 60 |
With g = 1 and h = d this is the ordinary wave a·sin(bx) + d with a = 1, b = m: see Sine Waves: What a, b, c, d Do. Here the amplitude a and the midline d may change along x.
Where g is 0 or changes sign
Where g(x) = 0 the band has zero width, so the curve must pass through the midline there, whatever m is. That point is a node. Where g changes sign, g·sin(mx) changes sign too: the wave on one side is the mirror image of what it would have been, a jump of half a period in phase.
- g = 1.5·cos x: nodes at x = ±π/2 ≈ ±1.57. Between them the wave swells and shrinks again. This is what you hear as beats when two notes of nearly the same pitch play together: sin(a) + sin(b) = 2·cos((a − b)/2)·sin((a + b)/2), a fast wave in a slow cosine envelope (Demo: beats).
- g = x/2: one node at x = 0 and a band shaped like a bow tie. Left of 0 the wave is upside down (Demo: g = x/2 changes sign).
- g = √(3 − x²): the band closes at the ends x = ±√3, and the domain stops there, because the square root needs 3 − x² ≥ 0.
m fills the band: drawing a shape
For small m the curve is a wobbly copy of h. As m grows the swings come closer together, and around 20–30 waves the eye no longer sees a curve but a filled band between h − g and h + g. So you can draw a shape by choosing its top and bottom edges:
top = h + g, bottom = h − g ⇒ h = (top + bottom)/2, g = (top − bottom)/2
For a heart take h = ∛(x²) (a V with a cusp, the dent at the top) and g = √(3 − x²) (a half circle, the round sides). That is the curve on The Heart Curve, written there with sin(mπx), so its m = 20 is this page's m = 20π ≈ 63 (Demo: build the heart).
m = 0 is the other extreme: sin 0 = 0, so y = h(x) and g has no effect at all (Demo: m = 0).
Where you meet it
| name | h | g | what it is |
|---|---|---|---|
| AM radio | 0 | 1 + k·(sound signal) | a fast carrier sin(mx) whose height carries the sound |
| beats | 0 | cos of half the pitch difference | two close notes heard as one note getting louder and softer |
| wave packet | 0 | a bell, e^(−x²/2σ²) | a short burst: a pulse of light, a particle in quantum mechanics |
| damped oscillation | 0 | A·e^(−γt) | a swing or a spring dying out: see Damped Oscillation |
| sea swell on a tide | slow wave | 1 | a fast wave riding on a slow one (h = sin x on the page) |
Moving the midline is the same move as shifting a graph up by k on Function Transformations, except that the shift may be different at every x.
When the envelope itself moves, at a different speed from the crests inside it, the speeds are the group and phase velocities: see Group Velocity and Phase Velocity.
What the page leaves out
Typing your own h and g (the page has five presets each), a phase c in sin(mx + c), negative m (it only mirrors sin), the exact peaks of the curve (they sit a little off the touch points where the envelope is not flat), and the Fourier view of a modulated wave as a sum of nearby frequencies. The window is fixed at x ∈ [−3.5, 3.5], y ∈ [−3.2, 4].