Plot functions with a real expression parser, poles drawn as gaps, and roots, turning points and integrals found by bracketing with the check printed.
Initializing in your browser…
Plot 3D surfaces from z = f(x, y), polar z = f(r, theta), or fully parametric equations. Exact evaluation via mathjs, real holes where a function is undefined, and OBJ or STL export for 3D printing.
Exact arithmetic on rationals, with both evaluation conventions named and the precedence table the parser runs on printed on the page.
Molar mass, equation balancing, pH and the gas laws on all 118 elements of the IUPAC 2021 table, with every interval mass and every approximation named.
You type 1/x, which every graphing tool draws, and want it drawn correctly.
Function
1/x over x ∈ [-10, 10]
Plot and analysis
Two separate branches, with a gap at x = 0 Roots: none "The curve is broken at 1 pole, where the value crosses the whole window and changes sign."
Between the samples either side of zero the value goes from about -3000 to +3000. A plotter that joins them draws a vertical line where the function has an asymptote, and a root finder that looks for a sign change reports a root that is not there. This one breaks the curve and, having bisected the bracket, checks the value at the answer and finds it is not zero, so it reports no root.
Plot up to eight functions of x with a real expression parser, find their roots, turning points and intersections by bracketing rather than by guessing, and integrate any of them with an error estimate. A pole is drawn as a gap rather than as a vertical line, and an expression that will not compile is explained rather than drawn as a blank canvas.
The shipped version of this tool evaluated an expression by rewriting the string with regular expressions and calling new Function once per point. Measured on the page, 14 of 18 expressions a person would type came out as NaN with nothing said and a blank canvas as the only symptom: 2x, x(x+1), abs(x), max(x,0), round(x), sign(x), sec(x), cot(x), asinh(x) and nthRoot(x,3) among them. It also compiled 20,000 functions in 123 ms, which for eight animating functions at sixty frames a second is 480,000 compilations a second. This version compiles each expression ONCE with mathjs, which is a real grammar rather than a set of substitutions, and evaluates it per point. Three other things a plotter has to get right are here too. A pole is not a line: tan(x) and 1/x jump from a large positive value to a large negative one between adjacent samples, and joining them draws a vertical stroke where the function has an asymptote, so segments are broken there and the page says how many breaks it made and why. A root is found by bisecting a sign change rather than by Newton steps from the middle of a bracket, which can walk out of the bracket entirely, and the value of the function at the root is printed so the answer can be checked; a sign change that is a pole rather than a root, like 1/x at zero, is not reported as one. And a turning point is refined by golden section rather than by comparing three consecutive samples, so it lands to machine precision rather than to the sample spacing.
Eight curves at once with their roots, turning points and intersections marked and listed.
The derivative drawn over the function, and a definite integral with the error it carries.
tan, 1/x and rational functions drawn as they are, with the gaps in the right places.
Bisection cannot leave its bracket, and the value at the root is printed so the answer can be verified.
Use t in the expression and watch the curve move.
Either the function has no value there (sqrt of a negative number, a logarithm of zero) or it has a pole. A pole is where the value crosses the whole window and changes sign between two adjacent samples; joining those points would draw a vertical line where there is an asymptote. The page says how many breaks it made and which kind they were.
Because it does not. The function changes sign at zero, which is what a naive root finder looks for, but it has a pole there rather than a crossing. Every bracket is bisected and the value there checked, so a pole is not reported as a root.
Anything mathjs parses: implicit multiplication (2x, 3(x+1)), the whole function library (abs, max, min, round, sign, sec, csc, cot, nthRoot, gamma, hypot), constants (pi, e) and t for animation. Note that x(x+1) is read as CALLING x, which is a real ambiguity in the grammar, so write x*(x+1) or x (x+1) instead.
It uses adaptive Simpson, which splits an interval wherever the two halves disagree with the whole by more than the tolerance, and it reports the resulting error estimate and how many function evaluations it took. A number without an error estimate is a number with no idea how far out it is.
By scanning for a sign change in the derivative and then refining with golden section, which converges to machine precision inside its bracket. Comparing three consecutive samples, which is the usual shortcut, finds a turning point only to within the sample spacing.
Because a blank canvas is not an answer. The expression is compiled and then evaluated once as a check before it is used, so an unknown symbol (which mathjs only discovers at evaluation time) is caught and named rather than silently producing NaN at every one of a thousand points.
Every calculation runs locally in your browser. Your numbers and expressions are not transmitted or stored.