Quadrature Formula and Interpolation

55 Views Asked by At

Suppose we want to integrate a function from $x_0$ to $x_0 + 3h$, and we know the value of this function at $x_0$, $x_1 = x_0 + h$, and $x_2 = x_0 + 2h$. Write a quadrature formula to approximate the value of this integral.

So, what I did was interpolate the points with a polynomial P(x) and then calculate $\int _{x_0}^{x_0 + 3h} P(x)dx$ and had: $$\int _{x_0}^{x_0 + 3h} P(x)dx = \int _{x_0}^{x_0 + 3h} \sum_{i=0}^2 {f_i}{l_i}(x) = f(x_0)\frac{3h}{4} + 0 + f(x_2)\frac{9h}{4} = \frac{3h}{4}[f(x_0)+3f(x_2)]$$

Is the process correct? I thought I had to get a Simpson's Rule 1/3 or 3/8.

Is there a way to test if the answer is correct by evaluating some random function? I tried $\int _{0}^{3} sin(x)dx $ and $\frac{3}{4}[sin(0)+3sin(2)]$ but don't know if that's it.

1

There are 1 best solutions below

0
On

One way is to assume that, since you know the value at 3 points, is to assume that $P(x)=a+bx+cx^2$ and evaluate the integral for $f(x)$ as a constant, $f(x)=x$, and $f(x)=x^2$ so that the integral of $P(x)$ matches these results.