Waves: height, speed and shift
Why this matters
Anything that repeats, a sound, a season, a heartbeat, can be described as a wave. A sine wave is simply the height of the turning arm from the last lesson, drawn out over time. Three numbers set its shape: how tall, how fast and how far shifted. In AI, sound reaches a model as a long list of wave samples, and transformers use waves of different speeds to tell the first word of a sentence from the fiftieth. This lesson reads the three dials off a formula, samples a wave into a list the way a microphone does, and builds the position codes a transformer uses.
- Read a sine wave as the height of a turning arm over time
- Name a wave's amplitude, period and phase shift, and read them from y = A sin(kx + φ)
- Sample a wave into a list in Python, and see what too few samples lose
- See sound as a list of samples, and how a transformer tells positions apart with waves
The math: a turning arm, drawn over time
Purpose. Describe anything that repeats.
In the last lesson, an arm of length 1 at angle x had height sin x. Let the angle grow steadily, like time passing, and plot the height: it rises from 0 to 1 at a quarter turn, falls back to 0 at a half turn, down to −1 at three quarters, and back to 0 after a full turn. Then it all repeats. That's the sine wave.
Three numbers stretch and slide it into any wave you need:
In plain words: A sets how tall, k how fast it repeats, and φ (phi) how far it's slid along.