Fields & Vector Fields

Draw a scalar field as a heatmap or 3-D surface, or a vector field as a quiver — then layer contours, flow paths, critical points, and cross-sections onto it.

Type field in front of a two-variable expression and Instacalc draws it as a top-down heatmap. Type vectorfield in front of a [u, v] pair and it draws a quiver of arrows. Both are live — they re-render as you edit the formula or drag a slider — and both take composable overlay items written as a comma-series on the row, exactly like graphs do (graph f(x), point(2,3)).

Draw a field

Any expression in x and y works. The value maps to colour (low → high).

Computing…

Procedural noise works too — fbm (fractal noise) makes instant terrain:

Computing…

2-D heatmap or 3-D surface

field and surface are the same function seen two ways — a flat heatmap or an orbitable 3-D surface. Use the 3D | 2D toggle on the card to flip between them; the choice is saved into the formula, so it travels with the share link.

Computing…

Set the domain

By default the field is sampled around the origin. Add a from … to … clause to choose your window — one range for a square, or separate x/y ranges:

Computing…

Contours

Add contour(level) to trace the field’s level set — every point where the field equals that value. It’s the “elevation line” on a topographic map. Or just click the heatmap to drop a contour at the height under your cursor.

Computing…

Probe points

point(x, y) drops a marker and reads off the field’s value there. Switch the tool toggle to Point and click to drop one.

Computing…

Critical points

critical() auto-marks every peak, pit, and pass of the field — the points where the gradient is zero (∇f = 0). Peaks show as ▲, pits as ▼, and saddles (mountain passes) as ✕. Toggle it on with the ∇=0 chip.

Computing…

This is found numerically, so it works on any field — including noise, which has no formula for its derivative.

Cross-sections

section(x0, y0, x1, y1) cuts a line across the field and insets a chart of the 1-D profile along it — the elevation transect, or a slice through a loss surface. Switch the tool toggle to Section and drag a line to cut one.

Computing…

Vector fields

vectorfield [u, v] draws a two-component field as a quiver — a grid of arrows, coloured by magnitude. Aliases: quiver, vfield.

Computing…

Streamlines trace the flow. Add streamline(x, y) — or switch the tool to Flow and click — to release a path that follows the arrows from that seed point:

Computing…

Gradients — the field and its flow

The gradient of a scalar field is the vector field pointing uphill; its negative points downhill. Write grad(h) (or -grad(h) for downhill) as the vectorfield’s target and Instacalc builds it for you — numerically, so it works on any field:

Computing…

That negative gradient is drainage on terrain, gradient descent on a loss surface, and field lines in physics — the same picture, relabelled.

Divergence, curl, and diffusion

A field base can also be a vector-calculus operator. These produce signed fields — positive and negative regions — so they render on a blue–white–red diverging colormap centred at zero:

  • divergence([u, v]) — sources (blue/red) and sinks: where flow spreads or gathers.
  • curl([u, v]) — rotation, or vorticity: where the flow swirls.
  • laplacian(h) — concavity / diffusion.
Computing…

contour(0) on a signed field traces the boundary between positive and negative.

Everything composes

Because every mark lives in the row text, you can stack them — and the whole thing is one shareable, editable formula:

Computing…

Drag a mark or edit a number and the picture updates instantly. Copy the row and it renders the same anywhere — a calc, a share link, or an embed.

See also