# Torus Knot

Curve · (x, y, z) = f(u, t)

`((2.5 + cos(3u + t)) · cos(2u),  sin(3u + t),  (2.5 + cos(3u + t)) · sin(2u))`

[Open in the app](https://www.wavelace.com/app#p=38) · [This page](https://www.wavelace.com/presets/torus-knot)

### What it draws

Read `2.5 + cos(3u + t)` as a distance from the vertical axis: it runs between `1.5` and `3.5`. The `cos(2u)` and `sin(2u)` it multiplies place the point at that distance and at the angle `2u` around the axis. The second expression, `sin(3u + t)`, is the height, and it stays between `−1` and `1`.

Height and distance are driven by the same `3u + t`, so the point never leaves a torus: central circle of radius `2.5` lying flat, tube of radius `1`, axis vertical. The angle around the axis is `2u`, and the angle around the tube is `3u + t`. Over one turn of `u` the strand goes twice around the axis, three times around the tube, and closes.

### Why it is a trefoil

A curve winding `p` times around the axis of a torus and `q` times around its tube is the `(p, q)` torus knot. It is one closed strand rather than several exactly when `p` and `q` share no factor. Here `p = 2` and `q = 3`, coprime, and the `(2, 3)` torus knot is the trefoil, the simplest knot there is. Looking straight down the axis from `Top`, two strands wind around and cross three times: the usual three-crossing picture of a trefoil.

The clock enters through the tube angle alone, and its effect is rigid. Since `3u + t = 3(u + t/3)`, the curve at time `t` is the curve at time zero turned by `2t/3` about the vertical axis. The knot does not deform as it plays. It rotates at two thirds of a radian per second, one full turn every `3π ≈ 9.42` seconds at Speed 1.

### Try

- `Top`: down the axis, the three crossings are laid out plainly, and the tube's inner and outer edges become the two rings the strand weaves between.
- Turn on `trace`: the pen walks the strand from end to end, so the crossings can be followed in order and the knot seen to be a single closed piece.
- Change `cos(2u)` and `sin(2u)` to `cos(4u)` and `sin(4u)` for the `(4, 3)` torus knot: four strands from above, crossing nine times.
- Change all three `3u` to `5u` for the `(2, 5)` knot, the cinquefoil, with five crossings from above.

### Read more

- [Torus knot](https://en.wikipedia.org/wiki/Torus_knot)
- [Trefoil knot](https://en.wikipedia.org/wiki/Trefoil_knot)
- [Knot theory](https://en.wikipedia.org/wiki/Knot_theory)
- [Torus](https://en.wikipedia.org/wiki/Torus)
