This plotter evaluates each expression at one point per horizontal pixel and joins the results. Expressions are parsed into reverse Polish notation and evaluated on a stack, so nothing is passed to the browser’s JavaScript engine — a malformed entry produces an error message rather than executing anything.
Writing expressions
- Operators: + − * / ^ %, with ^ right-associative so 2^3^2 is 512.
- Implicit multiplication is supported: 2x, 3(x+1) and x sin(x) all work.
- Trigonometric functions take radians. For degrees, write sin(x*pi/180).
- Unary minus is handled, so -x^2 parses as −(x²).
Reading a graph critically
Sampling one point per pixel means fast-oscillating functions alias badly. Plot sin(100x) across a wide range and the shape you see is an artefact of the sampling rate, not the function. Zoom in until the oscillation is resolved before trusting what is drawn.
Vertical asymptotes are another trap. At a discontinuity like 1/xor tan(x) the value jumps between large positive and large negative, and a naive plotter draws a near-vertical line joining them. This one lifts the pen when a value leaves the visible range by a large margin, which suppresses most of those false lines but not all of them.
What to look for
- Roots are where the curve crosses the x-axis.
- Turning points are where it changes direction — the maxima and minima you would find by setting the derivative to zero.
- Asymptotes are lines the curve approaches without reaching, revealing the behaviour at extremes.
- Intersections between two plotted functions are the solutions to the equation formed by setting them equal.
That last point is worth using deliberately. Plotting the left and right sides of a difficult equation separately and reading off where they cross often gives a usable answer faster than solving algebraically, and it always tells you how many solutions exist.