---
name: wavelace
description: "Draw a formula as an animated plot on Wavelace, the maths visualiser at www.wavelace.com, by writing a link to its app or an iframe for any page: a wave, a surface, a curve in space, a vector field, a complex function, a quantum packet or one of its presets. Use it when someone wants a formula plotted, animated, shared or embedded."
---

# Make a Wavelace plot

Wavelace draws a formula as a plot in three dimensions that a person can orbit, pause and share. A link carries the
whole plot after its `#`, which no browser sends to a server, so writing one is all it takes: no account, no key, no
request of your own.

- `https://www.wavelace.com/app#…` opens the plot in the app, with the formula field, the dials and the presets around it.
- `https://www.wavelace.com/embed#…` takes the same hash and shows the plot alone, for an `<iframe>` in any page.

## The link

Write the hash with URLSearchParams, or percent-encode it the same way: `+` as `%2B`, a newline as `%0A`, `#` as `%23`.

- `m`: the renderer, one of the keys under Renderers.
- `f`: the formula, for a renderer that takes one.
- `fx`, `fy`, `fz`: the three expressions of a renderer that takes three.
- `p`: a preset by its index under Presets. On its own it opens the preset with its dials; beside a formula it says which preset the formula was edited from.
- `let`: the formula's own letters. A letter that no variable or function claims becomes a slider, and opens at 1 unless the link sets it. Written `let=a:2,k:3`.
- `n`: a name for the plot, shown under it.
- `theme`: `light` or `dark`; left out, the page follows the reader's system.
- the dials, each a number: `span`, `speed`, `amp`, `depth`, `turns`, `vspan`, `x0`, `y0`, `z0`, `seeds`, `sigma`, `k0`. Which ones a renderer uses, and their ranges, are under Renderers; a value outside the range is clamped.

Options, each `1` or `0`:

- `play` (on when left out): the clock runs, so a plot opens moving.
- `spin` (off when left out): the camera turns by itself.
- `ground` (on when left out): the floor and its grid.
- `trace` (off when left out): wave, polar and curve: draw the curve from its start as the clock runs.
- `particles` (on when left out): the dots in the quantum renderers.
- `fill` (on when left out): surface, shape and quantum 2D below the solid stop: the mesh as a filled sheet.
- `maths` (on when left out): the plate as mathematics, |x|, 45°, √x, n! and sin t; off, as the formula box takes it.
- `deck` (on when left out, embed page only): the embed's bar of playback, views and toggles.
- `formula` (on when left out, embed page only): the formula over the plot.
- `title` (on when left out, embed page only): the name under it.
- `orbit` (on when left out, embed page only): the orbit drag, by mouse or with two fingers on a touch screen, where one finger scrolls the page; the view buttons still work without it.
- `pan` (on when left out, embed page only): the shift-drag and right-drag pan.

## Examples

- a travelling wave: https://www.wavelace.com/app#m=wave&f=sin%28x+-+t%29
- a surface in x and y that moves: https://www.wavelace.com/app#m=surface&f=%5Ccos%28x%29%5Csin%28y+-+t%29
- a preset with its letters set (Knot Family): https://www.wavelace.com/app#p=138&let=p%3A2%2Cq%3A5

## Formulas

A formula is written as a person would write it, or as LaTeX pasted as printed; pasted symbols such as θ π ² √ ∫ are
read too. Each of these is one the app reads: `sin(x - t)`, `2x`, `x^2`, `\frac{1}{2}x`, `\sqrt{x}`, `\sin\theta`, `\int_0^{x} \cos(u)\, du`, `\sum_{k=1}^{5} \frac{\sin(k x)}{k}`, `\begin{cases} x & x > 0 \\ 0 & \text{otherwise} \end{cases}`. A letter's slider runs from
-10 to 10. A formula the app cannot read is refused with a message and the last good one
stays on screen.

