1
$\begingroup$

I want to use two point gaussian quadrature to approximate $$\int_0^1(1-x)f(x)\text{ dx}$$

Because $(1−x)$ is a linear polynomial, polynomials $f$ of degree at most $2n−2=2$ (because we use two point gaussian quadrature $n=2$) can be accurately integrated. So, I would deal with a polynomial $p(x)=a_0+a_1x+a_2x^2$.

Integration yields $$\int_{-1}^1p(x)(1−x) dx=a_0(2)+a_1\left(−\frac{2}{3}\right)+a_2\left(\frac{2}{3}\right)$$ However, the quadrature is of the form $$\int_{-1}^1p(x)(1−x)\text{ dx}≈c_1p(x_1)+c_2p(x_2)$$ So, we have four variables but only three equations. What am I doing wrong here?

$\endgroup$

1 Answer 1

1
$\begingroup$

The Gauss-Legendre-quadrature is exact for polynomials upto degree 2n-1, if n is the number of points. So, with two points, the formula is exact upto degree 3. The reason is, that

$$\int_{-1}^1 x^n dx = 0$$

for odd n. So you only need the constant term and the quadratic term, so two points are enough.

Concrete, you have four equations :

$$c_1+c_2 = 2$$ $$c_1x_1+c_2x_2 = 0$$ $$c_1x_1^2+c_2x_2^2 = \frac{2}{3}$$ $$c_1x_1^3+c_2x_2^3 = 0$$

We multiply the second equation with $x_1^2$ and subtract the fourth to get

$$c_2x_2(x_1^2-x_2^2) = 0$$

This means $x_1=-x_2$ because the abscisses must be different ($x_2=0$ would lead to equal abscisses).

Inserting this in the second equation we get

$$-c_1x_2+c_2x_2 = 0$$

So it follows

$$c_1=c_2=1$$

with the first equation.

Finally, inserting this in the third equation, gives $x_1^3=\frac{1}{3}$. So $x_1=-x_2=\sqrt{\frac{1}{3}}$

Note that this solution only holds for the weighting function w(x) = 1. For other weighting functions, we need gauss-quadrature. There are formulas for the weights and the abscisses in the general case.

$\endgroup$
8
  • $\begingroup$ I didn't think about that, but that might be the solution. So, you say, I should consider a polynomial of the form $$p(x)=a_0+a_2x^2$$ Thus, I should integrate $$\int_{-1}^1p(x)(1-x)=2a_0+\frac{2}{3}a_2$$ Gauß-Legendre-quadrature is of the form $$c_1p(x_1)+c_2p(x_2)=a_0(c_1+c_2)+a_2(c_1x_1^2+c_2x_2^2)$$ So, we've got four variables $(c_1,c_2,x_1,x_2)$, but only two equations $(c_1+c_2=2\wedge c_1x_1^2+c_2x_2^2=\frac{2}{3})$. What am I doing wrong? $\endgroup$
    – 0xbadf00d
    Commented Jan 28, 2014 at 9:36
  • $\begingroup$ Is my answer useful nevertheless, or shall I delete it ? $\endgroup$
    – Peter
    Commented Jan 28, 2014 at 17:52
  • $\begingroup$ So, what does that mean exactly? I've integrated $$\int_{-1}^1p(x)(1-x)\text{ dx}=2a_0-\frac{2}{3}a_1+\frac{2}{3}a_2-\frac{2}{5}a_3$$ Then, I got four equations form $$p(x_1 )+c_2 p(x_2 )=a_0 (c_1+c_2 )+a_1 (c_1 x_1+c_2 x_2 )+a_2 (c_1 x_1^2+c_2 x_2^2 )+a_3 (c_1 x_1^3+c_2 x_2^3 )$$ The equations are: $$(1)\;c_1+c_2=2\;,\;\;\;(2)\;c_1x_1+c_2x_2=-\frac{2}{3}\;,\;\;\;(3)\;c_1x_1^2+c_2x_2^2=\frac{2}{3}\;,\;\;\;(4)\;c_1x_1^3+c_2x_2^3=-\frac{2}{5}$$ However, this is not that easy to solve as the equation system above. $\endgroup$
    – 0xbadf00d
    Commented Jan 28, 2014 at 17:55
  • $\begingroup$ Your answer is still useful, but you should mention that you are referring to the Gauss-Quadrature with weighting function $w(x)\equiv 1$. I'm sure I do anything wrong. One should be able to find a solution for that exercise without numerically solving an equation system. $\endgroup$
    – 0xbadf00d
    Commented Jan 28, 2014 at 17:57
  • $\begingroup$ There are formulas for the weights and the abscisses. Simply google under gauss-quadrature. $\endgroup$
    – Peter
    Commented Jan 28, 2014 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .