0
$\begingroup$

Can someone please let me know if I am on the right track here. Obviously, I still need to perform the integrations as well as evaluate the integrations(from 0 to 1) to determine the coefficients. What I gather from my notes, and the text book, this is the procedure for equally spaced nodes but I'm not sure as there are several methods (trap. rule, Simpson's rule, composite trap. rule, etc. Any advice would be greatly appreciated!!

$\int^1_0 p_3(x)dx = f(a) \int^1_0\frac{(x-\frac13)(x-\frac23)(x-1)}{(0-\frac13)(0-\frac23)(0-1)}dx + f(b)\int^1_0\frac{(x)(x-\frac23)(x-1)}{(\frac13-0)(\frac13-\frac23)(\frac13-1)} + f(c)\int^1_0\frac{(x)(x-\frac13)(x-1)}{(\frac23-0)(\frac23-\frac13)(\frac23-1)} + f(d)\int^1_0\frac{(x)(x-\frac13)(x-\frac23)}{(1-0)(1-\frac13)(1-\frac23)}$

$\endgroup$
0
$\begingroup$

You can crunch those integrals, or you can reason that the approximation must be exact for $f = 1, x, x^2, x^3$ and get a linear system for the weights: Write the approximation as $$\int_{0}^{1}p_3(x)\,dx = \sum_{i = 1}^{4}w_if(x_i)$$ where $x_1 = 0$, $x_2 = 1/3$, $x_3 = 2/3$, $x_4 = 1$ and the $w_i$ are to be determined. The approximation must be exact for $f = 1, x, x^2, x^3$, so that gives the system of equations $$ \begin{bmatrix} 1 & 1 & 1 & 1 \\ x_1 & x_2 & x_3 & x_4 \\ x_1^2 & x_2^2 & x_3^2 & x_4^2 \\ x_1^3 & x_2^3 & x_3^3 & x_4^3 \\ \end{bmatrix} \begin{bmatrix} w_1 \\ w_2 \\ w_3 \\ w_4 \\ \end{bmatrix} = \begin{bmatrix} 1 \\ 1/2 \\ 1/3 \\ 1/4 \\ \end{bmatrix} $$ which you can solve to find the $w_i$. Both your approach and this approach can generate the weights for any choice of distinct nodes; there is nothing special about equally spaced nodes.

Edit on why it should be exact on $1, x, x^2, x^3$:

The integration method is based on calculating the interpolation polynomial $p_3(x)$ and integrating it. When you interpolate $4$ points from a function $f$ that is a polynomial of degree $3$ or less, the interpolation polynomial $p_3$ matches $f$ identically (by uniqueness of the interpolating polynomial).

One way to see why exactness makes the approximation good is to consider the approximation on a small interval $[-h, h]$: $$\int_{-h}^{h}f(x)\,dx \approx 2h\sum_{i = 1}^{N}w_if(x_ih).$$ Define the error in the approximation for a function $f$ as $$E(f) := \int_{-h}^{h}f(x)\,dx - 2h\sum_{i = 1}^{N}w_if(x_ih)$$ Note that $E$ is a linear map. Writing $f$ as a Taylor series around $0$ gives \begin{align} E(f) &= E\left(\sum_{n = 0}^{\infty}\frac{f^{(n)}(0)}{n!}x^n\right) \\ &= \sum_{n = 0}^{\infty}\frac{f^{(n)}(0)}{n!}E(x^n) \end{align} You can verify that $E(x^n) = O(h^{n + 1})$. Hence if $k$ is the smallest integer for which $E(x^k) \neq 0$, then the error is $$E(f) = \frac{f^{(k)}(0)}{k!}E(x^k) + O(h^{k + 2}) = O(h^{k + 1}).$$ So exactness on polynomials increases the accuracy of the approximation on all (smooth enough) functions.

$\endgroup$
3
  • $\begingroup$ Ok, I get ya. Can you explain why they must be exact. I asked my instructor to explain how we know an equation is exact and he told me to read the section that I've read 20 times:) $\endgroup$ – user551155 Dec 4 '20 at 22:54
  • 1
    $\begingroup$ @user551155 I added explanation on why it is exact. The main reason is that the interpolation polynomial is of degree 3, so it matches all 3rd degree and lower polynomials exactly. $\endgroup$ – Mason Dec 4 '20 at 23:48
  • $\begingroup$ This is excellent! Thanks so much "Mason";) $\endgroup$ – user551155 Dec 5 '20 at 15:48

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.