- Variables: `x`, `y`, `z`, `r`, `th`, `u`, `v`, `t`. Each renderer feeds the ones its note says; `t` is the clock.
- Functions: `abs`, `acos`, `acosh`, `asin`, `asinh`, `atan`, `atan2`, `atanh`, `besselJ`, `cbrt`, `ceil`, `combinations`, `cos`, `cosh`, `cot`, `csc`, `deg`, `erf`, `exp`, `factorial`, `floor`, `gamma`, `hypot`, `log`, `log10`, `log2`, `max`, `min`, `mod`, `pow`, `round`, `sec`, `sign`, `sin`, `sinc`, `sinh`, `sqrt`, `superformula`, `tan`, `tanh`.
- Constants: `E`, `PI`, `inf`, `pi`, `tau`.
- Integral, sum, product and derivative: `integral`, `sum`, `prod`, `diff`.

Every symbol, command and refusal is tabled at https://www.wavelace.com/documentation/.

## Renderers

### `wave`: y = f(x, t)

One expression. Feeds x and t; each ribbon slice also gets its depth as z and y. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span of x, 1 to 40; `speed` Speed, 0 to 4; `amp` Amplitude, 0.1 to 4; `depth` Ribbon depth, 1 to 80.

### `polar`: r = f(θ, t)

One expression. Feeds θ (th) and t; a formula written in x reads the angle as x. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `speed` Speed, 0 to 4; `amp` Radius scale, 0.1 to 2; `depth` Stack, 1 to 40; `turns` Turns of θ, 1 to 24.

### `surface`: z = f(x, y, t)

One expression. Feeds x, y and t, plus r = hypot(x, y) and θ = atan2(y, x). Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span of x, y, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Mesh, 8 to 80.

### `curve`: (x, y, z) = f(u, t)

Three expressions in u and t; u runs over the turns. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `fx`, `fy` and `fz`.

Dials: `speed` Speed, 0 to 4; `amp` Scale, 0.1 to 2; `depth` Trail, 1 to 80; `turns` Turns of u, 1 to 24.

### `shape`: (x, y, z) = f(u, v, t)

Three expressions in u, v and t; u runs over the turns, v over 0 → π × span of v. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `fx`, `fy` and `fz`.

Dials: `speed` Speed, 0 to 4; `amp` Scale, 0.1 to 2; `depth` Mesh, 8 to 80; `turns` Turns of u, 1 to 24; `vspan` Span of v (×π), 0.5 to 4.

### `complex`: w = f(z, t)

One expression. Feeds z, c (= z) and t; i is the imaginary unit. Iterations > 0 applies f repeatedly. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span of z, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Iterations, 0 to 300.

### `quantum`: ψ under V(x)

One expression. Schrödinger's equation with ħ = m = 1: a Gaussian packet evolves under V(x); walls at ±span reflect. T and R are the probability right and left of x = 0. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span of x, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Ribbon depth, 1 to 80; `x0` Packet centre, -8 to 8; `sigma` Packet width, 0.2 to 2; `k0` Momentum k₀, 0 to 10.

### `quantum2d`: ψ under V(x, y)

One expression. Schrödinger's equation in the plane, ħ = m = 1; the floor is tinted where V exceeds the packet's energy. T and R are the probability right and left of x = 0. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span of x, y, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Mesh, 8 to 80; `x0` Packet centre x, -8 to 8; `y0` Packet centre y, -8 to 8; `sigma` Packet width, 0.2 to 2; `k0` Momentum k₀ (along x), 0 to 10.

### `flow`: (ẋ, ẏ, ż) = f(x, y, z, t)

Three expressions. A vector field: each seed moves at the velocity the expressions give at its position (RK4). y is up; a pasted z-up system reads with y and z swapped. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `fx`, `fy` and `fz`.

Dials: `span` Span of x, y, z, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Trail, 1 to 160; `x0` Seeds centre x, -8 to 8; `y0` Seeds centre y, -8 to 8; `z0` Seeds centre z, -8 to 8; `seeds` Seeds, 1 to 64; `sigma` Seed spread, 0.2 to 2.

