0

Determine a quadrature formula

$$Q[f] = w_0f(0) + w_1f(\pi/2) + w_2f(\pi)$$

in order to calculate

$$I[f] = \int_0^\pi f(x) dx.$$

The formula shall integrate every function of the space $G = \operatorname{span} \{1, \sin x, \cos(x/2)\}$ exact.

I know that a quadrature formula with $m$ knots $x_i, i = 1, \ ..., \ m$, is exact up to degree $2m-1$. Since we have $m = 3$ knots, which are $x_1 = 0, x_2 = \pi/2$ and $x_3 = \pi$ in this case, we have at most an accuracy of $5$.

But what to do next? I definitely have to calculate the weights $w_0, w_1$ and $w_2$, but how would I do that?

Plus, does it even matter which kind of base I have to work with? I am not sure what it means that the formula shall be able to integrate every function of $G$ exact.

Borol
  • 491

1 Answers1

2

Asking that the formula gives exact answers for the three functions means that you need to have $I[f]=Q[f]$ for each function in $G$. Because the integral is linear and $G$ is the linear span of three functions $e_1,e_2,e_3$, it suffices to arrange that $I[e_i]=Q[e_i]$ for $i=1,2,3$. This gives you three simultaneous equations for $w_0,w_1,w_2$, which you can solve to obtain the values of $w_0,w_1,w_2$ (providing a solution exists, of course; there also may be more than one solution that works).

Chappers
  • 67,606
  • Thanks for your answer! What would be, for example, $e_1$ in this case? $x^0$? And how would I calculate $w_0$ then? I saw solution that solved the integral for $f(x) = x^0$, is this the right path? – Borol Jun 21 '17 at 15:47
  • ${e_1,e_2,e_3}$ are ${ 1,\sin{x},\cos{(x/2)} }$, the functions given in the span expression. – Chappers Jun 21 '17 at 15:52