The Three Point Formula requires we supply 3 points that are evenly spaced
apart, and that our target equals the x-components of one of our 3 points.
Example: differentiation(2, function($x) {return $x**2;}, 0, 4 ,3) will produce
a set of arrays by evaluating the callback at 3 evenly spaced points
between 0 and 4. Then, this array will be used in our approximation.
Three Point Formula:
- If the 2nd point is our $target, use the Midpoint Formula:
1 h²
f′(x₀) = - [f(x₀+h)-f(x₀-h)] - - f⁽³⁾(ζ₁)
2h 6
where ζ₁ lies between x₀ - h and x₀ + h
- If the 1st or 3rd point is our $target, use the Endpoint Formula:
- Note that when the 3rd point is our $target, we use a negative h.
1 h²
f′(x₀) = - [-3f(x₀)+4f(x₀+h)-f(x₀+2h)] + - f⁽³⁾(ζ₀)
2h 3
where ζ₀ lies between x₀ and x₀ + 2h