Graphing Calculator

Enter one or more functions of x (e.g., x^2, sin(x)) to plot them overlaid. Uses math.js for evaluation.

Graph and points will appear here.

What This Calculator Does

Seeing the shape of a function usually makes it easier to understand than staring at its equation alone. Type in one or more functions of x, set the range of x values you care about, and this tool samples each function at evenly spaced points across that same range, plotting them as overlaid lines — each in its own color — so you can see how the outputs behave and compare them directly: where each one rises, falls, curves, crosses zero, or crosses the others.

How to Use It

Enter your function in the "Functions f(x) =" field using x as the variable — things like x^2, sin(x), or 2*x + 1 all work. Click + Add Function to add another input and plot it overlaid on the same graph, each one automatically assigned its own color; click Remove next to any function to take it out again (you always need at least one). Set X Min and X Max to the range you want to plot, and Number of Points to control how finely it's sampled — the same range and point count apply to every function, so they're all sampled on equal footing. Below the graph, a color-coded legend labels which line is which function whenever more than one is plotted, and each function has its own expandable list of the actual sampled (x, y) pairs underneath.

The Formula

Given X Min, X Max, and Number of Points (call it n), the calculator divides the range into n equal steps, sized (X Max − X Min) ÷ n, and evaluates your function at each of the n + 1 resulting x values, from X Min through X Max inclusive. Each evaluation runs through math.js's expression engine, the same engine behind this project's Scientific Calculator, so it understands standard functions and operator precedence correctly. If your function is undefined at a particular x — like 1/x at x = 0, or a square root of a negative number — that point's y value comes back as NaN and is simply skipped when drawing the line, rather than breaking the whole plot. When multiple functions are entered, every one of them is sampled this same way independently, using the same shared X Min, X Max, and Number of Points — one function's undefined points or errors never affect another function's own line.

The vertical scale is shared across every plotted function, not recalculated separately for each one — otherwise two very differently-sized functions, like x and 10*x, would each get stretched to fill the same visual height and look deceptively similar. Each function keeps the same color for as long as it stays in the list, tied to the order you added it in rather than its current position, so removing an earlier function never causes a later one's line to suddenly change color.

A Worked Example

Graph f(x) = x^2 from X Min 0 to X Max 4 with 4 points. The step size is (4 − 0) ÷ 4 = 1, so the calculator samples x = 0, 1, 2, 3, and 4 — five points in total, since the range is inclusive on both ends. Squaring each one gives y = 0, 1, 4, 9, and 16 respectively, tracing the left half of the familiar upward-curving parabola. Widen the range to include negative x values, say −4 to 4, and you'd see the same curve mirrored on both sides of the y-axis, since squaring a negative number produces the same positive result as squaring its positive counterpart.

To compare two functions directly, click + Add Function and enter 2*x + 1 alongside the existing x^2, over the same 0-to-4 range. Sampling both at x = 0, 1, 2, 3, 4 gives 2*x + 1 the values 1, 3, 5, 7, 9 and x^2 the values 0, 1, 4, 9, 16 — the straight line for 2*x + 1 starts above the parabola (1 vs. 0, then 3 vs. 1, then 5 vs. 4), gets overtaken somewhere between x = 2 and x = 3 (5 vs. 4 flips to 7 vs. 9), and falls further behind as x keeps increasing — a comparison that's far easier to see plotted together than by reading two separate tables of numbers.

FAQ

What functions can I graph?
Linear, quadratic, polynomial, trigonometric, exponential, and logarithmic functions.
Can I plot multiple equations at once?
Yes — click + Add Function to overlay additional functions on the same graph, each automatically assigned its own distinct color, with a legend labeling which line is which whenever more than one is plotted.