Function Plotter
Type y as a function of x and the curve appears, with the numbers that made it beside it. Four things here are deliberate. Up to six functions share one window, each with its own colour and its own line saying what happened to it, which is why the first screen compares y = x^2, y = 1/x and y = sqrt(x) at once. The curve is broken rather than joined: 1/x has no usable value at zero, so the drawing stops at the edge of the window on one side and starts again on the other, and a point outside the domain, like sqrt(x) below zero, is left blank instead of being drawn as zero. The cursor reads every curve at one x, by pointer or by arrow key, so at x = 2 the readout gives f1 = 4.000, f2 = 0.500 and f3 = 1.414. And every expression is read by a parser written for this page, so the 26 functions this page knows are the whole vocabulary and a name outside it is refused with the list attached. The even grid is 800 steps by default, anything from 32 to 4,000 works, extra points are worked out between samples where a curve turns sharply, and each curve is capped at 12,000 worked points so nothing you type can hang the page.
- Functions
- 3
- x range
- -4 to 4
- Angles
- Radians
- Cursor
- x = 2, f1 = 4
- y range
- auto, -2 to 16
- f1 = 4.000
- f2 = 0.500
- f3 = 1.414
The window
The range along x is yours. The range along y follows the samples unless you set it, and a curve that leaves the window is cut at the edge rather than squashed into it.
Move the pointer across the graph to read the curves under it, or give the graph focus and use the left and right arrow keys: one sample step a press, ten with shift held, and Home or End for the ends of the range. Between 32 and 4,000 even steps across x, which is one more value than that counting both ends, and the page adds its own points between them where a curve turns sharply.
Three cases, worked here
Each line is computed by the same code the graph uses, on the range this page opens with.
- Each function is worked out at 801 evenly spaced values of x from -4 to 4, and neighbouring points are joined with straight lines.
- 30 more points were worked out between samples where a curve turns sharply or leaves the window.
- The y window is set from the samples: twice the upper quartile of each curve's size, rounded out to -2 to 16, so one value beside an asymptote cannot flatten the rest.
- sin, cos and tan take x in radians, so a full turn is 2pi.
- The drawing is cut in 1 place where a curve has no value, leaves the window or jumps, and nothing is drawn across those gaps.
What an expression may contain
x is the input. These functions and constants are the whole vocabulary: a name that is not here is an error rather than a surprise, because the text is parsed here and never run as code.
- sinsine
- coscosine
- tantangent
- sec1 / cos
- csc1 / sin
- cotcos / sin
- asininverse sine
- acosinverse cosine
- ataninverse tangent
- sinhhyperbolic sine
- coshhyperbolic cosine
- tanhhyperbolic tangent
- sqrtsquare root
- cbrtcube root
- absabsolute value
- expe to the power
- lnnatural log
- loglog base 10
- log2log base 2
- floorround down
- ceilround up
- roundround to the nearest whole number
- sign-1, 0 or 1
- modremainder of a divided by b
- minthe smaller of two values
- maxthe larger of two values
- pihalf a turn in radians
- taua full turn in radians
- ethe base of the natural log
- Only the listed functions are available: the expression is read by a parser on this page, never run as code. The list is sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, sqrt, cbrt, abs, exp, ln, log, log2, floor, ceil, round, sign, mod, min, max.
- A feature narrower than the gap between two samples can be missed. Raise the sample count to look closer.
- It plots y against x and reports the samples. It does not solve equations, differentiate, or find where two curves meet.
- Each curve is capped at 12,000 worked points, which is what keeps a hard expression from hanging the page.
Common questions
- How do I plot a function?
- Type the right hand side in the f1 field: the y = is already there. The page opens on three functions over x from -4 to 4, y = x^2, y = 1/x and y = sqrt(x), each worked out at 800 even steps across that range, which is 801 values counting both ends. An empty slot appears as soon as you fill the last one, up to six. Everything else is set by the fields under the graph: the x range, the y range, the angle unit, the sample count and the cursor.
- Why does my graph have a gap in it?
- Because the curve had no value there, or it ran off the window, and joining the two sides would draw a vertical line that is not part of the curve. y = 1/x is the clear case: on its own over -4 to 4 it is drawn as two pieces, and the line under the field reads pole at x = 0, drawn as a gap. y = tan(x) over the same range comes out as three pieces, with poles at x = -1.57 and 1.57. A step the page cannot resolve between two samples, such as the one in floor(x), is cut the same way rather than joined with a near-vertical line.
- What can I type in a function?
- x for the input, numbers, brackets, + - * / ^, and the 26 functions this page knows with 3 constants: sin, cos, tan, sec, csc, cot, asin, acos, atan, sinh, cosh, tanh, sqrt, cbrt, abs, exp, ln, log, log2, floor, ceil, round, sign, mod, min and max, with pi, tau and e. Multiplication can be left out where it is obvious, so 2x, 3 sin(x) and 2(x + 1) all read the way you would write them on paper. A name outside that list is refused with the list attached, because the text is read by a parser here rather than handed to the browser to run, and each expression is held to 240 characters.
- Is x measured in degrees or radians?
- Radians unless you switch it, and the switch is a real mode rather than a relabelling. In degrees, sin, cos and tan take x in degrees, so y = sin(x) reads 1.000 at x = 90, where the same function in radians reads 0.894 there. The inverse functions answer in the same unit, so asin(1) is 90 in degrees and 1.571 in radians. The unit is printed under the x axis, on the readout and in the file you export, so a graph you paste somewhere else still says which one it used.
- How many functions can I graph at once?
- Six, in the slots f1 to f6, each with its own colour, its own path in the export and its own line under the field saying what happened to it. A new empty slot appears as you fill the last one. The colour belongs to the slot rather than to the order, so clearing f2 does not recolour f3, and a function that fails to read is reported on its own row while the others stay on the graph.
- How does the page choose the y range?
- From the samples, unless you set it yourself. Each curve contributes the part of its own range that sits inside twice the upper quartile of its own size, the union of those is rounded outward to a readable step, and that is the window. On the three functions this page opens with, that window is -2 to 16: x^2 reaches 16 at both ends of the x range, while 1/x runs far past that beside the pole and is held to the bulk of its samples instead of flattening the other two curves into a line. Switch the y range to Set it and the window is exactly what you type, with anything outside it cut at the edge.
- How do I read a value off the curve?
- Move the pointer across the graph and the cursor line follows it, marking every curve it crosses and printing each reading under the graph. Give the graph focus and the left and right arrow keys move the cursor one sample step a press, ten with shift held, with Home and End for the two ends of the range. You can also type an exact x in the Cursor field, including pi or an expression such as pi/2. Where a curve has no value at that x, the reading says so rather than showing a zero.
- Can I save the graph?
- The SVG and the PNG are both drawn from the same scene as the stage, so the file cannot disagree with the picture you approved, and each piece of each curve is its own path in the SVG, which is how the gaps survive being pasted somewhere else. The PNG is saved at 1440 by 880 pixels. Copy puts the functions, both ranges, the angle unit, the sample count and every cursor reading on the clipboard as text.
- How is this different from a polar or a parametric grapher?
- This page plots y as a function of x, so there is exactly one y for every x and the curve cannot loop back on itself or cross itself. The polar graphing calculator here plots r as a function of an angle, which is how you draw a cardioid or a rose. The parametric equation grapher drives x and y from one parameter t, which is how a curve closes or crosses. They are three pages because they are three different jobs, not three wordings of one.
- What will this page not do?
- It samples y at evenly spaced values of x and draws what it found. It does not solve an equation, differentiate, find where two curves meet, or prove anything about a shape. A feature narrower than the gap between two samples can be missed, which is what the sample count is for, and each curve is capped at 12,000 worked points so a hard expression cannot hang the page. Everything runs in your browser, and nothing you type is sent anywhere.
Expressions are read by a parser written for this page and never run as code, so only the listed functions exist. The curve is sampled and refined where it turns sharply, so it is a drawing built from samples rather than an algebraic solution: a pole is left as a gap instead of a vertical line, a point outside the domain is left blank, and the angle unit is the one labelled beside the graph.