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.
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\).
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.