### `swarm`: f(r) between bodies

One expression. The force between any two bodies at distance r, positive pulling them together: 1/r^2 is gravity. Unit masses start on a disc in the floor plane, turning at the swirl rate about their own centroid, so the cloud as a whole stays put. Distances are softened. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Trail, 1 to 160; `x0` Cloud centre x, -8 to 8; `y0` Cloud centre y, -8 to 8; `seeds` Bodies, 1 to 64; `sigma` Cloud radius, 0.2 to 3; `k0` Swirl, 0 to 10.

### `bodies`: mechanical systems

A description, not a formula. A first line saying gravity, pendulum, charges, springs, restricted or elastic, then one line per body, rod, charge, mass, particle or spring: m x y vx vy, l m a (the angle), m q x y vx vy, x y vx vy, or l m k a s (a spring hung from the one above: its length, its bob, its stiffness, the angle and the stretch). Springs and restricted read a second kind of line too: a spring, from to k rest, joins two masses by number, and restricted's two primaries are lines naming only m. The first line of charges may name a uniform field after the name: B Ex Ey, B pointing up out of the floor. Values may be expressions. RK4; the energy drift is the check. Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span, 1 to 40; `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Trail, 1 to 160.

For example:

```
gravity
m=1  x=0  y=0
m=0.001  x=1  y=0  vx=0  vy=1
```

### `bellman`: v(s) = maxₐ [R(s, a) + γ v(s′)]

A description, not a formula. One row per line: . empty, # wall, a number a terminal with that reward, S a start. Each sweep applies the Bellman update to every cell; the tiles rise to v(s) and the arrows point where the max is taken. Goes in `f`.

Dials: `speed` Speed, 0 to 4; `amp` Height, 0.1 to 4; `depth` Sweeps, 0 to 60; `y0` Step reward, -2 to 0.5; `sigma` Discount γ, 0 to 1; `k0` Slip, 0 to 1.

For example:

```
. . +1
# . -1
S . .
```

### `implicit`: F(x, y, z, t) = 0

One expression. Draws the surface where the formula is zero: for F = c, write F − c. Feeds x, y, z and t, plus r = hypot(x, y, z) and θ = atan2(y, x). Any other letter, Latin, Greek or subscripted (x_1), becomes a slider. Goes in `f`.

Dials: `span` Span of x, y, z, 1 to 40; `speed` Speed, 0 to 4; `amp` Scale, 0.1 to 1.3; `depth` Detail, 16 to 80.

## Embedding

Put the embed page in an iframe; it plays when scrolled into view and follows the reader's theme:

```html
<iframe src="https://www.wavelace.com/embed#p=42&trace=1" title="Wavelace" loading="lazy" style="display:block;width:100%;aspect-ratio:4/3;border:0"></iframe>
```

In JavaScript, `npm i @wavelace/embed` writes the same link and iframe from options, with `<Embed>` for React.

## Presets

Open one with `p=<index>`. Every preset has a page of its own under https://www.wavelace.com/presets/.

