| 316 | /** |
| 317 | * An 8th-order centered difference approximation can be used to get a highly |
| 318 | * accurate approximation of the first derivative of a function. |
| 319 | * The formula for the 8th-order centered difference approximation for the |
| 320 | * first derivative is given by: |
| 321 | * |
| 322 | * $$ f'(x) \approx \frac{1}{280h} \left[ -f(x-4h) + \frac{4}{3}f(x-3h) - \frac{1}{5}f(x-2h) + \frac{8}{5}f(x-h) - \frac{8}{5}f(x+h) + \frac{1}{5}f(x+2h) - \frac{4}{3}f(x+3h) + f(x+4h) \right]$$ |
| 323 | * |
| 324 | * Note: Mathematica uses an 8th order approximation for the first derivative |
| 325 | * |
| 326 | * f: the function |
| 327 | * x: the point at which to approximate the derivative |
| 328 | * h: the step size |
| 329 | * |
| 330 | * See https://en.wikipedia.org/wiki/Finite_difference_coefficient |
| 331 | */ |
| 332 | /** |