1
$\begingroup$

I have written a program that implements the composite Simpson's rule for integrating functions over the interval $[0,1]$. In checking the program for correctness, I test the routine on the integral $\int_{0}^1 x^5dx$ and I obtain the following results:

$$ \begin{array}{c|lcr} m & \text{Approximation} & \text{Error} \\ \hline 8 & 0.24169 & 0.04169 \\ 16 & 0.22083 & 0.02083 & \\ 32 & 0.21041 & 0.01041 & \\ 64 & 0.20520 & 0.00520 \end{array} $$

What is the factor by which the errors should decrease as the number of panels, M, is doubled?

On the basis of the computational results listed above, can I conclude that my program is working correctly?

I know that composite Simpson's rule has an order of accuracy of 4. Basically, I was wondering if this means that the error should decrease by a factor of $\frac{1}{4}$, whereas I can see that it is decreasing by a factor of $\frac{1}{2}$.

In other words, I was hoping somebody could clarify the relationship between the order of accuracy and the actual change in the error that you would expect to see from one iteration to the next.

Thank you very much for your help.

$\endgroup$
1
$\begingroup$

Before I answer your question, I note that

$$ \int_0^1 x^5 dx = \frac{x^6}{6} \Bigg|_0^1 = \frac{1}{6},$$

which is quite far from all of your estimates. I wonder if you aren't checking something else instead?


When people say composite Simpon's has fourth order convergence, they mean that if you double the number of (evenly spaced) intervals, so that each interval is $(1/2)$ the size, then the resulting error should be around $(1/2)^4 = 1/16$ as bad.

In particular, the general bound for the error of the composite Simpson's rule for a function $f$ over an interval $[a,b]$ is $$\frac{b-a}{180} h^4\max_{[a,b]} \lvert f^{(4)}(x)\rvert,$$ where $h$ is the width of the subintervals you've split the interval into. For your application, the thing you're changing is $h$: using twice the intervals amounts to changing $h$ by a factor of $1/2$.

$\endgroup$
  • $\begingroup$ First of all, thank you for your help! Just to be clear, this scenario comes from a practice exam that I am using to study. I realize that the estimates are ridiculous, but it is just a fabricated situation. However, the real purpose of the question is to understand whether or not you would expect to see the error getting cut in half at each iteration. $\endgroup$ – Hawleyluyah Mar 18 '18 at 23:45
  • $\begingroup$ Based on your response, am I correct in thinking that you would expect to see that the "(i+1)th" error is 1/16th the size of the "(i)th" error? $\endgroup$ – Hawleyluyah Mar 18 '18 at 23:48
  • 1
    $\begingroup$ @Hawleyluyah yes, you would expect each subsequent error to be around $1/16$ the size of the previous error. $\endgroup$ – davidlowryduda Mar 19 '18 at 0:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.