Skip to content
Quaestio

Graphing calculator

Type a function of x and the curve is drawn straight away. Set the range below the field.

Function
y =
Examples
-10-8-6-4-20246810020406080100
Embed

Embed this tool on your site

Copy the code and paste it where the tool should appear, such as a blog post or a school page. It is free, the box has no ads and the tool calculates in the visitor’s browser.

How it works

The function is written with x as the variable, for example x^2, sin(x) or 1/x. The same functions and constants as in the scientific calculator work here.

The expression is parsed once and then evaluated at nine hundred points across the range, which is why the curve keeps up as you change things.

Where the function has no value the curve breaks rather than being drawn straight through. You can see this on 1/x, which gets no vertical line through zero.

The automatic y scale is based on the curve’s own values but ignores the outermost two per cent. Without that, a single point near an asymptote would squash everything else into a straight line.

Below the chart there are three ways to take the graph with you. The link carries the functions and the range, so whoever opens it sees exactly the same graph and can change it. The image is a PNG to paste into a document.

You can plot up to three functions at once, each in its own colour, which makes it easy to see where two curves cross.

The angle mode affects trigonometry. In radians, sin(x) shows its familiar wave across the range minus ten to ten; in degrees the same curve looks nearly straight, because ten degrees is a small angle.

How the curve is drawn

The range is split into 900 equal steps, so the function is worked out at 901 points, both ends included. From −10 to 10 the step is about 0.022. A detail narrower than one step can fall between the points; shrink the range if a curve looks jagged.

The curve is broken in three cases: where the function has no value, where a point lies more than four chart heights outside the view, and where two neighbouring points differ by more than two chart heights. The last rule is why tan(x) gets no vertical strokes at its asymptotes, even though the function has values on both sides. sqrt(x) has no value for negative x, so on the default range only the right half is drawn.

The scale and the grid

The automatic y scale adds 8% of space above and below the curve. If the function is constant, the scale becomes its value plus or minus 1. If you choose a manual scale but enter a top value that is not larger than the bottom one, the automatic scale is used instead. The grid step is the smallest of 1, 2 or 5 times a power of ten that is at least a tenth of the range across and an eighth of the scale up. From −10 to 10 the step is 2 across, which gives eleven lines, and 5 up, which gives five lines.

The graph plotter starts in radians, whereas the calculators start in degrees. The chart stays in view below the site header while you scroll down to the range and scale.

The link and the image

The link carries the functions in the parameter f, once per function, the range in x0 and x1, the y scale in y as auto or bottom:top, and the angle mode in a. The parameters are encoded under the WHATWG URL Standard, in which a plus sign means a space, so the tool writes + as %2B. If you type a link by hand, f=x^2+1 becomes x^2 1, and since spaces are removed it is read as x^21.

The image is drawn as SVG and converted to a PNG at double size, 1,440 × 880 pixels, with the background filled in so that it still shows in dark mode.

Sources

How the tools are checked