- 0. Chirp Wave (`wave`)
- 1. Travelling Ripple (`wave`)
- 2. Beat Interference (`wave`)
- 3. Damped Pulse (`wave`)
- 4. Wave Packet (`wave`)
- 5. Square Fourier (`wave`)
- 6. Sinc Splash (`wave`)
- 7. Breathing Gauss (`wave`)
- 8. Standing Wave (`wave`)
- 9. Phase Fold (`wave`)
- 10. Saw Cascade (`wave`)
- 11. Bessel-ish (`wave`)
- 12. Twin Solitons (`wave`)
- 13. Living Wave (`wave`)
- 14. Living Wave (cos) (`wave`)
- 15. Living Wave (tan) (`wave`)
- 16. Cusp Heart (`wave`)
- 17. Fractal Cosine (`wave`)
- 18. AM Carrier (`wave`)
- 19. Heartbeat (`wave`)
- 20. Depth Sheet (`wave`)
- 21. Trefoil Bloom (`polar`)
- 22. Polar Mandala (`polar`)
- 23. Fourfold Mandala (`polar`)
- 24. Butterfly Curve (`polar`)
- 25. Breathing Rose (`polar`)
- 26. Pulsing Cardioid (`polar`)
- 27. Lemniscate (`polar`)
- 28. Fermat Spiral (`polar`)
- 29. Cross Ripple (`surface`)
- 30. Egg Carton (`surface`)
- 31. Checker Waves (`surface`)
- 32. Radial Pond (`surface`)
- 33. Ripple Tank (`surface`)
- 34. Spiral Wave (`surface`)
- 35. Monkey Saddle (`surface`)
- 36. Saddle Swirl (`surface`)
- 37. Helix (`curve`)
- 38. Torus Knot (`curve`)
- 39. Living Lissajous (`curve`)
- 40. Lissajous Knot (`curve`)
- 41. Spherical Spiral (`curve`)
- 42. Trefoil Knot (`curve`)
- 43. Spirograph (`curve`)
- 44. Tornado (`curve`)
- 45. Viviani's Curve (`curve`)
- 46. Breathing Ring (`curve`)
- 47. Mandelbrot (`complex`)
- 48. Breathing Julia (`complex`)
- 49. Newton Basins (`complex`)
- 50. Burning Ship (`complex`)
- 51. z squared (`complex`)
- 52. Simple Pole (`complex`)
- 53. Rational Map (`complex`)
- 54. Complex Exp (`complex`)
- 55. Complex Sine (`complex`)
- 56. Möbius Turn (`complex`)
- 57. Heart (`shape`)
- 58. Breathing Sphere (`shape`)
- 59. Torus (`shape`)
- 60. Twisted Torus (`shape`)
- 61. Möbius Strip (`shape`)
- 62. Klein Bottle (`shape`)
- 63. Seashell (`shape`)
- 64. Alain's Curve (`polar`)
- 65. Guitar String (`surface`)
- 66. Gaussian Bump (`surface`)
- 67. Saddle (elliptic) (`surface`)
- 68. Free Packet (`quantum`)
- 69. Tunnelling Barrier (`quantum`)
- 70. Potential Step (`quantum`)
- 71. Harmonic Well (`quantum`)
- 72. Double Well (`quantum`)
- 73. Double Slit (`quantum2d`)
- 74. Single Slit (`quantum2d`)
- 75. Scattering Disc (`quantum2d`)
- 76. Orbiting Packet (`quantum2d`)
- 77. Free Packet 2D (`quantum2d`)
- 78. Lorenz Attractor (`flow`)
- 79. Rössler Attractor (`flow`)
- 80. Thomas Attractor (`flow`)
- 81. Whirlpool (`flow`)
- 82. Figure-8 (`bodies`)
- 83. Lagrange Triangle (`bodies`)
- 84. Hierarchical Triple (`bodies`)
- 85. Sun and Planets (`bodies`)
- 86. Double Pendulum (`bodies`)
- 87. Triple Pendulum (`bodies`)
- 88. Gravity Disc (`swarm`)
- 89. Springs (`swarm`)
- 90. Molecules (`swarm`)
- 91. Rose 20 (`polar`)
- 92. Cubic Spiral Sink (`flow`)
- 93. Bellman 3×3 (`bellman`)
- 94. Russell–Norvig 4×3 (`bellman`)
- 95. Cliff Walk (`bellman`)
- 96. Maze (`bellman`)
- 97. Laplace Transform (`surface`)
- 98. Huygens Slit (`surface`)
- 99. Huygens Slits (`surface`)
- 100. Drumhead (`surface`)
- 101. Charged Rod (`surface`)
- 102. Chirp Transform (`surface`)
- 103. Heat Kernel (`wave`)
- 104. Uncertainty (`wave`)
- 105. Normal Distribution (`wave`)
- 106. Gamma Function (`wave`)
- 107. Pendulum Period (`wave`)
- 108. Gaussian Blur (`wave`)
- 109. Logarithmic Integral (`wave`)
- 110. Euler Spiral (`curve`)
- 111. Fresnel Phasor (`curve`)
- 112. Antenna Beam (`polar`)
- 113. Kronig–Penney (`quantum`)
- 114. Smooth Step (`quantum`)
- 115. Soft Corral (`quantum2d`)
- 116. Square Petal (`polar`)
- 117. Square Orbit (`curve`)
- 118. Partial Sums (`wave`)
- 119. Taylor Sine (`wave`)
- 120. Viete Product (`wave`)
- 121. Gamma Poles (`wave`)
- 122. Piecewise (`wave`)
- 123. Membrane Modes (`surface`)
- 124. Diffraction (`surface`)
- 125. Diffusion Front (`surface`)
- 126. Gradient Flow (`flow`)
- 127. Chain Rule (`wave`)
- 128. Tangent Tube (`shape`)
- 129. Crest Doubling (`wave`)
- 130. Resonance Curve (`wave`)
- 131. Launch Angle (`wave`)
- 132. Dispersion (`wave`)
- 133. Rational Rose (`polar`)
- 134. Gielis Supershape (`polar`)
- 135. Focal Conic (`polar`)
- 136. Chladni Plate (`surface`)
- 137. Cusp Catastrophe (`surface`)
- 138. Knot Family (`curve`)
- 139. Horn Torus (`shape`)
- 140. Superellipsoid (`shape`)
- 141. Julia Dials (`complex`)
- 142. Multibrot (`complex`)
- 143. Newton Petals (`complex`)
- 144. Barrier or Well (`quantum`)
- 145. Reflectionless Well (`quantum`)
- 146. Squeezed Packet (`quantum`)
- 147. Hopf Bifurcation (`flow`)
- 148. Van der Pol (`flow`)
- 149. Driven Springs (`swarm`)
- 150. Rutherford Scattering (`bodies`)
- 151. Ring Trap (`bodies`)
- 152. Coupled Oscillators (`bodies`)
- 153. Bead String (`bodies`)
- 154. Lagrange Points (`bodies`)
- 155. Roche Lobe (`bodies`)
- 156. Spring Pendulum (`bodies`)
- 157. Elastic Chaos (`bodies`)
- 158. Horseshoe Orbit (`bodies`)
- 159. Quadric Family (`shape`)
- 160. Paraboloid Family (`surface`)
- 161. Burgers Vortex (`flow`)
- 162. Rabi Oscillation (`curve`)
- 163. Supershape Urchin (`shape`)
- 164. Supershape Pagoda (`shape`)
- 165. Supershape Flower (`shape`)
- 166. Hypotrochoid 7/13 (`curve`)
- 167. Hypotrochoid 7/5 (`curve`)
- 168. Hypotrochoid 3/4 (`curve`)
- 169. Helicoid to Catenoid (`shape`)
- 170. Residue Staircase (`wave`)
- 171. Lyapunov Descent (`curve`)
- 172. Kuen Surface (`shape`)
- 173. Aizawa Attractor (`flow`)
- 174. Einstein–Rosen Bridge (`shape`)
- 175. Magnetic Field Line (`curve`)
- 176. Spinning Drum Mode (`surface`)
- 177. Orbiting Poles (`complex`)
- 178. Quartic Well (`quantum`)
- 179. Enneper Surface (`shape`)
- 180. Four-Wing Attractor (`flow`)
- 181. Garden Rose (`shape`)
- 182. Cyclotron Pair (`bodies`)
- 183. Crossed Fields (`bodies`)
- 184. Tube Lattice (`implicit`)
- 185. Schwarz Diamond (`implicit`)
- 186. Diamond Struts (`implicit`)
- 187. Barth Sextic (`implicit`)
