# Numerical quadrature in Discontinuous Galerkin

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.

• 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. – 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.
• 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? – cbcoutinho Jan 20 '17 at 22:44
• @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. – GoHokies Jan 20 '17 at 22:50