Integrate the integrand function in Legendre basis, and represent the integral again in the Legendre basis up to the maximal degree.
The maximal degree needs to be one higher than the maximal degree of the integrand in order to fully represent the integral, otherwise the result is truncated and only an approximation up to maxdegree is obtained.
The integral needs to have a length of maxdegree+1. maxdegree needs to be non-negative. Thus, integral needs to be an array with a length of at least 1!
Implemented property of Legendre Polynomials: L_i(x) = 1/(2*i + 1) * d/dx [ L_{i+1}(x) - L_{i-1}(x) ]
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rk), | intent(in) | :: | integrand(:) |
Coefficients of the function to integrate in Legendre basis. |
||
integer, | intent(in) | :: | maxdegree |
Maximal polynomial degree for the integral, should be larger than the degree of the integrand |
Legendre coefficients of the resulting integral.