4

For single integrals, Gauss-Legendre quadratures approximate the integral, as follows: $$\int_{-1}^1 f(x)\text{ }dx\approx\sum_{j=1}^nw_if(x_i).$$ By choosing the correct $x_i$, this approximation can be made to be exact for polynomials up to degree $2N-1$. There are proofs (for example, at page 15) that show that these $x_i$ are the roots of the $n^{th}$ Legendre polynomial $P_n(x)$. For example, for $n=2$, the correct $x_i$ are $x_1 = -x_2= \frac{1}{\sqrt3}$.

However, suppose that $f(x)$ is an acceleration where $x$ is time, and we want to calculate the distance travelled, so we need the double integral $$\int_{-1}^1 \int_{-1}^{\xi}f(x)\text{ }dx \text{ }d\xi \approx\sum_{j=1}^nw_if(x_i).$$

By hand, I found that for $n=2$, taking $x_1 = -\frac{1}{5}-\frac{\sqrt6}{5}, x_2 = -\frac{1}{5}+\frac{\sqrt6}{5}$ allows me to be exact for polynomials up to degree $3$, but it is clear that these numbers are not the roots of $P_n(x)$ any more.

Is there a way to find $x_i$ for a generic $n$? Otherwise, a citable table with values up to $n \sim 10$ is fine.

Kenny Wong
  • 33,403
Siro
  • 43

2 Answers2

3

Using integration by parts and Gauss-Jacobi quadrature, \begin{align} \int_{-1}^1 \int_{-1}^{\xi}f(t)\mathrm dt \mathrm d\xi &=\left[\xi \int_{-1}^{\xi}f(t)\mathrm dt\right]_{-1}^1 - \int_{-1}^1 \xi f(\xi)\mathrm d\xi\\ &= \int_{-1}^1 (1-\xi)f(\xi)\mathrm d\xi\\ &\approx \sum_{i=1}^{n} w_if(x_i) \end{align}

where $x_i$ are the roots of the Jacobi Polynomials with $\alpha = 1$ and $\beta = 0$.

Kroki
  • 13,619
  • This makes sense in theory and i evaluated it numerically for polynomials of degree up to 10 (just to be sure that I understood it correctly) and worked perfectly. Thanks! – Siro May 19 '23 at 10:13
0

Are you sure you don't mean to approximate the integral $$ \int_{-1}^1 \int_{-1}^{\xi} f(x,\xi) dx\, d\xi \quad? $$

The one you propose trivially reduces to a 1d integral just by changing the integration order: $$ \int_{-1}^1 \int_{-1}^{\xi} f(x) dx\, d\xi= \int_{-1}^1 \int_x^1f(x) d\xi dx =\int_{-1}^1 (1-x) f(x) dx $$

that would be approximated, using gauss-legendre, as $$ (1-1/\sqrt{3}))f(-1/\sqrt{3})+(1+1/\sqrt{3})f(1/\sqrt{3}) $$

PierreCarre
  • 23,092
  • 1
  • 20
  • 36