Derivative Graph & Finite Difference Calculator
Check an exact derivative at a chosen x, then shrink the sample step. See when a finite difference improves and when small changes disappear in floating-point arithmetic.
Compare analytic and finite-difference slopes
Inspect polynomial slope as a step shrinks. Measure the separate effects of truncation and floating-point rounding.
Polynomial and probe
The graph spans one radius on either side of the probe. The audit tests 13 steps, halving h each time.
Slope and error audit
Exact analytic slope
f′(2) = 10
f′(x) = 3x^2 − 2
Step 1 of 13 · h = 0.5
- Exact quotient
- 41/4
- Binary64 quotient
- 10.25
- Exact truncation
- 1/4
- Rounded coordinates and samples
- 0
- Subtraction rounding
- 0
- Step representation and division
- 0
- Total arithmetic effect
- 0
- Total error from analytic slope
- 1/4
Lowest tested binary64 error at step 13 · h = 0.0001220703
Nonzero magnitudes on a log scale from 10^-8 to 10^0.
Step ledger and CSV
| Step | h | Exact slope | Binary64 | Total error |
|---|---|---|---|---|
| 1 | 0.5 | 41/4 | 10.25 | 1/4 |
| 2 | 0.25 | 161/16 | 10.0625 | 1/16 |
| 3 | 0.125 | 641/64 | 10.01563 | 1/64 |
| 4 | 0.0625 | 2561/256 | 10.00391 | 1/256 |
| 5 | 0.03125 | 10241/1024 | 10.00098 | 1/1024 |
| 6 | 0.015625 | 40961/4096 | 10.00024 | 1/4096 |
| 7 | 0.0078125 | 163841/16384 | 10.00006 | 1/16384 |
| 8 | 0.00390625 | 655361/65536 | 10.00002 | 1/65536 |
| 9 | 0.001953125 | 2621441/262144 | 10 | 1/262144 |
| 10 | 0.0009765625 | 10485761/1048576 | 10 | 1/1048576 |
| 11 | 0.0004882813 | 41943041/4194304 | 10 | 1/4194304 |
| 12 | 0.0002441406 | 167772161/16777216 | 10 | 1/16777216 |
| 13 | 0.0001220703 | 671088641/67108864 | 10 | 1/67108864 |
How to use this calculator
- Enter the constant through fourth-power coefficients, a probe x, an initial step h and the graph radius.
- Compare the analytic slope with a forward, backward or centered difference. Move the step slider to halve h.
- Read the signed errors and check whether the sample coordinates or function values have rounded together.
- Switch to the derivative graph to locate the probe. Open the step ledger to inspect or export the full tested sequence.
The Formula
The mathematical logic powering this calculation is:
Differentiate Σ cⱼxʲ term by term. The exact forward quotient uses [f(x+h) − f(x)]/h, the backward quotient [f(x) − f(x−h)]/h, and the centered quotient [f(x+h) − f(x−h)]/(2h). Truncation is the exact quotient minus the analytic derivative.
The parallel binary64 path evaluates the polynomial with Horner multiplication and addition at the floating-point sample coordinates. It subtracts the two resulting values and divides by the represented step. Each finite binary64 result is decoded as its exact binary fraction to measure its signed error against the rational result.
The sample effect uses the exact difference of the rounded sample values divided by the authored denominator, less the exact quotient. Subtraction rounding measures the change between that exact difference and the actual binary64 subtraction, in quotient units. Step and division effect measures the remaining change to the actual quotient. These contributions add to the arithmetic effect. Add truncation to obtain total error.
The 13 steps are h₀ through h₀/4,096. The best tested binary64 step minimizes absolute total error and keeps the first step if tied. The error chart uses log₁₀ for nonzero magnitudes and a separate zero lane when needed. The derivative graph samples 65 points centered at the probe.
Use signed coefficients, a probe and a positive graph radius within magnitude 1,000,000, with up to six decimal places. The radius is at least 0.000001. The initial h is 0.000000000000001 to 1,000,000, with up to 15 decimal places. The worksheet covers polynomials through degree four.Worked Example
If you input:
- Polynomial coefficients: f(x) = x³ − 2x
- Probe x: 2
- Initial step h: 0.5
- Graph radius: 2
Result:
The derivative is 3x² − 2, giving slope 10 at x = 2. At h = 0.5 the forward quotient is 53/4, backward is 29/4 and centered is 41/4. The centered truncation error is 1/4 and binary64 adds no rounding error for this step.
Frequently Asked Questions
Why can a smaller step increase error?
A smaller step can reduce the exact formula error while leaving less change between rounded function values. Dividing by the smaller step can amplify the effect of rounding.
What happens when two sample values round together?
Their binary64 subtraction gives zero. The exact quotient can still be nonzero. The sample effect identifies loss already present in the rounded values, even if the subtraction instruction itself adds no rounding.
Why is centered truncation often smaller?
Symmetric samples cancel the even powers of h in the numerator. For a cubic, this leaves a quotient error proportional to h squared. For a quadratic, the exact centered quotient has zero truncation.
Can the total error be smaller than the truncation alone?
Yes. The rounding contribution is signed. It can cancel part of the truncation error, so the graph shows magnitudes while the ledger retains the signs.
Is the suggested step best for every input?
It is the lowest-error step from this worksheet’s 13 tested values at the current x and method. A different polynomial, location or evaluation algorithm can change that comparison.
Why do exact and binary64 scores disagree?
The exact path retains decimal values as fractions. The binary64 path rounds the inputs, function evaluations and arithmetic operations, so it can reveal differences hidden by the displayed number of digits.
Similar Calculators
Mean Value Theorem & Tangent Line Calculator
Find where a tangent matches the secant slope, check Mean Value Theorem and Rolle’s conditions, or calculate a tangent line at a chosen point.
Rational Limit Calculator with Graph
Find exact one-sided limits of a rational function. Compare the lowest nonzero powers, cancel common factors and graph holes and vertical poles.
Riemann Sum & Integral Approximation Calculator
Compare left, right, midpoint and trapezoid estimates for a cubic or lower-degree polynomial. See the signed rectangles and how the error converges.
Polynomial Division Calculator
Divide polynomials using long or synthetic division. Inspect each step, the exact quotient and remainder, and the reconstruction identity.
Differential Equation Calculator · Linear Initial Value
Solve a first-order linear differential equation in one or more segments. Compare the analytic solution, Euler, and Heun with errors and step gains.
Instantaneous Velocity Calculator from Position Samples
Estimate instantaneous velocity from five position-time samples. Compare two local slopes, see the effect of measurement error, and export exact finite-difference weights.
Quadratic Surface Gradient & Directional Derivative Calculator
Calculate the gradient from a two-variable quadratic equation. Plot level curves, find the directional derivative, and measure tangent-plane error.
