Simpsons Rule

I have not followed the logic, but would it be feasible to extend to a cumulative Simpsons rule for evenly spaced data of any length?

Some modifications can be done to the code I suggested, cumulating the sum at a certain point might be done using a loop.
I will dig into it the next days.

There is a slight problem with your code. The error comes from the area where you make use of Simpsonā€™s 3/8 rule. Kindly check your code

You an test with the following

f1(x) = x^2;
f2(x) = x^3;
a = 0; b = 1;
# test1
n = 10 ;
simps(f1, a, b, n)
simps(f2, a, b, n)
# result
0.3333333333333333
0.25  

# test2
n = 11 ;
simps(f1, a, b, n)
simps(f2, a, b, n)
# result
0.25569747057350367
0.17828927896546232

As said above, if you have a function to calculate, Simpsonā€™s suggest you pick even number of slices.
If you already have a vector with uneven number of components, then the Simpsonā€™s 3/8th rule could be employed.
That to be said, there is a room to modify the code with any choice of slice numbers. I will put it through.