The trapezoid approximation: $f$ is the function, $[a,b]$ the interval, $k$ the number of subintervals.
The trapezoid error: $M$ is an upper bound on the second derivative of $f$.
An example: Let $f=e^{-x^2}$, on the interval $[0,1]$.
Compute and plot the second derivative to find the maximum value of $|f^{(2)}|$.
So the maximum appears to be 2. Now compute the approximation until the error is small; try increasing $j$ until the two values $A-E$ and $A+E$ round to the same value to two decimal places.
The Simpson's rule function and error computation are similar. You must put in an even number for $k$; the function doesn't check for this.
The maximum value of $|f^{(4)}|$ appears to be 12.
Let's see what Sage thinks the value is.
To use this worksheet in Sage, download this file simpson_and_trapezoid.sws and then upload it to your own Sage account.