2

Error analysis for basic Simpson's rule: $$\int_a^{a+2h}f(x)\:dx\approx \frac{h}{3}[f(a)+4f(a+h)+f(a+2h)]$$ The error term in Simpson's rule can be established by using the Taylor series such that $$f(a+h)=f+hf'+\frac{1}{2!}h^2f''+\frac{1}{3!}h^3f'''+\cdots$$ $$f(a+2h)=f+2hf'+2h^2f''+\frac{4}{3}h^3f'''+\cdots$$ $$\frac h3[f(a)+4f(a+h)+f(a+2h)]=2hf+2h^2f'+\frac 43h^3f''+\frac 23h^4f'''+\cdots\quad (1)$$ Let $$F(x)=\int_a^xf(t)\:dt$$ The taylor series for $F(a+2h)$ is $$F(a+2h)=F(a)+2hF'(a)+2h^2F''(a)+\frac{4}{3}h^3F'''(a)+\cdots$$ By the FTC, $F'=f,F''=f',$ and so on. Observe that $F(a)=0$, $$\int_a^{a+2h}f(x)\:dx=0+2hf+2h^2f'+\frac{4}{3}h^3f''+\cdots\qquad(2)$$ Subtracting $(1)$ from $(2)$, $$\int_a^{a+2h}f(x)\:dx-\frac h3[f(a)+4f(a+h)+f(a+2h)]=-\frac{h^5}{90}f^{(4)}+\cdots$$ Error analysis for composite Simpson's rule:
Suppose that the interval $[a,b]$ is subdivided into an even number of subintervals, say n,each of width $h=\frac{b-a}{n}$. Then the partition points are $x_i=a+ih,0\leq i\leq n$. Now we have, $$\int_a^bf(x)\:dx=\sum_{i=1}^{\frac n2}\int_{a+2(i-1)h}^{a+2ih}f(x)\:dx$$ Using basic Simpson's Rule, $$\approx \sum_{i=1}^{\frac n2}\frac h3[f(a+2(i-1)h)+4f(a+(2i-1)h)+f(a+2ih)]-\frac{1}{90}h^5\sum_{i=1}^{\frac n2}f_{a\leq\delta\leq b}^{(4)}(\delta)$$

But how to get the error term like mentioned in book $-\frac{b-a}{180}h^4f^{(4)}(\delta)?$
I feel there must be another way to derive those formula by easily as I found great response from my previous Post.
I heartily thank if anyone explain any easy approach in details.

user5713492
  • 16,333
falamiw
  • 956

3 Answers3

2

The reason why you got a "different" answer is that the error term you got should be $$ -\frac{1}{90}h^5\sum_{i=1}^{n/2}f^{(4)}(\delta) $$ where $$ \delta \in (x_{2i-2},x_{2i}) $$ since you were summing up the errors on each subintervals. Therefore, you need to the following analysis:

Recall the Extreme Value Theorem, if $f \in C^4[a,b]$, it attains its minimum and maximum within the interval $[a,b]$. That is $$ \min_{x \in [a,b]} f^{(4)}(x) \leq f^{(4)}(\delta) \leq \max_{x \in [a,b]} f^{(4)}(x) $$ Therefore, $$ \min_{x \in [a,b]} f^{(4)}(x) \leq \frac{2}{n}\sum_{i=1}^{n/2}f^{(4)}(\delta) \leq \max_{x \in [a,b]} f^{(4)}(x) $$ By applying the the Intermediate Value Theorem, there is a $\mu \in (a,b)$ such that $$ f^{(4)}(\mu) = \frac{2}{n}\sum_{i=1}^{n/2}f^{(4)}(\delta) \quad\Longrightarrow\quad \frac{n}{2}f^{(4)}(\mu) = \sum_{i=1}^{n/2}f^{(4)}(\delta) $$ Namely, $$ E(f) = -\frac{1}{90}h^5\sum_{i=1}^{n/2}f^{(4)}(\delta) = -\frac{n}{180}h^5f^{(4)}(\mu) $$ While $h = (b-a)/n$, we have $$ E(f) = -\frac{b-a}{180}h^4f^{(4)}(\mu) $$ as desired. Here we have $\mu \in (a,b)$, and the function value is valued in the entire interval.

Tab1e
  • 1,315
  • 10
  • 22
1

The second part was easy to fix, see the post of @UnbelieveTable after he edits it. But the first part is quite sketchy: where did the $f^{(4)}$ term come from and what are the arguments of all those functions and derivatives. Like suppose for example that you had the quadrature formula $$\int_0^1f(x)dx=f(a)+error$$ where $0<a<1$ and $a\ne1/2$. What does your technique for deriving the $error$ yield? Like if you said $$F(1)=F(0)+F^{\prime}(0)+\frac12F^{\prime\prime}(0)+\cdots$$ And $$f(a)=f+af^{\prime}+\cdots$$ So that $$\int_0^1f(x)dx-f(a)=F(1)-F(0)-f(a)=f+\frac12f^{\prime}-f-af^{\prime}+\cdots=\left(\frac12-a\right)f^{\prime}+\cdots$$ So you might predict that $$error=\left(\frac12-a\right)f^{\prime}(\xi)$$ for some $0<\xi<1$ but that would be wrong. Can you derive the right formula $$|error|<\left(a^2-a+\frac12\right)\max_{\xi\in[0,1]}\left|f^{\prime}(\xi)\right|$$ So it's kind of tough to get the proof of the error in Simpson's Rule right. I have another proof that uses the Peano kernel but I'm not sure that it's simpler. All these are probably too difficult to put on your test.

