How the Graphing Calculator Plots a Function
AnyTool Graphing Calculator draws each curve entirely in the browser. Every expression is compiled once by the reusable math engine — a tokenizer splits it into numbers, operators, parentheses, function names and the variable x; the shunting-yard algorithm reorders the tokens into Reverse Polish Notation that honours operator precedence and right-associative exponentiation. To render, the tool sweeps across the HTML canvas one pixel of x at a time, evaluates the compiled expression with x bound to that column, and connects successive points with line segments. There is no eval() and no new Function() — the input is parsed as data, never executed — and because the same compiled expression re-evaluates with any variable map, the engine is shared with the scientific calculator.
- Tokenizer → shunting-yard → Reverse Polish Notation, compiled once per expression
- Sampled once per horizontal pixel, then connected with line segments
- Rendered to an HTML canvas for smooth pan and zoom
- No eval() or new Function() — expressions are parsed, never executed
- Plots explicit y = f(x) only; the variable is x
