Newton-Cotes method

274 Views Asked by At

I have the following equation: $$\int_{a}^{b}f(x)dx = h\sum_{k=1}^{N}c_kf(a+kh)+O(h^p)$$, $$h=\frac{b-a}{N+1}$$

Where f is sufficiently differentiable function using N equally points.

For $N=2$, I should get the values $c_1=c_2=\frac{3}{2},p=3$ But I really cannot find this values. I used several sites / youtube videos. But every time this gives the value $c_1=c_2=\frac{1}{2}$

I am given the following hint: set $x=a+y$ and then expand $f(a+y)$ and $f(a+kh)$ as Taylor series in h.

But that doesn't help me. I noticed the difference for h, if I compare it with Wolfram and other sites. $h=\frac{b-a}{N}$

Can anyone help me?, Joe

1

There are 1 best solutions below

2
On BEST ANSWER

The difference you aren't appreciating is that you are being asked to derive an open Newton-Cotes formula. A closed $2$-point formula would be $$\int_0^1f(x)dx\approx c_0f(0)+c_1f(1)$$ And if you worked it out, $$\int_0^1\frac{x-1}{0-1}dx=\left.-\frac12(x-1)^2\right|_0^1=\frac12=c_0$$ $$\int_0^1\frac{x-0}{1-0}dx=\left.\frac12x^2\right|_0^1=\frac12=c_1$$ But an open Newton-Cotes formula omits the functional values at the endpoints. Let's take $N=2$, $a=0$, and $b=3$, so $h=1$. Then $$\int_0^3f(x)dx\approx c_1f(1)+c_2f(2)$$ Note the use of the interior points $x=1$ and $x=2$ and not the endpoints $x=0$ and $x=3$. We can derive $$\int_0^3\frac{x-2}{1-2}dx=\left.-\frac12(x-2)^2\right|_0^3=\frac32=c_1$$ $$\int_0^3\frac{x-1}{2-1}dx=\left.\frac12(x-1)^2\right|_0^3=\frac32=c_2$$ For the error formula we find the error in interpolation $$e(y)=f(y)-p_1(y)-\frac{(y-1)(y-2)}{(x-1)(x-2)}\left(f(x)-p_1(x)\right)$$ Where $$p_1(x)=\frac{x-2}{1-2}f(1)+\frac{x-1}{2-1}f(2)$$ Note: for an odd number of data points the degree of the interpolation polynomial would be increased by $1$ and the middle fact would be squared. For the $N=3$ case this would read $$e(y)=f(y)-p_3(y)-\frac{(y-1)(y-2)^2(y-3)}{(x-1)(x-2)^2(x-3)}\left(f(x)-p_3(x)\right)$$ Where $$p_2(x)=\frac{(x-2)(x-3)}{(1-2)(1-3)}f(1)+\frac{(x-1)(x-3)}{(2-1)(2-3)}f(2)+\frac{(x-1)(x-2)}{(3-1)(3-2)}f(3)$$ Because in that case $$\int_0^4p_3(x)dx=\int_0^4\left\{p_2(x)-(x-1)(x-2)(x-3)\left[f^{\prime}(2)-p_2^{\prime}(2)\right]\right\}dx=\int_0^4p_2(x)dx$$ And the integrand is a cubic polynomial that matches $f(x)$ at all $3$ data points as well as $f^{\prime}(x)$ at the midpoint, so the value of $f^{\prime}(x)$ at the midpoint doesn't contribute to the integral.

Back to the $N=2$ case: $e(1)=e(2)=e(x)=0$ for any $x\in\left(0,3\right)\setminus\left\{1,2\right\}$. Then by $2$ applications of Rolles' theorem, we see that there is some $y(x)\in\left(0,3\right)$ such that $e^{\prime\prime}(y(x))=0$. Solving for $f(x)$, $$f(x)=p_1(x)+\frac{(x-1)(x-2)}2f^{\prime\prime}(y(x))$$ For some $y(x)\in\left(0,3\right)$ for any $x\in\left(0,3\right)$. Well, we didn't yet prove it for $x\in\left\{1,2\right\}$ but it's true by inspection in that case. Then on integration we have $$\int_0^3f(x)dx=\int_0^3p_1(x)dx+\frac12\int_0^3(x-1)(x-2)f^{\prime\prime}(y(x))dx$$ Here the integral of $p_1(x)$ is just $\frac32f(1)+\frac32f(2)$. Now, if $(x-1)(x-2)$ didn't change sign for $x\in\left(0,3\right)$ we could show quickly that $$\int_0^3f(x)dx-\frac32f(1)-\frac32f(2)=\frac12f^{\prime\prime}(\xi)\int_0^3(x-1)(x-2)dx=\frac34f^{\prime\prime}(\xi)$$ For some $\xi\in\left(0,3\right)$. But that is not true, so the best we can do without some kind of inspired theorem is to say that $$\begin{align}\left|\int_0^3f(x)dx-\frac32f(1)-\frac32f(2)\right|&=\left|\frac12\int_0^3(x-1)(x-2)f^{\prime\prime}(y(x))dx\right|\\ &\le\frac12\int_0^3\left|(x-1)(x-2)\right|\left|f^{\prime\prime}(y(x))\right|dx\\ &\le\frac12M\int_0^3\left|(x-1)(x-2)\right|dx=\frac{11}{12}M\end{align}$$ Where $M$ is the absolute maximum value of $\left|f^{\prime\prime}(x)\right|$ for $x\in\left[0,3\right]$.

If $x$ has units of length, then the integral has units of $f$ times units of length while $f^{\prime\prime}(\xi)$ has units of $f$ divided by length squared so the error term scales as $h^3$ and we have $$\left|\int_a^bf(x)dx-h\left(\frac32f(a+h)+\frac32f(a+2h)\right)\right|\le\frac{11}{12}Mh^3$$