Wikipedia says that the error for trapezoidal is $$\left|Error\right|=\int_{a}^{b}f\left(x\right)dx- \frac{b-a}{N}\left(\frac{f\left(a\right)+f\left(b\right)}{2}+\sum_{k=1}^{N-1}f\left(a+k\frac{b- a}{N}\right)\right)=\frac{f^{''}\left(\zeta\right)h^{3}N}{12}$$ however I think it should be : $$\left|Error\right|\le\frac{f^{''}\left(\zeta\right)h^{3}N}{12}$$ and equality does not always holds, so why there we have this equality, also I cannot understand the following part: $$\frac{b-a}{N}\left(\frac{f\left(a\right)+f\left(b\right)}{2}+\sum_{k=1}^{N-1}f\left(a+k\frac{b- a}{N}\right)\right)$$ I think it should be $$\frac{b-a}{N}\sum_{k=1}^{N}\frac{f\left(a_{k}\right)+f\left(a_{k-1}\right)}{2}$$ Can someone explain the two problems?
-
When someone says the measurement is 5 with an error of 1, what does it mean to you? – Calvin Lin Dec 06 '19 at 15:04
1 Answers
I find the presentation in Wikipedia to be disorganized and unclear. It would be better to read a textbook or even some clearly written course notes such as these.
There are two well-known versions of the error formula. One is $$\text{Error} = -\frac{f''(\zeta) h^3 N}{12} \text{ for some $\zeta \in [a,b]$.}$$
Now if you just choose a random $\zeta$ in the interval $[a,b],$ the right hand side of that formula might be greater than the error or even less than the error. But the formula doesn't say to take any random $\zeta$. It says that if you choose a particularly "good" value of $\zeta$ in that interval you will be able to make $-\frac{f''(\zeta) h^3 N}{12}$ be exactly equal to (not greater than) the actual error of your particular application of the trapezoid rule.
The formula doesn't tell you how to find a "good" value of $\zeta$ that will be in the interval $[a,b]$ and will make the formula true. It just says that such a value of $\zeta$ exists somewhere in the interval $[a,b]$. So for practical purposes, we might choose a value $\zeta_\max \in [a,b]$ such that $f''(\zeta_\max)$ has the largest absolute value that $f''$ has anywhere on $[a,b]$. That means $\lvert f''(\zeta_\max)\rvert \geq \lvert f''(\zeta)\rvert$ where $\zeta$ is the "good" value (the value we know exists, but don't know how to find). Then we might say that
$$\left\lvert\text{Error}\right\lvert \leq \frac{f''(\zeta_\max)h^3 N}{12}.$$
In this formula, if we want "Error" to mean the exact error and not just some kind of error bound, we cannot guarantee equality and must use the $\leq$ symbol instead. That's because we picked a "worst case" choice of $\zeta$ instead of the "actual" choice of $\zeta.$
I think, however, rather than $\zeta_\max$ it's more common that we write something like $$ M = \max_{a\leq x\leq b} f''(x),$$ and then the second formula can be written $$\left\lvert\text{Error}\right\lvert \leq \frac{M h^3 N}{12}.$$
I see both formulas represented in some form or another in the Wikipedia article. But there is one place where the text says "the error is bounded by" and then there is a formula of the form $$ \text{error} = \ldots .$$ Here the $\leq$ relation is implied by the words "bounded by", and the word "error" in the equation is not really the error but merely the error bound. This is one of the ways the article is disorganized and unclear; it would have been better if the word "error" had simply not been written in that equation at all. The word "error" in that equation certainly does not mean what you mean when you write "|Error|".
For the second part of your question, you and Wikipedia are both right, because $a+k\frac{b-a}{N} = a_k$ according to the way you numbered the $a_k,$ and
$$\frac{f(a)+f(b)}{2} + \sum_{k=1}^{N-1}f(a_k) = \sum_{k=1}^{N}\frac{f(a_k)+f(a_{k-1})}{2}.$$
Consider this example where $N=3$: \begin{multline} \frac{f(a_1)+f(a_0)}{2} +\frac{f(a_2)+f(a_1)}{2} +\frac{f(a_3)+f(a_2)}{2} \\ = \frac{f(a_0)+f(a_1)}{2} +\frac{f(a_1)+f(a_2)}{2} +\frac{f(a_2)+f(a_3)}{2} \\ = \frac{f(a_0)}{2} +\frac{f(a_1)+f(a_1)}{2} +\frac{f(a_2)+f(a_2)}{2} +\frac{f(a_3)}{2} \\ = \frac{f(a_0)}{2} +f(a_1) +f(a_2) +\frac{f(a_3)}{2} \\ = \frac{f(a_0)+f(a_3)}{2} +\left(f(a_1) + f(a_2)\right). \end{multline}
Your formula is more intuitively obvious, but the Wikipedia formula is preferred for calculation since it does not require so many additions and divisions.
- 98,388
-
thanks for the link, but there is something that I cannot understand, how in the link $\int_{a=x_{0}}^{b=x_{1}}f\left(x\right)dx$ changes to $\int_{x_{0}}^{x_{1}}p_{1}\left(x\right)dx+\frac{1}{2}\int_{x_{0}}^{x_{1}}f^{''}\left(\zeta\right)\left(x- x_{0}\right)\left(x-x_{1}\right)dx$, how using linear Lagrange polynomial it can be proved? – Absurd Dec 06 '19 at 18:53
-
Apparently we're diving into the middle of a set of course notes in that case, so presumably $p_1$ is defined in an earlier note. It was just an example, maybe not the best one. The conclusion is clear but the details of the proof assume previous work not shown. Really a good textbook would be better but they're harder to link to online. – David K Dec 07 '19 at 02:45
-
If the goal is not just to understand what the formulas mean, but also to be able to prove them, I think that deserves a separate question--and that question has already been asked and answered at least once on this site. See https://math.stackexchange.com/questions/312429/trapezoid-rule-error-analysis – David K Dec 07 '19 at 03:26
-