Note: Simpson's method requires that we have an even number of
subintervals (we must supply an odd number of points) and also that the
size of each subinterval is equal (spacing between each point is equal).
The bounds of the definite integral to which we are approximating is
determined by the our inputs.
Example: approximate([0, 10], [5, 5], [10, 7]) will approximate the definite
integral of the function that produces these coordinates with a lower
bound of 0, and an upper bound of 10.
Example: approximate(function($x) {return $x**2;}, 0, 4 ,5) will produce
a set of arrays by evaluating the callback at 5 evenly spaced points
between 0 and 4. Then, this array will be used in our approximation.
Simpson's Rule:
xn ⁿ⁻¹ xᵢ₊₁
∫ f(x)dx = ∑ ∫ f(x)dx
x₁ ⁱ⁼¹ xᵢ
⁽ⁿ⁻¹⁾/² h
= ∑ - [f⟮x₂ᵢ₋₁⟯ + 4f⟮x₂ᵢ⟯ + f⟮x₂ᵢ₊₁⟯] + O(h⁵f⁗(x))
ⁱ⁼¹ 3
where h = (xn - x₁) / (n - 1)