0
$\begingroup$

I was playing in Matlab when the following occured: I had an integral $I$ which I computed with the (a) Composite Simpson's Rule and (b) Adaptive Simpson's Method (my teacher told me that the built-in function quad in Matlab uses this method). These computations resulted in two approximations $I_1,I_2$ of $I$ for (a) and (b) respectively.

Prior to these computations I computed a reference solution to the problem, that is: an approximation of $I$ with a very low tolerance level (for example $10^{-15}$, compared to $10^{-6}$ which was used in later computations). Call this reference solution (approximation) $I_*$.

After finding $I_*$ I was able to compare $|I_1-I_*|$ with $|I_2-I_*|$. To my surprise $|I_1-I_*|<|I_2-I_*|$, and so: method (a) was more effective than method (b) in this particular example.

Now follows a general question: is there some general condition(s) for which it is true that $|I_1-I_*|<|I_2-I_*|$?

EDIT: Put

$y(x)=\frac{1-\arctan(p(x-1))/\pi}{2-\cos(\pi x)}$.

I am integrating $\pi \cdot y^2$ over $0 \leq x \leq 2.6$:

$$\pi \int_0^{2.6} y(x)^2 dx.$$

For $p=1$ I found that $|I_1-I_*|>|I_2-I_*|$, for $p=1000$ I found that $|I_1-I_*|<|I_2-I_*|$.

Below is the graph of $\pi \cdot y(x)^2$ for $p=1, 1000$

Graph of $\pi \cdot y(x)^2$ for $p=1, 1000$

$\endgroup$
  • $\begingroup$ Could you give the integral ? $\endgroup$ – Claude Leibovici Jan 8 '14 at 6:04
  • $\begingroup$ @ClaudeLeibovici Done. $\endgroup$ – bobbo Jan 8 '14 at 6:10
0
$\begingroup$

I suggest you have a look at

http://ezekiel.vancouver.wsu.edu/~cs330/lectures/integration/simpsons.pdf

They have a good presentation of what you ask.

$\endgroup$
  • $\begingroup$ This (see relation (33)) tells me (?) that given a tolerance level $\epsilon$, we should check that $|I_{[a,b]}-(I_{[a,c]}+I_{[c,b]})|<15\epsilon$ (where $I_{[a,b]}$ is the approximation of the integral over $[a,b]$) before proceeding. I do not understand how this answers my question, or hints at an answer to my question, or any other relation provided in the pdf-file. $\endgroup$ – bobbo Jan 8 '14 at 6:37
  • $\begingroup$ @bobbo. I agree : there is something strange I need to investigate. I shall come back soon. $\endgroup$ – Claude Leibovici Jan 8 '14 at 6:55
  • $\begingroup$ @bobbo. I do not use Mathlab but another CAS. I did not face any problem for the case where p=1. But, for p=1000, whatever I have been able to do, I have an error message claiming "Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small". So, I think that the problem is really related to your specific integral. Did you try the various options usable in "quad" ? Did you try using "quad1" and "quadgk" ? $\endgroup$ – Claude Leibovici Jan 8 '14 at 7:12
  • $\begingroup$ Yes, I also think it depends on the specific integrand. That is why there is such a change when we change $p$ from 1 to 1000. I can compute the integral with quad in Matlab, and using my own implementation of Composite Simpson's rule. What options do you mean? Here is another example (p. 5 of 6) for which $|I_1-I_*|<|I_2-I_*|$: math.usm.edu/lambers/mat460/fall09/lecture30.pdf ("Although the composite Simpson method contains half the error [!] of the adaptive quadrature method, 176 more function evaluations are required."). $\endgroup$ – bobbo Jan 8 '14 at 7:29
  • $\begingroup$ Also: there are som general remarks at p. 6 of 6 at math.usm.edu/lambers/mat460/fall09/lecture30.pdf . I do not understand them well. Maybe these remarks relates to my problem in some way (?). $\endgroup$ – bobbo Jan 8 '14 at 7:38

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.