Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Step size h = (b - a) / n
0.4
51 sample points: f(a) ... f(b)
Number of sample points (n+1) 51
f at first point (x = a) -9.160928
f at last point (x = b) 10.839072
i x f(x)
-10 -9.160928
-9.6 -8.615312
-9.2 -8.225156
-8.8 -7.988907
-8.4 -7.880711
-8 -7.8545
-7.6 -7.85126
-7.2 -7.808351
-6.8 -7.669397
-6.4 -7.393185
-6 -6.96017
-5.6 -6.375566
-5.2 -5.668517
-4.8 -4.887499
-4.4 -4.092667
-4 -3.346356
-3.6 -2.703242
-3.2 -2.201705
-2.8 -1.857778
-2.4 -1.662606
-2 -1.583853
-1.6 -1.5708
-1.2 -1.562358
-0.8 -1.496707
-0.4 -1.321061
0 -1
0.4 -0.521061
0.8 0.103293
1.2 0.837642
1.6 1.6292
2 2.416147
2.4 3.137394
2.8 3.742222
3.2 4.198295
3.6 4.496758
4 4.653644
4.4 4.707333
4.8 4.712501
5.2 4.731483
5.6 4.824434
6 5.03983
6.4 5.406815
6.8 5.930603
7.2 6.591649
7.6 7.34874
8 8.1455
8.4 8.919289
8.8 9.611093
9.2 10.174844
9.6 10.584688
10 10.839072

What this tool does

This calculator takes any single-variable function \(f(x)\), a closed interval from \(a\) to \(b\), and a number of subdivisions \(n\). It builds a table of \(n+1\) evenly spaced points and their function values, and it shows how the curve behaves across the interval. It is useful for plotting graphs, finding sign changes (roots), and preparing data for numerical methods such as the trapezoidal rule or bisection.

How to use it

Type the expression in x using standard math notation: + - * / and ^ for powers, parentheses, and functions like sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, sqrt, abs, ln, and log. Two-argument log(base, x) gives a logarithm to any base, while log(x) is the natural log. The constants pi and e are recognized. Set the lower bound \(a\), the upper bound \(b\), and pick \(n\) from the dropdown. All trigonometric arguments are in radians, not degrees.

The formula explained

The spacing is \(h = (b - a) / n\). Each sample point is $$x_i = \text{a} + i\,h, \qquad y_i = f(x_i)$$ $$\text{where}\quad \left\{ \begin{aligned} h &= \dfrac{\text{b} - \text{a}}{\text{n}} \\ i &= 0,\, 1,\, 2,\, \ldots,\, \text{n} \end{aligned} \right.$$ for \(i = 0\) up to \(n\), which gives exactly \(n + 1\) points: \(f(a)\), \(f(a+h)\), \(f(a+2h)\), ..., \(f(b)\). Every value \(y_i\) is obtained by evaluating the parsed expression at \(x = x_i\). Points where the function is undefined (division by zero, log of a non-positive number, sqrt of a negative number) are flagged as undefined.

Number line interval from a to b divided into n equal steps of width h
The interval [a, b] is split into n equal subintervals of width h, giving sample points x_i.

Worked example

For \(f(x) = x - \cos(x)\) on \([0, \pi]\) with \(n = 4\), $$h = \pi/4 = 0.785398.$$ The values are: \(x=0\) gives \(-1\); \(x=0.7854\) gives \(0.0783\); \(x=1.5708\) gives \(1.5708\); \(x=2.3562\) gives \(3.0633\); \(x=3.1416\) gives \(4.1416\). The curve rises steadily from \(-1\) to about \(4.14\), crossing zero just after \(x = 0\).

Smooth curve y equals f of x with sampled points and a value table of x and f(x)
Each x_i produces a value y_i = f(x_i), filling the table and tracing the plotted curve.

FAQ

Are angles in degrees? No. sin, cos, and tan use radians. Convert degrees by multiplying by \(\pi/180\).

How many points are produced? Always \(n + 1\), because both endpoints \(a\) and \(b\) are included.

What if a is larger than b? The step \(h\) becomes negative and the table runs from \(a\) down to \(b\); it is still valid.

Last updated: