I would like to know which is the best way to integrate numerically Legendre polynomials. I am building up a Discontinuous Galerkin CFD code for which Legendre polynomials are used as basis functions in the spectral projection.

In previous codes, I was used to employ Gauss-Legendre numerical quadrature, where only $k$ points allowed to obtain the exact integral of a polynomial of degree $2k−1$. Now, as such quadrature points are the roots of Legendre polynomials, I need use $k+1$ points to integrate the $k$-th Legendre polynomial (otherwise the polynomials are evaluated at their roots and all higher order ingegrals are zero). Is there any other efficient way to do it?

Thank you very much for your help.

  • 2
    $\begingroup$ If I remember correctly, assembling the elemental matrices for a Galerkin method requires integrating a function where two polynomials are multiplied together. Thus, for a 1D element, f(x) = N_i(x) * N_j(x). Assuming N_i and N_j are 2nd order polynomials, f(x) is a 4th order polynomial, so you need to use (4*2)-1 = 7 points to integrate the function exactly. I don't think you'll run into the problem you think you'll run into. $\endgroup$ – cbcoutinho Jan 20 '17 at 15:11

Which basis you use for your finite element space does not matter for quadrature in general. If you use, for example, polynomials of degree $k$ (whether the Lagrange basis, or the Legendre basis, or monomials, or anything else) then the integrand of the mass matrix has polynomial degree $2k$, and you need a Gauss quadrature with $k+1$ points to integrate that correctly. That is because such Gauss quadratures can integrate any polynomial of degree $2k+1$ exactly, regardless of how you actually represent that polynomial in terms of bases.

  • $\begingroup$ I thought you needed to have $2k+1$ points where $k$ is the polynomial degree of the combined integrand, which using degree $k$ polynomials would be $k^2$, so you would actually need $2(k^2) + 1$ points to accurately integrate the function - correct? $\endgroup$ – cbcoutinho Jan 20 '17 at 22:44
  • 1
    $\begingroup$ @cbcoutinho if the polynomials have degree $k$, then the mass matrix integrand has degree $k + k = 2k$, not $k^2$. And $k$ Gauss quadradure points are sufficient to integrate polynomials of degree $2k-1$ exactly, as explained here. $\endgroup$ – GoHokies Jan 20 '17 at 22:50
  • $\begingroup$ @GoHokies, you're totally right - I mixed up my exponent rules. Thanks for correcting my mistake $\endgroup$ – cbcoutinho Jan 20 '17 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.