Question: Writing a Procedure for a Series Representation of an Integral

I am attempting to write a series representation of a general integral of a function from a to b as follows:

int(f(x), x = a..b)= h*sum((c_k)*f(a+kh))+O(h^p),k=1..N;

where h:=(b-a)/(N+1), p(N) is greater than or equal to N + 1 and c_k are coefficients.  I then need to write procedures with Maple to evalue c_k from 1,..,N and also to evaluate P(N) for any N.  If I take the case for N = 3 and N = 6 I have to use those procedures to prove that:

int(f(x), x = a..b)=(4h/3)*(2*f_1 - f_2 +2*f_3) + O(h^5) = (7*h/1440)*(611*(f_1 + f_6) - 453*(f_2 + f_5) + 562*(f_3 + f_4)) + O(h^7) 

where f_k = f(a + kh).  I am really at a loss as to how to write this procedure, although I may have used something similar before:

P:=proc(p) add((1/k^(1/10))*(sin(1/k)-1/k), k=1..10^p) end proc;
seq( evalhf(P(p)), p = 1 .. 5 );


Please Wait...