I chose to divide the sum in four parts.
Here are the results of integrating
cube between 0 and 1:
We can see that Simpson’s Rule is way more accurate compared to the algorithm used in the
integrate procedure. Our
simpson-integral function gives us the exact value of the integral, it’s not a coincidence as Simpson’s Rule is known to give exact values for polynomial of degree less than or equal to 3.