A Gentle Introduction to SQL Simple Harmonic Motion

What's the point of Trigonometry?

( x0+xscos(ωxtx), y0+yssin(ωyty) )

The following SQL statement generates 20 rows. Each row includes eight numbers that control the movement of one of 20 points.

Have a go

In this example the first parameter x0 is the only one which changes - it varies from -300 in the first row to 270 in the last. This means that the points are distributed evenly across the x-axis.

Some things to try...

Angular velocity

Not much to change here - we have more points and each has a different angular velocity. Watch the harmonics as different groups drift in and out of phase

Some things to try...


Lissajous figures are formed when sinusoidal motion is applied to both the x and the y axis.

Some things to try...


We can generate (x,y,z) points for a cube by taking the triple Cartesian product of n. The sin and cos in the inner SQL tilt this cube. We flatten these into 2D and make the phase correspond to the angle each point makes with the xz plane.

Some things to try...