Some of you might be interested in the following notebook, which shows how to construct optimal Gaussian quadrature schemes for arbitrary weight functions constructed from interpolated data:

using a recently added feature of the QuadGK.jl package.

The example in this notebook is on constructing quadrature rules

for a weight function S(λ) given by the solar irradiance spectrum, an extremely oscillatory weight derived from tabulated measurements. By constructing a Gaussian quadrature rule where S(λ) is “built in”, one can compute the integral for smooth f(λ) using very few points, which is very useful for solar-cell modeling where f(λ) is computed by solving Maxwell’s equations.

The notebook includes a general function `gaussquad_interpolant`

that you can use to construct quadrature rules for any tabulated data.