[Math] Integrating a Lagrange polynomial through four points- the easy way

calculuseuler-lagrange-equationintegrationlagrange-interpolationnumerical methods

I'm trying to take the Lagrange polynomial $P_3(x)$ that passes through four points- $(x_1,y_1), (x_2,y_2), (x_3,y_3)$, and $(x_4,y_4)$, and integrate it (maybe deriving Simpson's rule in the process!).
All the x-values are a distance h apart from each other.
Once I did some simplifications using h, here's what I ended up with:
$$P_3(x) = {(x-x_2)(x-x_3)(x-x_4)y_1\over -6h^3} + {(x-x_1)(x-x_3)(x-x_4)y_2\over 2h^3} + {(x-x_1)(x-x_2)(x-x_4)y_3\over -2h^3} + {(x-x_1)(x-x_2)(x-x_3)y_4\over 6h^3}$$
I'm trying to find a substitution to make these integrals easier. When I choose a u-substitution, should I try to make the integrands go from -1 to 1? And how would I scale the u-substitution to make that happen?
Throw out the next step that you think I should take!
Thanks!

Best Answer

While Acheille Hui has outlined a good strategy I would like to continue with your approach.

First of all, I can confirm that your polynomial passes through the four given values, hence you have the correct expression.

You can always change the interval of integration from, say, $[a,b]$ to $[-1,1]$ by a linear transformation, specifically \begin{equation} x = \phi(t) = a \frac{1-x}{2} + b \frac{1+x}{2}, \end{equation} where I have chosen the peculiar representation to stress the fact that \begin{equation} \phi(-1) = a, \quad \phi(1) = b \end{equation} We also see that \begin{equation} \phi'(t) = \frac{b-a}{2}. \end{equation} It follows that for any continuous function $f : [a,b] \rightarrow \mathbb{R}$ we can write \begin{equation} \int_a^b f(x)dx = \int_{-1}^1 f(\phi(t)) \phi'(t) dt \end{equation}

In your case we could write \begin{equation} x_1 = a, \quad x_2 = a + h, \quad x_3 = a + 2h, \quad x_4 = a + 3h = b \end{equation} so that \begin{equation} \phi(t) = a \frac{1-x}{2} + (a+3h) \frac{1+x}{2} = a + 3h \frac{1+x}{2} \end{equation} and \begin{equation} \phi(-1) = x_1, \quad \phi\left(-\frac{1}{3}\right) = x_2, \quad \phi\left(\frac{1}{3}\right) = x_2, \quad \phi\left(1\right) = x_3 \end{equation} The substitution will allow you to move your integral to the interval $[-1,1]$. At this point, I would recommend reducing the polynomials to standard form by carrying all the multiplications.

You mention Simpson's rule. It is difficult to apply it in this context, because the number of natural sub-intervals is an odd number (specifically 3), rather than an even number. The simplest way that I know to rediscover Simpson's rule is to seek numbers $a$, $b$, and $c$ such the quadrature rule \begin{equation} \int_{-h}^h f(x) dx = a f(-h) + b f(0) + c f(h) \end{equation} is exact for all polynomials of degree less than or equal to $2$. By using \begin{equation} f(x) = 1, \quad f(x) = x, \quad \text{and}\quad f(x) = 2 \end{equation} you will assemble a linear system of dimension $3$ for the unknowns $a$, $b$ and $c$. Once you have solved it you will be able to verify that your new quadrature rule also integrates $f(x) = x^3$ correctly.

Related Question