Function Grapher

Plot any function of x, with the line broken at poles instead of drawn across them, and a warning when the curve turns faster than it can be sampled.

+ - * / ^, brackets, and sin cos tan sqrt abs ln log exp. 2x and 3sin(x) mean what they look like. pi and e work.

What the picture leaves out

A grapher is a sampler

  • A grapher does not draw a function. It works out a few hundred values and joins them up, and where those two things differ the picture is not slightly off — it is showing something the function never does.
  • The commonest example is the false vertical line. Plot 1/x and a naive grapher joins the hugely negative value just left of zero to the hugely positive one just right, drawing a near-vertical stroke through the origin. There is no point on 1/x anywhere near there. This tool breaks the line instead, and marks where.
  • The break is decided by a jump larger than twice the window height AND a change of sign, because a genuinely steep curve still moves smoothly relative to the view. Requiring both is what stops a steep rise being chopped in half.
  • The second lie is aliasing. Sample something oscillating faster than your sample spacing and you get a confident smooth wave that is purely an artefact — the same effect that makes wagon wheels appear to turn backwards on film. Two things are checked: whether the curve turns more often than there are samples to draw the turns, and whether the count changes when resampled four times finer. Either one means the picture cannot be trusted, and it says so rather than showing a shape that is not there.
  • Those two catch different failures, which is why both are needed. sin(100x) over ten units turns 318 times and 600 samples cannot draw that, but resampling finds the same 318 — only the first test notices. sin(500x) turns 1,590 times and the coarse pass finds 390, a completely different shape — there the second test is the one that fires.
  • Roots are found by bisection wherever the samples change sign, and then CHECKED: a candidate is only reported if the function really comes within a millionth of zero there. A sign change across a pole is not a root, and is discarded rather than reported as one.
  • Everything here is sampled, so a feature narrower than the gap between samples can still be missed entirely. Widening the window makes that more likely, not less — the number of samples stays the same while the ground they cover grows.

How to use

  1. Type a function of x and set the window.
  2. Read the graph, the roots, and any warning about what it cannot show.
  3. Narrow the x range if it says the drawing cannot be trusted.

Frequently asked questions

Why is there a gap in the line instead of a vertical stroke?

Because the function has no value there. Plot one over x and most graphers join the hugely negative value just left of zero to the hugely positive one just right, drawing a near-vertical line through the origin. No point on that curve is anywhere near there. The gap is the honest picture and the stroke is invented.

How does it tell a pole from a steep curve?

It needs both a jump larger than twice the window height AND a change of sign. A genuinely steep curve still moves smoothly relative to the view, so requiring both is what stops a sharp rise being chopped in half. That was checked against several steep but continuous functions, none of which get broken.

What does "this drawing cannot be trusted" mean?

That the curve turns more often than there are samples to draw the turns, so the shape you see is made by the sampling rather than by the function — the same effect that makes wagon wheels appear to turn backwards on film. It is not a rough picture; it is a different shape. Narrowing the x range fixes it.

Are the roots reliable?

Each one is found by bisection wherever the samples change sign, and then checked: it is only reported if the function really comes within a millionth of zero there. A sign change across a pole is discarded rather than reported as a root, which is a mistake that is easy to make and easy to test for.

Can it miss something?

Yes, and this is worth knowing rather than glossing over. Everything is sampled, so a feature narrower than the gap between samples can be missed entirely — and widening the window makes that more likely, not less, because the number of samples stays the same while the ground they cover grows.

What can I type?

Plus, minus, times, divide, powers, brackets, and the usual functions — sin, cos, tan, sqrt, abs, ln, log, exp and a few more. Implicit multiplication works, so 2x and 3sin(x) mean what they look like, and pi and e are understood. A leading minus applies to the whole power, so minus x squared is negative.

🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.