Generate function plot data

Sample a restricted arithmetic expression at evenly spaced x coordinates and return plot-ready JSON.

freeworks offlinenothing uploaded
ToolFunction Plot Data Generator
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

The expression accepts x, arithmetic, parentheses, and eight named Math functions, with caret translated to exponentiation. The closed interval includes both endpoints; non-finite evaluations become null instead of invalid JSON numbers.

  • One hundred one points supplies two endpoints and 99 interior samples, with an upper limit of 1,000.
  • Sampling is not adaptive and says nothing certain about the curve between coordinates.

Worked example

Generate function plot data
Input
											Expression: sin(x)
Min x: -3.14
Max x: 3.14
Points: 9
										
Output
												X       Y
------  ---------
-3.14   -0.001593
-2.355  -0.707951
-1.57   -1
-0.785  -0.706825
0       0
0.785   0.706825
1.57    1
2.355   0.707951
3.14    0.001593
											

When to use this

Lessons sample sine waves, chart components ingest x-y records, and numerical reviews locate sampled discontinuities.

Edge cases

  • log(x) at zero or a negative coordinate yields null.
  • A narrow peak between adjacent x samples can disappear from the result.
  • Implicit multiplication such as 2x and named constants such as pi are unsupported.

References