APPROXIMATINGINTEGRALS
The following functions apply an existing set of abscissas and weights to compute an approximation to an
integral.
doublesummer(doublefunc(doublex),intorder,doublextab[],doubleweight[])
Carries out a quadrature rule over a single interval.
doublesum_sub(doublefunc(doublex),doublea,doubleb,intnsub,intorder,doublexlo,doublexhi,doublextab[],doubleweight[])
Carries out a composite quadrature rule.
xlo and xhi are the left and right endpoints of the interval over which the quadrature rule was
defined.
a and b are the lower and upper limits of integration.
nsub is the number of equal subintervals into which the finite interval (a,b) is to be subdivided
for higher accuracy. nsub must be at least 1.
doublebdf_sum(doublefunc(doublex),intorder,doublextab[],doubleweight[])
Carries out explicit backward difference quadrature on [0,1]. Requires xtab and weight to be pre‐
computed from bdfc_set or bdfp_set.
doublelaguerre_sum(doublefunc(doublex),doublea,intorder,doublextab[],doubleweight[])
Carries out Laguerre quadrature over [ A, +oo ). Requires xtab and weight to be pre‐computed from
laguerre_compute, gen_laguerre_compute, or laguerre_set.
voidsummer_gk(doublefunc(doublex),intorderg,doubleweightg[],double*resultg,intorderk,doublextabk[],doubleweightk[],double*resultk)
Carries out Gauss‐Kronrod quadrature over a single interval. Before calling this function,
weightg should be pre‐computed from legendre_compute_dr or legendre_set. Also, xtabk and weightk
should be pre‐computed from kronrod_set. The orders should follow the relation orderk = 2 *
orderg + 1. resultk will contain the result of the Gauss‐Kronrod sum. resultg contains an
intermediate sum, using only the Gauss quadrature.
voidsum_sub_gk(doublefunc(doublex),doublea,doubleb,intnsub,intorderg,doubleweightg[],double*resultg,intorderk,doublextabk[],doubleweightk[],double*resultk,double*error)
Carries out a composite Gauss‐Kronrod rule. Approximates the integral of func from a to b, by
dividing the domain into nsub subdomains, and applying a Gauss‐Kronrod rule on each subdomain.
The following are utility function(s), to modify existing weights / abscissas before computing an
integral.
voidrule_adjust(doublea,doubleb,doublec,doubled,intorder,doublextab[],doubleweight[])
Maps a quadrature rule from [A,B] to [C,D]. xtab and weight are overwritten.
COMPUTINGQUADRATUREABSCISSAS/WEIGHTS
The following functions compute arrays of abscissas and weights (xtab, weight) for a particular
quadrature rule, for any given order. The range of the abscissas is ( -1 <= x < 1 ) unless otherwise
given.
NOTE: xtab and weight must be allocated before calling these functions.
voidchebyshev1_compute(intorder,doublextab[],doubleweight[])
Computes a Gauss‐Chebyshev type 1 quadrature rule.
voidchebyshev2_compute(intorder,doublextab[],doubleweight[])
Computes a Gauss‐Chebyshev type 2 quadrature rule.
voidchebyshev3_compute(intorder,doublextab[],doubleweight[])
Computes a Gauss‐Chebyshev type 3 quadrature rule.
voidclenshaw_curtis_compute(intorder,doublextab[],doubleweight[])
Computes a Clenshaw Curtis quadrature rule.
voidfejer1_compute(intorder,doublextab[],doubleweight[])
Computes a Fejer type 1 quadrature rule.
voidfejer2_compute(intorder,doublextab[],doubleweight[])
Computes a Fejer type 2 quadrature rule.
voidgegenbauer_compute(intorder,doublealpha,doublextab[],doubleweight[])
Computes a Gauss‐Gegenbauer quadrature rule.
voidgen_hermite_compute(intorder,doublealpha,doublextab[],doubleweight[])
Computes a generalized Gauss‐Hermite rule for the interval ( -infinity < x < +infinity )
voidgen_laguerre_compute(intorder,doublealpha,doublextab[],doubleweight[])
Computes a generalized Gauss‐Laguerre quadrature rule for the interval ( alpha <= x < infinity )
voidhermite_ek_compute(intorder,doublextab[],doubleweight[])
Computes a Gauss‐Hermite quadrature rule, using an algorithm by Elhay and Kautsky. Interval is (
-infinity < x < infinity )
voidhermite_ss_compute(intorder,doublextab[],doubleweight[])
Computes a Gauss‐Hermite quadrature rule, using an algorithm by Arthur Stroud and Don Secrest.
Interval is ( -infinity < x < infinity )
voidjacobi_compute(intorder,doublealpha,doublebeta,doublextab[],doubleweight[])
Computes a Gauss‐Jacobi quadrature rule.
voidlaguerre_compute(intorder,doublextab[],doubleweight[])
Computes a Gauss‐Laguerre quadrature rule for the inverval ( 0 <= x < infinity )
voidlegendre_compute_dr(intorder,doublextab[],doubleweight[])
Gauss‐Legendre quadrature by Davis‐Rabinowitz method.
voidlobatto_compute(intorder,doublextab[],doubleweight[])
Computes a Lobatto quadrature rule.
voidnc_compute(intorder,doublex_min,doublex_max,doublextab[],doubleweight[])
Computes a Newton‐Cotes quadrature rule.
( x_min <= x <= x_max )
voidncc_compute(intorder,doublextab[],doubleweight[])
Computes a Newton‐Cotes Closed quadrature rule.
voidnco_compute(intorder,doublextab[],doubleweight[])
Computes a Newton‐Cotes Open quadrature rule.
voidncoh_compute(intorder,doublextab[],doubleweight[])
Computes a Newton‐Cotes "open half" quadrature rule.
( x_min <= x <= x_max )
voidradau_compute(intorder,doublextab[],doubleweight[])
Computes a Radau quadrature rule.
PRE‐COMPUTEDQUADRATURES
The following functions return abscissas/weights for various quadrature rules, but only for particular
orders.
NOTE: Check the valid range of order parameters for the particular function before using it. Using an
unsupported order will cause an abort.
voidbashforth_set(intorder,doublextab[],doubleweight[])
Sets an Adams‐Bashforth quadrature for order = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18, or
20.
voidbdfc_set(intorder,doublextab[],doubleweight[])
Sets weights for backward differentiation corrector quadrature, for 1 <= order <= 19.
voidbdfp_set(intorder,doublextab[],doubleweight[])
Sets weights for backward differentiation predictor quadrature, for 1 <= order <= 19.
voidcheb_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Chebyshev quadrature, for order = 1, 2, 3, 4, 5, 6, 7, or 9.
voidclenshaw_curtis_set(intorder,doublextab[],doubleweight[])
Sets a Clenshaw‐Curtis quadrature rule, for order = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 33, 65, or 129.
voidfejer1_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Fejer type 1 quadrature, for order = 1, 2, 3, 4, 5, 6, 7, 8, 9, or
10.
voidfejer2_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Fejer type 2 quadrature, for order = 1, 2, 3, 4, 5, 6, 7, 8, 9, or
10.
voidhermite_genz_keister_set(intorder,doublextab[],doubleweight[])
Sets a Hermite Genz‐Keister rule, for order = 1, 3, 7, 9, 17, 19, 31, 33, or 35.
voidhermite_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Hermite quadrature. The order must be between 1 and 20, or
31/32/33, 63/64/65, 127/128/129.
voidkronrod_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Gauss‐Kronrod quadrature. The order may be 15, 21, 31 or 41,
corresponding to Gauss‐Legendre rules of order 7, 10, 15 or 20.
voidlaguerre_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Laguerre quadrature. The order must be between 1 and 20, or
31/32/33, 63/64/65, 127/128/129.
voidlegendre_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Gauss‐Legendre quadrature. The order must be between 1 and 33 or
63/64/65, 127/128/129, 255/256/257.
voidlegendre_set_cos(intorder,doublextab[],doubleweight[])
Sets Gauss‐Legendre rules for COS(X)*F(X) on [-PI/2,PI/2]. The order must be 1, 2, 4, 8 or 16.
voidlegendre_set_cos2(intorder,doublextab[],doubleweight[])
Sets Gauss‐Legendre rules for COS(X)*F(X) on [0,PI/2]. The order must be 2, 4, 8 or 16.
voidlegendre_set_log(intorder,doublextab[],doubleweight[])
Sets a Gauss‐Legendre rule for - LOG(X) * F(X) on [0,1]. The order must be between 1 through 8,
or 16.
voidlegendre_set_sqrtx_01(intorder,doublextab[],doubleweight[])
Sets Gauss‐Legendre rules for SQRT(X)*F(X) on [0,1]. The order must be between 1 and 16 or 63/64,
127/128.
voidlegendre_set_sqrtx2_01(intorder,doublextab[],doubleweight[])
Sets Gauss‐Legendre rules for F(X)/SQRT(X) on [0,1]. The order must be be tween 1 and 16 or
63/64, 127/128.
voidlegendre_set_x0_01(intorder,doublextab[],doubleweight[])
Sets a Gauss‐Legendre rule for F(X) on [0,1]. The order must be between 1 and 8.
voidlegendre_set_x1(intorder,doublextab[],doubleweight[])
Sets a Gauss‐Legendre rule for ( 1 + X ) * F(X) on [-1,1]. The order must be between 1 and 9.
voidlegendre_set_x1_01(intorder,doublextab[],doubleweight[])
Sets a Gauss‐Legendre rule for X * F(X) on [0,1]. The order must be between 1 and 8.
voidlegendre_set_x2(intorder,doublextab[],doubleweight[])
Sets Gauss‐Legendre rules for ( 1 + X )^2*F(X) on [-1,1]. The order must be between 1 and 9.
voidlegendre_set_x2_01(intorder,doublextab[],doubleweight[])
Sets a Gauss‐Legendre rule for X*X * F(X) on [0,1]. The order must be between 1 and 8.
voidlobatto_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Lobatto quadrature. The order must be between 2 and 20.
voidmoulton_set(intorder,doublextab[],doubleweight[])
Sets weights for Adams‐Moulton quadrature. The order must be between 1 and 10 or 12, 14, 16, 18
or 20.
voidncc_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for closed Newton‐Cotes quadrature. The order must be between 1 and
21.
voidnco_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for open Newton‐Cotes quadrature. The order must be between 1 and 7,
or 9.
voidncoh_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Newton‐Cotes "open half" rules. The order must be between 1 and
17.
voidpatterson_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Gauss‐Patterson quadrature. The order must be 1, 3, 7, 15, 31, 63,
127 or 255.
voidradau_set(intorder,doublextab[],doubleweight[])
Sets abscissas and weights for Radau quadrature. The order must be between 1 and 15.