Evaluating Gauss-Turán quadrature rules

GaussTuranQuadrature contains precomputed quadrature rules, which can be used as follows.

using GaussTuranQuadrature

n = 3
s = 2

I = GaussTuranRule(n, s)
Gauss-Turán quadrature rule on the interval (0.0, 1.0), with 3 nodes and derivatives up to order 4.
* Nodes:
3-element Vector{Float64}:
 0.08538363096536741
 0.5
 0.9146163690346326
* Weights:
3×5 Matrix{Float64}:
 0.262094   0.010066    0.000698211   1.26942e-5   2.28965e-7
 0.475811  -1.6484e-21  0.00356149   -7.00632e-24  4.57744e-6
 0.262094  -0.010066    0.000698211  -1.26942e-5   2.28965e-7
# Define a function with cheap computation of the derivatives
function f(x)
    val = sin(x)
    der = sqrt(1 - val^2) # cos
    (val, der, -val, -der, val)
end

evaluation = I(f)
error = abs(evaluation - (1 - cos(1)))
5.551115123125783e-17

Other finite domains $(a,b)$ can also be used.

I = GaussTuranRule(n, s; domain = (0, π/2))
I(f)
0.9999999999999999