-1
$\begingroup$

I know that the composite trapezoidal rule (with $n$ nodes) is the generalization of the trapezoidal rule (with only tow nodes), so the composite one is more accurate than the other.

But actually, when I approximate $\int_{0}^{2} e^{2x}\sin(3x) dx$ using the simple trapezoidal rule I've got $-15.255569$, then the actual error equals: $1.041592$.

And when I approximate this integral using the composite rule with $n=4$ I've got $-11.753893$, then the actual error equals $2.460084$. Why does this happen?

$\endgroup$
  • $\begingroup$ No, I don't think people will want to guess what you are talking about. Giving those results without even mentioning what are the values of $a$ and $b$ you were using is still more funny than most questions on this site. $\endgroup$ – Professor Vector Dec 19 '17 at 17:15
  • $\begingroup$ Also, describe your calculation process. Perhaps you will find some error, missed detail during that write-up. Also look up the Shannon and related sampling theorems. To get meaningful results with 1 interval, you need $b-a\le \pi3$. $\endgroup$ – LutzL Dec 19 '17 at 17:20
  • $\begingroup$ Using the trapezoidal rule: $\int_{0}^{2}e^{2x}sin(3x) dx=(h/2)[f(0)+f(2)]$ where$h=2$ $\int_{0}^{2}e^{2x}sin(3x) dx=1(0-15255569)=-15.255569$ so the actual error equals: $|14.213977-15.255569|=1.041592$ Using the composite trapezoidal rule with $n=4$ $\int_{0}^{2}e^{2x}sin(3x) dx=(h/2)[f(0)+2(f(0.5)+f(1)+f(1.5))+f(2)]$ where $h=0.5$ $\int_{0}^{2}e^{2x}sin(3x) dx=-11.753893$ and the actual error equals: $|-11.753893+14.213977|=2.460084$ $\endgroup$ – soso sos Dec 19 '17 at 17:53
  • $\begingroup$ The sampling rate is too low. To get a meaningfull approximation of the function with the samples you will need at least 6 intervals per period, or in other words, the sub-intervals should at most be $\p/9$ long ($\pi/3$ to satisfy sampling theorems as the most extreme condition), thus one or 4 intervals are not in the working area of the composite trapezoidal rule. $\endgroup$ – LutzL Dec 19 '17 at 18:08
  • 1
    $\begingroup$ Please add relevant information by editing the question. This makes the question more complete and is better readable. $\endgroup$ – LutzL Dec 19 '17 at 18:10
3
$\begingroup$

There is no theorem that says "for every function, the composite trapezoidal rule is more accurate than the simple trapezoidal rule". It is true that in most situations, using more nodes will produce more accurate results. Indeed, suppose $f$ is continuous on the interval $[a,b]$, and let $E_n$ be the error of the trapezoidal rule with $n$ nodes. Then it is true that $$ E_n\to 0\quad \text{as } \ n\to\infty $$ but this does not mean that the sequence $E_n$ is decreasing. It is quite possible for the error to become larger, then smaller, then larger again, then smaller again.

For another example, consider the integral $$ \int_0^1 (9x^2-5x^4)\,dx = 2 $$ The simple trapezoidal rule gives $(f(0)+f(1))/2 = (0+4)/2 = 2$, which is exactly correct. The rules with more nodes have some error: for example, $$ \frac{f(0)+2f(1/2)+f(1)}{4} \approx 1.96875, \quad $$ and I calculated that the composite rule with $n$ nodes has error $$ \frac{n(n-2)}{6n^4} $$ So in this example, the simple trapezoidal rule is strictly more accurate than the composite rule for any number of nodes $n>2$. It just happens to be so lucky for this specific function on this specific interval.

$\endgroup$

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.