Function grapher
Plot several functions at once, with parameter sliders and a readable grid.
Use a in any expression
How it works
Each function is parsed once into a closure and then evaluated at 900 points across the visible range. That is why dragging a parameter slider updates instantly: no re-parsing happens, only arithmetic.
Why the curve breaks at asymptotes
Plot 1/x and the line stops at the origin rather than shooting vertically across
the screen. Naive plotters connect the last point before the asymptote to the first point after
it, drawing a vertical line that does not exist. This one detects the jump — any step larger
than twice the viewport height — and lifts the pen instead. The same logic handles tan(x), which has an asymptote every π.
Parameters make it a family, not a curve
Writing a * x^2 and dragging a shows the whole family of parabolas at
once, which is a much better way to build intuition than plotting three of them separately. Try exp(-x/a) * sin(b*x) * 5 and watch how a controls the decay envelope while b controls the frequency.
Sampling has limits
With 900 samples across the window, a function oscillating faster than that will alias — you
will see a pattern that is an artefact of the sampling, not the function. Try sin(100*x) across a wide range and then zoom in to see the real behaviour. This is
the same aliasing that makes wagon wheels appear to turn backwards on film.
Radians, always
Trigonometric functions take radians. For degrees, wrap the argument: sin(rad(x)) gives you a sine wave with a period of 360 rather than 2π.