Coding challenge

When two perpendicular harmonic oscillations are combined, they trace out mesmerizing mathematical knots called Lissajous figures: $$x(t) = 150 \sin(at + \delta)$$ $$y(t) = 150 \sin(bt)$$ For example, let $a = 3$, $b = 2$, and $\delta = \pi/4$.

Write a loop that steps a parameter $t$ from $0$ to $2\pi$ in small increments (such as $0.01$), computing $x$ and $y$ at each step, and plotting the points with pset(x, y). What shape do you see? Experiment with different frequency ratios like $a=5, b=4$.

Type your code here:


Lua reference

See your results here: