0

Using Newton-Cotes formula:

$$ \int_{a}^{b} f(x) d x \approx \int_{a}^{b} p(x) d x=\sum_{i=0}^{n} f\left(x_{i}\right) \int_{a}^{b} \ell_{i}(x) d x $$

I want show that:

$$ \int_{0}^{1} f(x) d x \approx \frac{1}{6} f(0)+\frac{2}{3} f\left(\frac{1}{2}\right)+\frac{1}{6} f(1) $$

I have that $n=1$ and $[a,b]=[0,1]$. First the $\ell_i$ are constructed as follows:

$$ \ell_{0}(x)=2\left(x-\frac{1}{2}\right)(x-1) \quad \ell_{1}(x)=-4 x(x-1) \quad \ell_{2}(x)=2 x\left(x-\frac{1}{2}\right) $$

My question is: how are these $\ell_i$ constructed? It is clear that with this choice se of $\ell_i$ I will get the desired. But I'm not sure how one would construct them. This is from an example in my book.

Sorry
  • 1,028

1 Answers1

0

The $\ell_i$ are defined by the property that they have degree $n$ and satisfy $\ell_i(x_j)=0$ for $j \neq i$ and $\ell_i(x_i)=1$, where $x_i$ are the nodes. Such polynomials are called the Lagrange basis.

A more transparent way to introduce them would be to define $l_i(x)=\prod_{j \neq i} (x-x_j)$ and then set $\ell_i(x)=\frac{l_i(x)}{l_i(x_i)}$.

Ian
  • 101,645