EDIT: But I forgot the easy thing you can do if you don't need one of the rigorous but difficult proofs that the error formula is right. Equivalent to the sloppy derivations, just assume that $$\int_0^2f(x)dx-\frac13\left(f(0)+4f(1)+f(2)\right)=Cf^{(4)}(\xi)$$ for some $\xi\in(0,2)$. Then plug in any $4^{th}$ degree polynomial like $$f(x)=x(x-1)^2(x-2)=x^4-4x^3+5x^2-2x$$ To get $$\int_0^2\left(x^4-4x^3+5x^2-2x\right)dx-\frac12(0+0+0)=\frac{32}5-16+\frac{40}3-4=-\frac4{15}=24C$$ So $C=-1/90$. That translates to $$\int_a^bf(x)dx=h\int_0^2f(a+hu)du=\frac h3\left(f(a)+4f(a+h)+f(a+2h)\right)-\frac1{90}h^5f^{(4)}(\xi)$$ For some $\xi\in(a,b)$. So if you assume the form for the solution you can just fill in the blanks. If we had started with the form $Cf^{\prime\prime\prime}(x)$ we would have found $C=0$ because Simpson's rule is exact for cubics. This is about all you could be expected to do on a test.

user5713492
  • 16,333
  • Strange!! why mine method isn't work$?$ it seems to be working. Then how could it fail and give $\left(\frac12-a\right)$ instead of $\left(a^2-a+\frac12\right)?$ I couldn't derive the right formula as my head screwed up with taylor. – falamiw Dec 26 '19 at 07:34
  • Wow, your edited part is so straight forward. But still it need the assumption which maybe a barrier Anyway thanks a lot @user5713492. you made me more confident for my test. – falamiw Dec 26 '19 at 07:37
  • That would take us rather far afield. If you want to see a proof, ask a separate question about the error$$\int_0^1f(x)dx-f(a)$$for $0<|a-1/2|<1/2$. – user5713492 Dec 26 '19 at 07:38
0

The kernel for the error of the Simpson rule in one segment $[0,2]$ is $\newcommand{\one}{{1\!\!1}}$ $$ k_0(s)=\one_{[0,2]}(x)-\frac13(δ_0(x)+4δ_1(x)+δ_2(x)) $$ This can be integrated using the zero boundary condition from the left, $k_{i+1}(x)=\int_0^xk_i(s)ds$. \begin{align} k_1(x)&=\one_{[0,2]}(x)\cdot x -\frac13(u(x)+4u(x-1)+u(x-2)) \\ &=\one_{[0,2]}(x)⋅(x-1)+\tfrac23\one_{[0,1]}(x)-\tfrac23\one_{[1,2]}(x) \\ k_2(x)&=\tfrac12\one_{[0,2]}(x)⋅\left[(x-1)^2+\tfrac13\right]+\tfrac23\one_{[0,1]}(x)⋅(x-1)-\tfrac23\one_{[1,2]}(x)⋅(x-1) \\[.5em] k_3(x)&=\tfrac16\one_{[0,2]}(x)⋅\left[(x-1)^3+(x-1)\right]+\tfrac13\one_{[0,1]}(x)⋅(x-1)^2-\tfrac13\one_{[1,2]}(x)⋅(x-1)^2 \\[.5em] k_4(x)&=\tfrac1{24}\one_{[0,2]}(x)⋅\left[(x-1)^4+2(x-1)^2-\tfrac13\right]+\tfrac19\one_{[0,1]}(x)⋅(x-1)^3-\tfrac19\one_{[1,2]}(x)⋅(x-1)^3 \\[.5em] k_5(x)&=\tfrac1{120}\one_{[0,2]}(x)⋅\left[(x-1)^5+\tfrac{10}3(x-1)^3-\tfrac53(x-1)\right]+\tfrac1{36}\one_{[0,1]}(x)⋅(x-1)^4-\tfrac1{36}\one_{[1,2]}(x)⋅(x-1)^4 \\[.5em] \end{align} While in $k_3$ the values at the boundary are zero directly as a result of the symmetric construction of the integral function, the same symmetric construction leads to values of $\pm\frac1{180}$ of opposing signs in $k_5$, so that this can not be repaired via an integration constant.

In consequence one gets \begin{align} \int_{a}^{a+2h}f(x)\,dx-\frac{h}3(f(a)+4f(a+h)+f(a+2h)) &=h\int_0^2 f(a+sh)k_0(s)\,ds \\ &=h^5\int_0^2f^{(4)}(a+sh)k_4(s)\,ds \\ &=h^4\int_a^{a+2h}f^{(4)}(x)k_4\left(\frac{x-a}h\right)\,dx \end{align} $k_4$ is non-negative over the interval $[0,2]$. Now think of $k_4$ as periodically continued, then the error of the composite method is, applying the weighted mean value theorem, \begin{align} h^4\int_{x_0}^{x_{2n}}f^{(4)}(x)k_4\left(\frac{x-x_0}h\right)\,dx &= h^4f^{(4)}(ξ)\int_{x_0}^{x_{2n}}k_4\left(\frac{x-x_0}h\right)\,dx \\&= h^4f^{(4)}(ξ)\,(nh\,[k_5(2)-k_5(0)]) =-\frac{h^4(b-a)}{180}f^{(4)}(ξ) \end{align}

Lutz Lehmann
  • 131,652
  • 1
    I think this answer is more complicated than your past answers to this and similar questions. I much prefer your use of the generalized mean value theorem. That approach also works very well in the class room. Personally, I cannot count on computer science students to be familiar with the Dirac's delta function. That said, I am happy to see another approach. – Carl Christian Dec 27 '19 at 17:52