1

The integration formula is to have the general form $$\int_a^b f(x)\text{ }dx\approx\sum_{j=1}^nw_if(x_i).$$

Let $a=-1,b=1$.

When $n=1$:

The integration formula has the form $$\int_{-1}^1f(x)\text{ }dx \approx w_1f(x_1).$$

Using $f(x)\equiv 1$ and forcing the inequality to equality gives us $$w_1=2.$$

Using $f(x)=x$ and again forcing the inequality to equality gives us $$w_1x_1=0.$$ Thus we have that $w_1=2, x_1=0$. Therefore, the formula becomes $$\int_{-1}^1f(x)\text{ }dx \approx 2\cdot f(0).$$


My question is:

  • I know that we need 2 equations to solve 2 unknown variables $w_1$ and $x_1$ but why are we using $f(x)\equiv 1$ and then $f(x)=x$, and force equality in the formula? Why does this approach work?

Edited:

I found another source about Gaussian Quadrature:

Suppose we want to determine $w_1,w_2,x_1$ and $x_2$ so that the integration formula $$\int_{-1}^1 f(x)\text{ }dx\approx w_1f(x_1)+w_2f(x_2)$$ gives the exact result whenever $f(x)$ is a polynomial of degree 3 or less, that is, when $$f(x)=a_0+a_1x+a_2x^2+a_3x^3,$$ for some collection of constants, $a_0,a_1,a_2$, and $a_3$. Because $$\int(a_0+a_1x+a_2x^2+a_3x^3)\text{ }dx = a_0\int1\text{ }dx+a_1\int x\text{ }dx+a_2\int x^2\text{ }dx+a_3\int x^3\text{ }dx,$$ this is equivalent to showing that the formula gives exact results when $f(x)$ is $1, x, x^2,x^3$. Hence we need $w_1,w_2,x_1$ and $x_2$, so that $$w_1\cdot1+w_2\cdot1=\int_{-1}^1 1\text{ }dx$$ $$w_1\cdot x_1+w_2\cdot x_2=\int_{-1}^1 x\text{ }dx$$ $$w_1\cdot {x_1}^2+w_2\cdot {x_2}^2=\int_{-1}^1 x^2\text{ }dx$$ $$w_1\cdot {x_1}^3+w_2\cdot {x_2}^3=\int_{-1}^1 x^3\text{ }dx$$


I am confused when it says "this is equivalent to showing that the formula gives exact results when $f(x)$ is $1, x, x^2,x^3$" above.

Schole
  • 33

3 Answers3

1

Polynomials are in many senses the building blocks of functions and so numerical integration is evaluated (among other aspects) in terms of how well it performs for polynomials. A quadrature rule that is exact for polynomials of degree $\leq 5$ is considered better than another rule that is only exact for polynomials of degree $\leq 2$. In the case you present, you are computing the constants that allow for the highest possible degree.

PierreCarre
  • 20,974
  • 1
  • 18
  • 34
  • Thank you, I understand what you said, but I just don't know why it uses $f(x)=1$ and $f(x)=x$ and then solves $w_1$ and $x_1$, and why this approach works. – Schole Apr 18 '19 at 15:24
  • @Schole The rule is linear with respect to the function $f$. When you "force" the rule to be exact for $f(x)=1$ and $f(x)=x$, it will automatically be exact for any polynomial of degreee 1. – PierreCarre Apr 18 '19 at 21:49
1

If you choose polynomials you get standard Gaussian quadrature. But you can just as well use any other set of functions to fix the weights and nodes. The better the function you want to integrate can be approximated as a linear combination of the set of function you choose to determine the nodes and weights, the better the results will be.

Count Iblis
  • 10,366
  • Yes, I understand what you said, I just don't know why we are using this approach to obtain the polynomials. By "this approach" I mean using $f(x)=1$ and $f(x)=x$ and then solve for $w_1$ and $x_1$. – Schole Apr 18 '19 at 15:21
0

Suppose we want to determine $w_1,w_2,x_1$ and $x_2$ so that the integration formula $$\int_{-1}^1 f(x)\text{ }dx\approx w_1f(x_1)+w_2f(x_2)$$ gives the exact result whenever $f(x)$ is a polynomial of degree 3 or less, that is, when $$f(x)=a_0+a_1x+a_2x^2+a_3x^3,$$ for some collection of constants, $a_0,a_1,a_2$, and $a_3$. Because $$\int(a_0+a_1x+a_2x^2+a_3x^3)\text{ }dx = a_0\int1\text{ }dx+a_1\int x\text{ }dx+a_2\int x^2\text{ }dx+a_3\int x^3\text{ }dx,$$ this is equivalent to showing that the formula gives exact results when $f(x)$ is $1, x, x^2,x^3$.

This is because: Since $f(x)=a_0+a_1x+a_2x^2+a_3x^3$, we have that $$w_1f(x_1)+w_2f(x_1)\\=w_1(a_0+a_1x_1+a_2{x_1}^2+a_3{x_1}^3+w_2(a_0+a_1x_2+a_2{x_2}^2+a_3{x_2}^3)\\ =a_0(w_1+w_2)+a_1(w_1x_1+w_2x_2)+a_2(w_1{x_1}^2+w_2{x_2}^2)+a_3(w_1{x_1}^3+w_2{x_2}^3)\\=a_0\int1\text{ }dx+a_1\int x\text{ }dx+a_2\int x^2\text{ }dx+a_3\int x^3\text{ }dx$$

Hence we need $w_1,w_2,x_1$ and $x_2$, so that $$w_1\cdot1+w_2\cdot1=\int_{-1}^1 1\text{ }dx$$ $$w_1\cdot x_1+w_2\cdot x_2=\int_{-1}^1 x\text{ }dx$$ $$w_1\cdot {x_1}^2+w_2\cdot {x_2}^2=\int_{-1}^1 x^2\text{ }dx$$ $$w_1\cdot {x_1}^3+w_2\cdot {x_2}^3=\int_{-1}^1 x^3\text{ }dx$$

Schole
  • 33