The best forward-difference step is about 10⁻⁸
The forward difference is best near , with error between and ; at rounding pushes both errors above .
forward differencecentral difference
| Quantity | Viv | Checked by |
|---|---|---|
best forward | 6.60275 × 10−9 | the forward difference is best at h = 1e-7 to 1e-9, with an error between 1e-9 and 1e-7; the central difference's best error is below 1e-10 and more than 10 times smaller |
best central | 5.85874 × 10−11 | the central difference's best error is below 1e-10 and more than 10 times smaller |
best k forward | 8 | the forward difference is best at h = 1e-7 to 1e-9, with an error between 1e-9 and 1e-7 |
finite_difference_step.viv
Output · native build · Oct 14, 2026 · 1.48 s
best_forward: 6.60275e-09 best_central: 5.85874e-11 best_k_forward: 8 best_k_central: 7 err_forward_at_1e12: 0.000432314 err_central_at_1e12: 0.00021027
- ✓ the forward difference is best at h = 1e-7 to 1e-9, with an error between 1e-9 and 1e-7
- ✓ the central difference's best error is below 1e-10 and more than 10 times smaller
- ✓ at h = 1e-12 both errors are larger than 1e-6
Open in the workbenchAtlasMore math claims
- Full statement
- For the derivative of at , the forward difference is most accurate near , with a best error between and , while the central difference reaches a best error below , more than 10 times smaller. At rounding error, which grows like , has made both errors larger than .
- Scope
- Steps for to 15 only; one function at one point. The best step depends on the size of f's second and third derivatives.
- Reference
- The exact derivative ; the optimal steps and from balancing truncation against rounding (Nocedal and Wright, Numerical Optimization (2nd ed.), section 8.1).
claims/math/finite_difference_step.viv#5a32ecc380