Implicit curves
Curves given by an equation rather than as : circles, ellipses, cubics, lemniscates, the folium of Descartes.
How it is certified
The viewport is split into boxes of pixels. For each box, the exact - and -intervals go through interval arithmetic. If the enclosure of over the box excludes 0, the curve misses the whole box and it is dropped. Otherwise the box is split, down to single pixels and then a few levels below. A pixel that survives may contain part of the curve; a pixel that does not survive certainly contains none.
Some pixels are better than possible. If is defined and continuous on a pixel (no square root of a negative, no division by an interval containing 0) and has opposite proven signs at two of its corners, then by the intermediate value theorem the curve passes through that pixel. Those are listed in sure and drawn darker above. Where the curve crosses itself or touches without crossing, as at the node of when the parameter makes one, pixels stay possible: no sign change proves them.
const vp = viewport({ x: [-4, 4], y: [-3, 3], width: 400, height: 300 });
const c = implicit("x^2/4 + y^2 = 1", {}, vp);
c.quick.value; // marching-squares segments, immediate
const cells = c.exact(); // { kind: "cells", columns, sure }
cells.sure.count; // pixels proven to hold part of the curve
The equation can be written with anything on either side (y^2 = x^3 - x), or as a bare expression meaning = 0. The quick sketch uses marching squares on a grid every 2 pixels, so it can miss small loops and join branches that cross; the certified frame cannot miss anything.
Parameters
Names other than x and y are parameters, given as exact rationals. The demo wires them to sliders with live, exactly as for graphs.
@ratmath/graphics and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math, and SHOW(svg) draws a picture.