Expression grapher

Type any function of x and see it graphed, evaluated and typeset.

Use the keyboard below, or type directly: + − * / ^ ( ) sin cos tan sqrt log ln pi e x

Results

As writtenx^{2} - 4
Value at x = 20

Graph

Drag to pan, scroll or pinch to zoom, or use the + / − / ⟲ buttons. The graph can also be reached with the keyboard: Tab to it, then use the arrow keys and + / −.

How it works

The expression is parsed by a small, safe grammar (no code is ever executed) into a tree of operations, which is then evaluated at each x-value to draw the curve, and separately at the x you choose below.

  • Operators: + − * / ^ for addition, subtraction, multiplication, division and powers; use parentheses to group.
  • Functions: sin cos tan asin acos atan sqrt log ln exp abs — each needs parentheses, e.g. sin(x).
  • Constants: pi and e. The only variable is x.

Common mistakes

  • Forgetting implicit multiplication isn't always assumed the same way across calculators - writing "2x" or "2(x+1)" may need an explicit × depending on the parser, so an unexpected error often means a missing multiplication sign, not a typo elsewhere.
  • Mixing up operator precedence, especially with nested exponents and unary minus - "-x^2" and "(-x)^2" are not the same expression, and relying on mental math instead of parentheses to resolve ambiguity is a common source of an unexpected sign.
  • Evaluating at a point where the expression is undefined (division by zero, a negative number inside an even root, log of zero or a negative number) and expecting a normal numeric result - these are genuine mathematical gaps in the function's domain, not calculator errors.

Related calculators