Simpson's rule, was Re: Integrating a Taylor series?



On 5/12/2013 3:25 PM, Richard Fateman wrote:
>
>
> simpson(f,x,a,h) := (h/3)*(f(a)+4*f(a+h)+f(a+2*h));

maybe even better is to put a symbolic coefficient in front of x^4... 
that is

ratsimp(
simpson(lambda([x],u*x^4+v*x^3+r*x^2+s*x+t),x,a,h)-integrate(u*x^4+v*x^3+r*x^2+s*x+t,x,a,a+2*h));

which shows you how the error relates to the  4th derivative,  24*u.
The error is (4*h^5/15) * u.