Lissajous Figure¶
By the end of this lab you'll be able to:
- Plot a Lissajous figure using
x = A*sin(a*t + δ),y = B*sin(b*t) - Understand how the ratio
a:bcontrols the number of loops - Explore how changing phase shift
δrotates and reshapes the figure
Lissajous figures are the curves traced by a point whose x and y coordinates oscillate sinusoidally at different frequencies. They appear on oscilloscopes and in sound visualization.
Welcome to Lissajous Figures!
Lissajous figures are named after Jules Antoine Lissajous, who studied them in 1857.
They show up in physics, music, and even logo designs!
Let's code one together!
How It Works¶
For each time step t from 0 to 2π, compute x = A * sin(a*t + delta) and y = B * sin(b*t). Moving the turtle to (x, y) traces out the figure. The ratio a/b determines the shape.
Sample Code¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
What Do You Think Will Happen?
With a=3, b=2 (ratio 3:2), the figure should have a loops in one direction and b in the other.
Count the loops — how many will there be along x? Along y?
Make your guess — then click Run to find out!
Try It Now¶
3 loops along x, 2 loops along y — the curve crosses itself at 3 × 2 = 6 points. Were you right?
How It Works¶
a:b = 3:2 means x oscillates 3 times for every 2 oscillations of y. Where a and b are integers with no common factor, the curve is closed. delta shifts the x phase — changing it from π/4 to 0 produces a figure-8, while π/2 produces an ellipse-like shape.
Explanation Table¶
| Line | What it does |
|---|---|
A, B = 160, 130 |
Amplitude (size) in x and y |
a, b = 3, 2 |
Frequency ratio — controls loop count |
delta = math.pi / 4 |
Phase shift — rotates the figure |
A * math.sin(a * t + delta) |
x oscillates at frequency a |
Learning Check¶
Your Turn — Change the Ratio
Change a, b = 3, 2 to a, b = 5, 4. How many crossings will appear?
The formula is: crossings = a × b. Predict it, then run!
a=5, b=4 → 5×4 = 20 crossings — a much more complex, ornate figure.
Experiments¶
-
Try a=1, b=1. Set
delta=0too. The result should be a diagonal line (degenerate case). Trydelta=pi/2for an ellipse. You'll know it worked when a simple shape appears. -
Draw multiple figures. Use a loop over different values of
aandbwith different colors. You'll know it worked when several Lissajous figures overlap. -
Animate the phase. In a loop, increase
deltaslowly and redraw. You'll know it worked when the figure appears to rotate. -
Try non-integer ratios. Use
a, b = 3, 2.1. The figure won't quite close — it'll precess slowly. You'll know it worked when the curve fills a region instead of forming a closed loop.
Oscilloscope Art!
You coded a Lissajous figure — the same patterns that appear on oscilloscopes
when two sine waves are fed to the x and y inputs!
Up next: Rose Curve — petals from a single polar equation.