I really need help on a question of using the method of undetermined coeffcients to determine some weights and then integrating it to approximate an integral. So it goes as follows:
- We would like to approximate integrals of the form$$I(f) = \int_{-2}^{3}f(x)dx$$
for the sample points $x_{0} = −2$, $x_{1} = 0$ and $x_{2} = +2$. In other words, we seek weights $w_{0}$,$w_{1}$,$w_{2}$ such that
$$I(f) \approx w_{0}f(-2)+w_{1}f(0)+w_{2}f(2)$$
So I am asked to find the weights via the method of undetermined coefficients for a quadrature rule with precision at least two.
I am totally stuck at this point and really need some advice.
Could someone please assist me with this ?
Thank you
IIRC, to fit $I(f) = \int_{-2}^{3}f(x)dx $ by $I(f) \approx w_{0}f(-2)+w_{1}f(0)+w_{2}f(2) $, put $1, x, x^2$ for $f$ and find the $w_i$ that makes it match.
When $f(x) = 1$, $I(f) = \int_{-2}^{3}f(x)dx = \int_{-2}^{3} 1\,dx =5 $. So this gives $I(f) =5 = w_{0}+w_{1}+w_{2} $.
When $f(x) = x$, $I(f) = \int_{-2}^{3}f(x)dx = \int_{-2}^{3} x,dx =\frac{x^2}{2}|_{-2}^3 =\frac{3^2-(-2)^2}{2} =\frac52 $. This gives $I(f) =\frac52 =w_{0}f(-2)+w_{1}f(0)+w_{2}f(2) = (-2)w_{0}+(0)w_{1}+(2)w_{2} = -2w_{0}+2w_{2} $.
When $f(x) = x^2$, $I(f) = \int_{-2}^{3}f(x)dx = \int_{-2}^{3} x^2,dx =\frac{x^3}{3}|_{-2}^3 =\frac{3^3-(-2)^3}{2} =\frac{35}{2} $. This gives $I(f) =\frac{35}{2} =w_{0}f(-2)+w_{1}f(0)+w_{2}f(2) = (-2)^2w_{0}+(0)^2w_{1}+(2)^2w_{2} = 4w_{0}+4w_{2} $.
These are the three equations in the $w_i$.
Solve them.
By sure to check the result.