Calculator
Example data table
| Function | x₀ | h | Method | Expected idea |
|---|---|---|---|---|
| sin(x)+x^2 | 1 | 0.001 | Central difference (5-point) | Near derivative: cos(1)+2 |
| sqrt(x) | 4 | 0.0005 | Central difference (2-point) | Slope close to 1/(2*sqrt(4)) |
| ln(x) | 2 | 0.001 | Forward difference | Slope close to 1/2 |
Formula used
The slope of a curve at a point is the derivative: m = f′(x₀).
- Central (2-point): (f(x₀+h) − f(x₀−h)) / (2h)
- Central (5-point): (−f(x₀+2h)+8f(x₀+h)−8f(x₀−h)+f(x₀−2h)) / (12h)
- Forward: (f(x₀+h) − f(x₀)) / h
- Backward: (f(x₀) − f(x₀−h)) / h
The tangent line is y = m(x − x₀) + f(x₀).
How to use this calculator
- Enter a function f(x) using supported operators and functions.
- Set the point x₀ where the tangent slope is needed.
- Choose h. Start with 0.001 for smooth functions.
- Select a method. Use 5-point for better stability.
- Press Compute Slope. Results appear above the form.
- Download CSV or PDF for records and reports.
FAQs
1) What does “curve slope” mean?
It is the derivative at a point, showing how fast the curve rises or falls there. It equals the slope of the tangent line touching the curve at that point.
2) Why do I need a step size h?
Numerical differentiation uses nearby points. The step size controls how close those points are. Too large loses detail; too small can amplify rounding and evaluation noise.
3) Which method should I choose?
The 5-point central method is usually smoother and more accurate for well-behaved functions. Use forward or backward difference when the function is only defined on one side.
4) What if my function has sharp corners?
At a corner, the derivative may not exist. The calculator may return different slopes depending on h and method. Try smaller h and compare one-sided methods.
5) Why do I see a domain error?
Some functions have restricted inputs, like ln(x) needing x > 0 or sqrt(x) needing x ≥ 0. Adjust x₀ and h so all sampled points stay inside the valid domain.
6) What is the tangent angle?
It is the angle between the tangent line and the positive x-axis. It is computed as arctan(m). You can view it in degrees or radians.
7) How accurate are the results?
Accuracy depends on the function, h, and method. For smooth functions, 5-point central with a small h often works well. Always sanity-check with a known derivative when possible.