quadpack_generic Module

Modernized QUADPACK: a Fortran subroutine package for the numerical computation of definite one-dimensional integrals

References

Authors

  • Piessens, Robert. Applied Mathematics and Programming Division, K. U. Leuven
  • de Doncker, Elise. Applied Mathematics and Programming Division, K. U. Leuven
  • Kahaner, D. K., (NBS)
  • Jacob Williams, Dec 2021. Modernized the Fortran 77 code from Netlib.

Uses

  • module~~quadpack_generic~~UsesGraph module~quadpack_generic quadpack_generic iso_fortran_env iso_fortran_env module~quadpack_generic->iso_fortran_env

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: quadpack_RK = wp

the real kind used in this module


Subroutines

public subroutine dqag(f, a, b, Epsabs, Epsrel, Key, Result, Abserr, Neval, Ier, Limit, Lenw, Last, Iwork, Work)

1D globally adaptive integrator using Gauss-Kronrod quadrature, oscillating integrand

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Key

key for choice of local integration rule. a gauss-kronrod pair is used with:

Read more…
real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(in) :: Limit

dimensioning parameter for iwork limit determines the maximum number of subintervals in the partition of the given integration interval (a,b), limit>=1. if limit<1, the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work lenw must be at least limit*4. if lenw<limit*4, the routine will end with ier = 6.

integer, intent(out) :: Last

on return, last equals the number of subintervals produced in the subdivision process, which determines the number of significant elements actually in the work arrays.

integer :: Iwork(Limit)

vector of dimension at least limit, the first k elements of which contain pointers to the error estimates over the subintervals, such that work(limit3+iwork(1)),... , work(limit3+iwork(k)) form a decreasing sequence with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw on return work(1), ..., work(last) contain the left end points of the subintervals in the partition of (a,b), work(limit+1), ..., work(limit+last) contain the right end points, work(limit*2+1), ..., work(limit*2+last) contain the integral approximations over the subintervals, work(limit3+1), ..., work(limit3+last) contain the error estimates.

public subroutine dqage(f, a, b, Epsabs, Epsrel, Key, Limit, Result, Abserr, Neval, Ier, Alist, Blist, Rlist, Elist, Iord, Last)

same as dqag but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Key

key for choice of local integration rule a gauss-kronrod pair is used with

Read more…
integer, intent(in) :: Limit

gives an upperbound on the number of subintervals in the partition of (a,b), limit>=1.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit, the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, the first k elements of which are pointers to the error estimates over the subintervals, such that elist(iord(1)), ..., elist(iord(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

integer, intent(out) :: Last

number of subintervals actually produced in the subdivision process

public subroutine dqagi(f, Bound, Inf, Epsabs, Epsrel, Result, Abserr, Neval, Ier, Limit, Lenw, Last, Iwork, Work)

1D globally adaptive integrator, infinite intervals

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: Bound

finite bound of integration range (has no meaning if interval is doubly-infinite)

integer, intent(in) :: Inf

indicating the kind of integration range involved:

Read more…
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(in) :: Limit

dimensioning parameter for iwork limit determines the maximum number of subintervals in the partition of the given integration interval (a,b), limit>=1. if limit<1, the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work lenw must be at least limit*4. if lenw<limit*4, the routine will end with ier = 6.

integer, intent(out) :: Last

on return, last equals the number of subintervals produced in the subdivision process, which determines the number of significant elements actually in the work arrays.

integer :: Iwork(Limit)

vector of dimension at least limit, the first k elements of which contain pointers to the error estimates over the subintervals, such that work(limit*3+iwork(1)),...,work(limit*3+iwork(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw on return: * work(1), ..., work(last) contain the left end points of the subintervals in the partition of (a,b), * work(limit+1), ..., work(limit+last) contain the right end points, * work(limit*2+1), ...,work(limit*2+last) contain the integral approximations over the subintervals, * work(limit*3+1), ..., work(limit*3) contain the error estimates.

public subroutine dqagie(f, Bound, Inf, Epsabs, Epsrel, Limit, Result, Abserr, Neval, Ier, Alist, Blist, Rlist, Elist, Iord, Last)

same as dqagi but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: Bound

finite bound of integration range (has no meaning if interval is doubly-infinite)

integer, intent(in) :: Inf

indicating the kind of integration range involved * inf = 1 corresponds to (bound,+infinity) * inf = -1 corresponds to (-infinity,bound) * inf = 2 corresponds to (-infinity,+infinity)

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upper bound on the number of subintervals in the partition of (a,b), limit>=1

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the transformed integration range (0,1).

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the transformed integration range (0,1).

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit, the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

integer, intent(out) :: Iord(Limit)

vector of dimension limit, the first k elements of which are pointers to the error estimates over the subintervals, such that elist(iord(1)), ..., elist(iord(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

integer, intent(out) :: Last

number of subintervals actually produced in the subdivision process

public subroutine dqagp(f, a, b, Npts2, Points, Epsabs, Epsrel, Result, Abserr, Neval, Ier, Leniw, Lenw, Last, Iwork, Work)

1D globally adaptive integrator, singularities or discontinuities

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

integer, intent(in) :: Npts2

number equal to two more than the number of user-supplied break points within the integration range, npts>=2. if npts2<2, the routine will end with ier = 6.

real(kind=wp), intent(in) :: Points(Npts2)

vector of dimension npts2, the first (npts2-2) elements of which are the user provided break points. if these points do not constitute an ascending sequence there will be an automatic sorting.

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(in) :: Leniw

dimensioning parameter for iwork. leniw determines limit = (leniw-npts2)/2, which is the maximum number of subintervals in the partition of the given integration interval (a,b), leniw>=(3*npts2-2). if leniw<(3*npts2-2), the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work. lenw must be at least leniw*2-npts2. if lenw<leniw*2-npts2, the routine will end with ier = 6.

integer, intent(out) :: Last

on return, last equals the number of subintervals produced in the subdivision process, which determines the number of significant elements actually in the work arrays.

integer :: Iwork(Leniw)

vector of dimension at least leniw. on return, the first k elements of which contain pointers to the error estimates over the subintervals, such that work(limit*3+iwork(1)),...,work(limit*3+iwork(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise iwork(limit+1), ...,iwork(limit+last) contain the subdivision levels of the subintervals, i.e. if (aa,bb) is a subinterval of (p1,p2) where p1 as well as p2 is a user-provided break point or integration limit, then (aa,bb) has level l if abs(bb-aa) = abs(p2-p1)*2**(-l), iwork(limit*2+1), ..., iwork(limit*2+npts2) have no significance for the user, note that limit = (leniw-npts2)/2.

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw. on return:

Read more…

public subroutine dqagpe(f, a, b, Npts2, Points, Epsabs, Epsrel, Limit, Result, Abserr, Neval, Ier, Alist, Blist, Rlist, Elist, Pts, Iord, Level, Ndin, Last)

same as dqagp but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f
real(kind=wp) :: a
real(kind=wp) :: b
integer, intent(in) :: Npts2

number equal to two more than the number of user-supplied break points within the integration range, npts2>=2. if npts2<2, the routine will end with ier = 6.

real(kind=wp), intent(in) :: Points(Npts2)

vector of dimension npts2, the first (npts2-2) elements of which are the user provided break points. if these points do not constitute an ascending sequence there will be an automatic sorting.

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upper bound on the number of subintervals in the partition of (a,b), limit>=npts2 if limit<npts2, the routine will end with ier = 6.

real(kind=wp) :: Result
real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit, the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

real(kind=wp), intent(out) :: Pts(Npts2)

vector of dimension at least npts2, containing the integration limits and the break points of the interval in ascending sequence.

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, the first k elements of which are pointers to the error estimates over the subintervals, such that elist(iord(1)), ..., elist(iord(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

integer, intent(out) :: Level(Limit)

vector of dimension at least limit, containing the subdivision levels of the subinterval, i.e. if (aa,bb) is a subinterval of (p1,p2) where p1 as well as p2 is a user-provided break point or integration limit, then (aa,bb) has level l if abs(bb-aa) = abs(p2-p1)*2**(-l).

integer, intent(out) :: Ndin(Npts2)

vector of dimension at least npts2, after first integration over the intervals (pts(i)),pts(i+1), i = 0,1, ..., npts2-2, the error estimates over some of the intervals may have been increased artificially, in order to put their subdivision forward. if this happens for the subinterval numbered k, ndin(k) is put to 1, otherwise ndin(k) = 0.

integer, intent(out) :: Last

number of subintervals actually produced in the subdivisions process

public subroutine dqags(f, a, b, Epsabs, Epsrel, Result, Abserr, Neval, Ier, Limit, Lenw, Last, Iwork, Work)

1D globally adaptive integrator using interval subdivision and extrapolation

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(in) :: Limit

dimensioning parameter for iwork. limit determines the maximum number of subintervals in the partition of the given integration interval (a,b), limit>=1. if limit<1, the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work. lenw must be at least limit*4. if lenw<limit*4, the routine will end with ier = 6.

integer, intent(out) :: Last

on return, last equals the number of subintervals produced in the subdivision process, determines the number of significant elements actually in the work arrays.

integer :: Iwork(Limit)

vector of dimension at least limit, the first k elements of which contain pointers to the error estimates over the subintervals such that work(limit*3+iwork(1)),...,work(limit*3+iwork(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw. on return:

Read more…

public subroutine dqagse(f, a, b, Epsabs, Epsrel, Limit, Result, Abserr, Neval, Ier, Alist, Blist, Rlist, Elist, Iord, Last)

same as dqags but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upperbound on the number of subintervals in the partition of (a,b)

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages: * ier = 1 maximum number of subdivisions allowed has been achieved. one can allow more sub- divisions by increasing the value of limit (and taking the according dimension adjustments into account). however, if this yields no improvement it is advised to analyze the integrand in order to determine the integration difficulties. if the position of a local difficulty can be determined (e.g. singularity, discontinuity within the interval) one will probably gain from splitting up the interval at this point and calling the integrator on the subranges. if possible, an appropriate special-purpose integrator should be used, which is designed for handling the type of difficulty involved. * ier = 2 the occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. the error may be under-estimated. * ier = 3 extremely bad integrand behaviour occurs at some points of the integration interval. * ier = 4 the algorithm does not converge. roundoff error is detected in the extrapolation table. it is presumed that the requested tolerance cannot be achieved, and that the returned result is the best which can be obtained. * ier = 5 the integral is probably divergent, or slowly convergent. it must be noted that divergence can occur with any other value of ier. * ier = 6 the input is invalid, because epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28). result, abserr, neval, last, rlist(1), iord(1) and elist(1) are set to zero. alist(1) and blist(1) are set to a and b respectively.

Read more…
real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit, the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, the first k elements of which are pointers to the error estimates over the subintervals, such that elist(iord(1)), ..., elist(iord(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

integer, intent(out) :: Last

number of subintervals actually produced in the subdivision process

public subroutine dqawc(f, a, b, c, Epsabs, Epsrel, Result, Abserr, Neval, Ier, Limit, Lenw, Last, Iwork, Work)

compute Cauchy principal value of f(x)/(x-c) over a finite interval

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

under limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: c

parameter in the weight function, c/=a, c/=b. if c = a or c = b, the routine will end with ier = 6 .

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate or the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages: * ier = 1 maximum number of subdivisions allowed has been achieved. one can allow more sub- divisions by increasing the value of limit (and taking the according dimension adjustments into account). however, if this yields no improvement it is advised to analyze the integrand in order to determine the integration difficulties. if the position of a local difficulty can be determined (e.g. singularity, discontinuity within the interval) one will probably gain from splitting up the interval at this point and calling appropriate integrators on the subranges. * ier = 2 the occurrence of roundoff error is detected, which prevents the requested tolerance from being achieved. * ier = 3 extremely bad integrand behaviour occurs at some points of the integration interval. * ier = 6 the input is invalid, because c = a or c = b or (epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28)) or limit<1 or lenw<limit*4. esult, abserr, neval, last are set to zero. except when lenw or limit is invalid, iwork(1), work(limit*2+1) and work(limit*3+1) are set to zero, work(1) is set to a and work(limit+1) to b.

Read more…
integer, intent(in) :: Limit

dimensioning parameter for iwork. limit determines the maximum number of subintervals in the partition of the given integration interval (a,b), limit>=1. if limit<1, the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work. lenw must be at least limit*4. if lenw<limit*4, the routine will end with ier = 6.

integer, intent(out) :: Last

on return, last equals the number of subintervals produced in the subdivision process, which determines the number of significant elements actually in the work arrays.

integer :: Iwork(Limit)

vector of dimension at least limit, the first k elements of which contain pointers to the error estimates over the subintervals, such that work(limit*3+iwork(1)),...,work(limit*3+iwork(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw. on return:

Read more…

public subroutine dqawce(f, a, b, c, Epsabs, Epsrel, Limit, Result, Abserr, Neval, Ier, Alist, Blist, Rlist, Elist, Iord, Last)

same as dqawc but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp) :: c
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upper bound on the number of subintervals in the partition of (a,b), limit>=1

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit, the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, the first k elements of which are pointers to the error estimates over the subintervals, so that elist(iord(1)), ..., elist(iord(k)) with k = last if last<=(limit/2+2), and k = limit+1-last otherwise, form a decreasing sequence

integer, intent(out) :: Last

number of subintervals actually produced in the subdivision process

public subroutine dqawf(f, a, Omega, Integr, Epsabs, Result, Abserr, Neval, Ier, Limlst, Lst, Leniw, Maxp1, Lenw, Iwork, Work)

Fourier sine/cosine transform for user supplied interval a to infinity

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: Omega

parameter in the integrand weight function

integer, intent(in) :: Integr

indicates which of the weight functions is used:

Read more…
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested, epsabs>0. if epsabs<=0, the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(in) :: Limlst

limlst gives an upper bound on the number of cycles, limlst>=3. if limlst<3, the routine will end with ier = 6.

integer, intent(out) :: Lst

on return, lst indicates the number of cycles actually needed for the integration. if omega = 0, then lst is set to 1.

integer, intent(in) :: Leniw

dimensioning parameter for iwork. on entry, (leniw-limlst)/2 equals the maximum number of subintervals allowed in the partition of each cycle, leniw>=(limlst+2). if leniw<(limlst+2), the routine will end with ier = 6.

integer, intent(in) :: Maxp1

maxp1 gives an upper bound on the number of chebyshev moments which can be stored, i.e. for the intervals of lengths abs(b-a)*2**(-l), l = 0,1, ..., maxp1-2, maxp1>=1. if maxp1<1, the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work. lenw must be at least leniw*2+maxp1*25. if lenw<(leniw*2+maxp1*25), the routine will end with ier = 6.

integer :: Iwork(Leniw)

vector of dimension at least leniw on return, iwork(k) for k = 1, 2, ..., lst contain the error flags on the cycles.

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw on return:

Read more…

public subroutine dqawfe(f, a, Omega, Integr, Epsabs, Limlst, Limit, Maxp1, Result, Abserr, Neval, Ier, Rslst, Erlst, Ierlst, Lst, Alist, Blist, Rlist, Elist, Iord, Nnlog, Chebmo)

same as dqawf but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: Omega

parameter in the weight function

integer, intent(in) :: Integr

indicates which weight function is used:

Read more…
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested, epsabs>0 if epsabs<=0, the routine will end with ier = 6.

integer, intent(in) :: Limlst

limlst gives an upper bound on the number of cycles, limlst>=1. if limlst<3, the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upper bound on the number of subintervals allowed in the partition of each cycle, limit>=1 each cycle, limit>=1.

integer, intent(in) :: Maxp1

gives an upper bound on the number of chebyshev moments which can be stored, i.e. for the intervals of lengths abs(b-a)*2**(-l),l=0,1, ..., maxp1-2, maxp1>=1``

real(kind=wp), intent(out) :: Result

approximation to the integral x

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
real(kind=wp), intent(out) :: Rslst(Limlst)

vector of dimension at least limlst rslst(k) contains the integral contribution over the interval (a+(k-1)c,a+kc) where c = (2*int(abs(omega))+1)*pi/abs(omega), k = 1, 2, ..., lst. note that, if omega = 0, rslst(1) contains the value of the integral over (a,infinity).

real(kind=wp), intent(out) :: Erlst(Limlst)

vector of dimension at least limlst erlst(k) contains the error estimate corresponding with rslst(k).

integer, intent(out) :: Ierlst(Limlst)

vector of dimension at least limlst ierlst(k) contains the error flag corresponding with rslst(k). for the meaning of the local error flags see description of output parameter ier.

integer, intent(out) :: Lst

number of subintervals needed for the integration if omega = 0 then lst is set to 1.

real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, providing space for the quantities needed in the subdivision process of each cycle

integer, intent(out) :: Nnlog(Limit)

vector of dimension at least limit, providing space for the quantities needed in the subdivision process of each cycle

real(kind=wp), intent(out) :: Chebmo(Maxp1,25)

array of dimension at least (maxp1,25), providing space for the chebyshev moments needed within the cycles (see also routine dqc25f)

public subroutine dqawo(f, a, b, Omega, Integr, Epsabs, Epsrel, Result, Abserr, Neval, Ier, Leniw, Maxp1, Lenw, Last, Iwork, Work)

1D integration of cos(omega*x)*f(x) or sin(omega*x)*f(x) over a finite interval, adaptive subdivision with extrapolation

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Omega

parameter in the integrand weight function

integer, intent(in) :: Integr

indicates which of the weight functions is used

Read more…
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(in) :: Leniw

dimensioning parameter for iwork. leniw/2 equals the maximum number of subintervals allowed in the partition of the given integration interval (a,b), leniw>=2. if leniw<2, the routine will end with ier = 6.

integer, intent(in) :: Maxp1

gives an upper bound on the number of chebyshev moments which can be stored, i.e. for the intervals of lengths abs(b-a)*2**(-l), l=0,1, ..., maxp1-2, maxp1>=1 if maxp1<1, the routine will end with ier = 6.

integer, intent(in) :: Lenw

dimensioning parameter for work lenw must be at least leniw*2+maxp1*25. if lenw<(leniw*2+maxp1*25), the routine will end with ier = 6.

integer, intent(out) :: Last

on return, last equals the number of subintervals produced in the subdivision process, which determines the number of significant elements actually in the work arrays.

integer :: Iwork(Leniw)

vector of dimension at least leniw on return, the first k elements of which contain pointers to the error estimates over the subintervals, such that work(limit*3+iwork(1)), .., work(limit*3+iwork(k)) form a decreasing sequence, with limit = lenw/2 , and k = last if last<=(limit/2+2), and k = limit+1-last otherwise. furthermore, iwork(limit+1), ..., iwork(limit+last) indicate the subdivision levels of the subintervals, such that iwork(limit+i) = l means that the subinterval numbered i is of length abs(b-a)*2**(1-l).

real(kind=wp) :: Work(Lenw)

vector of dimension at least lenw. on return:

Read more…

public subroutine dqawoe(f, a, b, Omega, Integr, Epsabs, Epsrel, Limit, Icall, Maxp1, Result, Abserr, Neval, Ier, Last, Alist, Blist, Rlist, Elist, Iord, Nnlog, Momcom, Chebmo)

same as dqawo but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Omega

parameter in the integrand weight function

integer, intent(in) :: Integr

indicates which of the weight functions is to be used:

Read more…
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested. if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upper bound on the number of subdivisions in the partition of (a,b), limit>=1.

integer, intent(in) :: Icall

if dqawoe is to be used only once, icall must be set to 1. assume that during this call, the chebyshev moments (for clenshaw-curtis integration of degree 24) have been computed for intervals of lengths (abs(b-a))*2**(-l), l=0,1,2,...momcom-1. if icall>1 this means that dqawoe has been called twice or more on intervals of the same length abs(b-a). the chebyshev moments already computed are then re-used in subsequent calls. if icall<1, the routine will end with ier = 6.

integer, intent(in) :: Maxp1

gives an upper bound on the number of chebyshev moments which can be stored, i.e. for the intervals of lengths abs(b-a)*2**(-l), l=0,1, ..., maxp1-2, maxp1>=1. if maxp1<1, the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…
integer, intent(out) :: Last

on return, last equals the number of subintervals produces in the subdivision process, which determines the number of significant elements actually in the work arrays.

real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit, the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, the first k elements of which are pointers to the error estimates over the subintervals, such that elist(iord(1)), ..., elist(iord(k)) form a decreasing sequence, with k = last if last<=(limit/2+2), and k = limit+1-last otherwise.

integer, intent(out) :: Nnlog(Limit)

vector of dimension at least limit, containing the subdivision levels of the subintervals, i.e. iwork(i) = l means that the subinterval numbered i is of length abs(b-a)*2**(1-l)

integer, intent(inout) :: Momcom

indicating that the chebyshev moments have been computed for intervals of lengths (abs(b-a))*2**(-l), l=0,1,2, ..., momcom-1, momcom<maxp1

real(kind=wp), intent(inout) :: Chebmo(Maxp1,25)

array of dimension (maxp1,25) containing the chebyshev moments

public subroutine dqaws(f, a, b, alfa, beta, integr, epsabs, epsrel, result, abserr, neval, ier, limit, lenw, last, iwork, work)

1D integration of functions with powers and or logs over a finite interval

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration, b>a if b<=a, the routine will end with ier = 6.

real(kind=wp), intent(in) :: alfa

parameter in the integrand function, alfa>(-1) if alfa<=(-1), the routine will end with ier = 6.

real(kind=wp), intent(in) :: beta

parameter in the integrand function, beta>(-1) if beta<=(-1), the routine will end with ier = 6.

integer, intent(in) :: integr

indicates which weight function is to be used:

Read more…
real(kind=wp), intent(in) :: epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: epsrel

relative accuracy requested. if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: result

approximation to the integral

real(kind=wp), intent(out) :: abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: neval

number of integrand evaluations

integer, intent(out) :: ier

error messages:

Read more…
integer, intent(in) :: limit

dimensioning parameter for iwork limit determines the maximum number of subintervals in the partition of the given integration interval (a,b), limit>=2. if limit<2, the routine will end with ier = 6.

integer, intent(in) :: lenw

dimensioning parameter for work lenw must be at least limit*4. if lenw<limit*4, the routine will end with ier = 6.

integer, intent(out) :: last

on return, last equals the number of subintervals produced in the subdivision process, which determines the significant number of elements actually in the work arrays.

integer :: iwork(limit)

vector of dimension limit, the first k elements of which contain pointers to the error estimates over the subintervals, such that work(limit*3+iwork(1)), ..., work(limit*3+iwork(k)) form a decreasing sequence with k = last if last<=(limit/2+2), and k = limit+1-last otherwise

real(kind=wp) :: work(lenw)

on return:

Read more…

public subroutine dqawse(f, a, b, Alfa, Beta, Integr, Epsabs, Epsrel, Limit, Result, Abserr, Neval, Ier, Alist, Blist, Rlist, Elist, Iord, Last)

same as dqaws but provides more information and control

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration, b>a. if b<=a, the routine will end with ier = 6.

real(kind=wp), intent(in) :: Alfa

parameter in the weight function, alfa>(-1) if alfa<=(-1), the routine will end with ier = 6.

real(kind=wp), intent(in) :: Beta

parameter in the weight function, beta>(-1) if beta<=(-1), the routine will end with ier = 6.

integer, intent(in) :: Integr

indicates which weight function is to be used:

Read more…
real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested. if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

integer, intent(in) :: Limit

gives an upper bound on the number of subintervals in the partition of (a,b), limit>=2 if limit<2, the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier Read more…
real(kind=wp), intent(out) :: Alist(Limit)

vector of dimension at least limit, the first last elements of which are the left end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Blist(Limit)

vector of dimension at least limit, the first last elements of which are the right end points of the subintervals in the partition of the given integration range (a,b)

real(kind=wp), intent(out) :: Rlist(Limit)

vector of dimension at least limit,the first last elements of which are the integral approximations on the subintervals

real(kind=wp), intent(out) :: Elist(Limit)

vector of dimension at least limit, the first last elements of which are the moduli of the absolute error estimates on the subintervals

integer, intent(out) :: Iord(Limit)

vector of dimension at least limit, the first k of which are pointers to the error estimates over the subintervals, so that elist(iord(1)), ..., elist(iord(k)) with k = last if last<=(limit/2+2), and k = limit+1-last otherwise form a decreasing sequence

integer, intent(out) :: Last

number of subintervals actually produced in the subdivision process

public subroutine dqc25c(f, a, b, c, Result, Abserr, Krul, Neval)

1D integral for Cauchy principal values using a 25 point quadrature rule

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

left end point of the integration interval

real(kind=wp), intent(in) :: b

right end point of the integration interval, b>a

real(kind=wp), intent(in) :: c

parameter in the weight function

real(kind=wp), intent(out) :: Result

approximation to the integral. result is computed by using a generalized clenshaw-curtis method if c lies within ten percent of the integration interval. in the other case the 15-point kronrod rule obtained by optimal addition of abscissae to the 7-point gauss rule, is applied.

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(inout) :: Krul

key which is decreased by 1 if the 15-point gauss-kronrod scheme has been used

integer, intent(out) :: Neval

number of integrand evaluations

public subroutine dqc25f(f, a, b, Omega, Integr, Nrmom, Maxp1, Ksave, Result, Abserr, Neval, Resabs, Resasc, Momcom, Chebmo)

1D integral for sin/cos integrand using a 25 point quadrature rule

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Omega

parameter in the weight function

integer, intent(in) :: Integr

indicates which weight function is to be used

Read more…
integer, intent(in) :: Nrmom

the length of interval (a,b) is equal to the length of the original integration interval divided by 2**nrmom (we suppose that the routine is used in an adaptive integration process, otherwise set nrmom = 0). nrmom must be zero at the first call.

integer, intent(in) :: Maxp1

gives an upper bound on the number of chebyshev moments which can be stored, i.e. for the intervals of lengths abs(bb-aa)*2**(-l), l = 0,1,2, ..., maxp1-2.

integer, intent(in) :: Ksave

key which is one when the moments for the current interval have been computed

real(kind=wp), intent(out) :: Result

approximation to the integral i

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a))

integer, intent(inout) :: Momcom

for each interval length we need to compute the chebyshev moments. momcom counts the number of intervals for which these moments have already been computed. if nrmom<momcom or ksave = 1, the chebyshev moments for the interval (a,b) have already been computed and stored, otherwise we compute them and we increase momcom.

real(kind=wp), intent(inout) :: Chebmo(Maxp1,25)

array of dimension at least (maxp1,25) containing the modified chebyshev moments for the first momcom momcom interval lengths

public subroutine dqc25s(f, a, b, Bl, Br, Alfa, Beta, Ri, Rj, Rg, Rh, Result, Abserr, Resasc, Integr, Nev)

25-point clenshaw-curtis integration

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand f(x).

real(kind=wp), intent(in) :: a

left end point of the original interval

real(kind=wp), intent(in) :: b

right end point of the original interval, b>a

real(kind=wp), intent(in) :: Bl

lower limit of integration, bl>=a

real(kind=wp), intent(in) :: Br

upper limit of integration, br<=b

real(kind=wp), intent(in) :: Alfa

parameter in the weight function

real(kind=wp), intent(in) :: Beta

parameter in the weight function

real(kind=wp), intent(in) :: Ri(25)

modified chebyshev moments for the application of the generalized clenshaw-curtis method (computed in subroutine dqmomo)

real(kind=wp), intent(in) :: Rj(25)

modified chebyshev moments for the application of the generalized clenshaw-curtis method (computed in subroutine dqmomo)

real(kind=wp), intent(in) :: Rg(25)

modified chebyshev moments for the application of the generalized clenshaw-curtis method (computed in subroutine dqmomo)

real(kind=wp), intent(in) :: Rh(25)

modified chebyshev moments for the application of the generalized clenshaw-curtis method (computed in subroutine dqmomo)

real(kind=wp), intent(out) :: Result

approximation to the integral result is computed by using a generalized clenshaw-curtis method if b1 = a or br = b. in all other cases the 15-point kronrod rule is applied, obtained by optimal addition of abscissae to the 7-point gauss rule.

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f*w-i/(b-a))

integer, intent(in) :: Integr

which determines the weight function * = 1 w(x) = (x-a)**alfa*(b-x)**beta * = 2 w(x) = (x-a)**alfa*(b-x)**beta*log(x-a) * = 3 w(x) = (x-a)**alfa*(b-x)**beta*log(b-x) * = 4 w(x) = (x-a)**alfa*(b-x)**beta*log(x-a)*log(b-x)

integer, intent(out) :: Nev

number of integrand evaluations

public subroutine dqcheb(x, Fval, Cheb12, Cheb24)

chebyshev series expansion

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(11)

vector of dimension 11 containing the values cos(k*pi/24), k = 1, ..., 11

real(kind=wp), intent(inout) :: Fval(25)

vector of dimension 25 containing the function values at the points (b+a+(b-a)*cos(k*pi/24))/2, k = 0, ...,24, where (a,b) is the approximation interval. fval(1) and fval(25) are divided by two (these values are destroyed at output).

real(kind=wp), intent(out) :: Cheb12(13)

vector of dimension 13 containing the chebyshev coefficients for degree 12

real(kind=wp), intent(out) :: Cheb24(25)

vector of dimension 25 containing the chebyshev coefficients for degree 24

public subroutine dqk15(f, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on finite interval using a 15 point gauss-kronrod rule and give error estimate, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i result is computed by applying the 15-point kronrod rule (resk) obtained by optimal addition of abscissae to the7-point gauss rule(resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should not exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a)) over (a,b)

public subroutine dqk15i(f, Boun, Inf, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on (semi)infinite interval using a 15 point gauss-kronrod quadrature rule, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: Boun

finite bound of original integration range (set to zero if inf = +2)

integer, intent(in) :: Inf

the integral is computed as the sum of two integrals, one over (-infinity,0) and one over (0,+infinity).

Read more…
real(kind=wp), intent(in) :: a

lower limit for integration over subrange of (0,1)

real(kind=wp), intent(in) :: b

upper limit for integration over subrange of (0,1)

real(kind=wp), intent(out) :: Result

approximation to the integral i. result is computed by applying the 15-point kronrod rule(resk) obtained by optimal addition of abscissae to the 7-point gauss rule(resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs((transformed integrand)-i/(b-a)) over (a,b)

public subroutine dqk15w(f, w, p1, p2, p3, p4, Kp, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral with special singular weight functions using a 15 point gauss-kronrod quadrature rule

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

procedure(weight_func) :: w

function subprogram defining the integrand weight function w(x).

real(kind=wp), intent(in) :: p1

parameter in the weight function

real(kind=wp), intent(in) :: p2

parameter in the weight function

real(kind=wp), intent(in) :: p3

parameter in the weight function

real(kind=wp), intent(in) :: p4

parameter in the weight function

integer, intent(in) :: Kp

key for indicating the type of weight function

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i result is computed by applying the 15-point kronrod rule (resk) obtained by optimal addition of abscissae to the 7-point gauss rule (resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral of abs(f)

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a))

public subroutine dqk21(f, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on finite interval using a 21 point gauss-kronrod rule and give error estimate, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i result is computed by applying the 21-point kronrod rule (resk) obtained by optimal addition of abscissae to the 10-point gauss rule (resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should not exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a)) over (a,b)

public subroutine dqk31(f, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on finite interval using a 31 point gauss-kronrod rule and give error estimate, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i result is computed by applying the 31-point gauss-kronrod rule (resk), obtained by optimal addition of abscissae to the 15-point gauss rule (resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the modulus, which should not exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a)) over (a,b)

public subroutine dqk41(f, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on finite interval using a 41 point gauss-kronrod rule and give error estimate, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i result is computed by applying the 41-point gauss-kronrod rule (resk) obtained by optimal addition of abscissae to the 20-point gauss rule (resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should not exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a)) over (a,b)

public subroutine dqk51(f, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on finite interval using a 51 point gauss-kronrod rule and give error estimate, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subroutine defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i. result is computed by applying the 51-point kronrod rule (resk) obtained by optimal addition of abscissae to the 25-point gauss rule (resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should not exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a)) over (a,b)

public subroutine dqk61(f, a, b, Result, Abserr, Resabs, Resasc)

estimate 1D integral on finite interval using a 61 point gauss-kronrod rule and give error estimate, non-automatic

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(out) :: Result

approximation to the integral i result is computed by applying the 61-point kronrod rule (resk) obtained by optimal addition of abscissae to the 30-point gauss rule (resg).

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

real(kind=wp), intent(out) :: Resabs

approximation to the integral j

real(kind=wp), intent(out) :: Resasc

approximation to the integral of abs(f-i/(b-a))

public subroutine dqmomo(Alfa, Beta, Ri, Rj, Rg, Rh, Integr)

1D integration of k-th degree Chebyshev polynomial times a function with singularities

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: Alfa

parameter in the weight function w(x), alfa>(-1)

real(kind=wp), intent(in) :: Beta

parameter in the weight function w(x), beta>(-1)

real(kind=wp), intent(out) :: Ri(25)

i(k) is the integral over (-1,1) of (1+x)**alfa*t(k-1,x), k = 1, ..., 25.

real(kind=wp), intent(out) :: Rj(25)

rj(k) is the integral over (-1,1) of (1-x)**beta*t(k-1,x), k = 1, ..., 25.

real(kind=wp), intent(out) :: Rg(25)

rg(k) is the integral over (-1,1) of (1+x)**alfa*log((1+x)/2)*t(k-1,x), k = 1, ..., 25.

real(kind=wp), intent(out) :: Rh(25)

rh(k) is the integral over (-1,1) of (1-x)**beta*log((1-x)/2)*t(k-1,x), k = 1, ..., 25.

integer, intent(in) :: Integr

input parameter indicating the modified moments to be computed:

Read more…

public subroutine dqng(f, a, b, Epsabs, Epsrel, Result, Abserr, Neval, Ier)

1D non-adaptive automatic integrator

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration

real(kind=wp), intent(in) :: Epsabs

absolute accuracy requested

real(kind=wp), intent(in) :: Epsrel

relative accuracy requested if epsabs<=0 and epsrel<max(50*rel.mach.acc.,0.5e-28), the routine will end with ier = 6.

real(kind=wp), intent(out) :: Result

approximation to the integral i result is obtained by applying the 21-point gauss-kronrod rule (res21) obtained by optimal addition of abscissae to the 10-point gauss rule (res10), or by applying the 43-point rule (res43) obtained by optimal addition of abscissae to the 21-point gauss-kronrod rule, or by applying the 87-point rule (res87) obtained by optimal addition of abscissae to the 43-point rule.

real(kind=wp), intent(out) :: Abserr

estimate of the modulus of the absolute error, which should equal or exceed abs(i-result)

integer, intent(out) :: Neval

number of integrand evaluations

integer, intent(out) :: Ier

error messages:

Read more…

public subroutine dquad(f, a, b, result, epsil, npts, icheck)

This subroutine attempts to calculate the integral of f(x) over the interval a to b with relative error not exceeding epsil.

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration.

real(kind=wp), intent(in) :: b

upper limit of integration.

real(kind=wp), intent(out) :: result

the value of the integral to the specified relative accuracy.

real(kind=wp), intent(in) :: epsil

relative accuracy required. when the relative difference of two successive formulae does not exceed epsil the last formula computed is taken as the result.

integer, intent(out) :: npts

number integrand evaluations.

integer, intent(out) :: icheck

on exit normally icheck=0. however if convergence to the accuracy requested is not achieved icheck=1 on exit.

public subroutine davint(x, y, n, xlo, xup, ans, ierr)

Integrate a function tabulated at arbitrarily spaced abscissas using overlapping parabolas.

Read more…

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(:) :: x

array of abscissas, which must be in increasing order.

real(kind=wp), intent(in), dimension(:) :: y

array of function values. i.e., y(i)=func(x(i))

integer, intent(in) :: n

The integer number of function values supplied. N >= 2 unless XLO = XUP.

real(kind=wp), intent(in) :: xlo

lower limit of integration

real(kind=wp), intent(in) :: xup

upper limit of integration. Must have XLO <= XUP

real(kind=wp), intent(out) :: ans

computed approximate value of integral

integer, intent(out) :: ierr

A status code:

Read more…

public subroutine dqnc79(fun, a, b, err, ans, ierr, k)

Integrate a function using a 7-point adaptive Newton-Cotes quadrature rule.

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: fun

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower limit of integration

real(kind=wp), intent(in) :: b

upper limit of integration (may be less than A)

real(kind=wp), intent(in) :: err

a requested error tolerance. Normally, pick a value 0 < ERR < 1.0e-8.

real(kind=wp), intent(out) :: ans

computed value of the integral. Hopefully, ANS is accurate to within ERR * integral of ABS(FUN(X)).

integer, intent(out) :: ierr

a status code:

Read more…
integer, intent(out) :: k

the number of function evaluations actually used to do the integration. A value of K > 1000 indicates a difficult problem; other programs may be more efficient. DQNC79 will gracefully give up if K exceeds 5000.

public subroutine dgauss8(f, a, b, error_tol, ans, ierr, err)

Integrate a real function of one variable over a finite interval using an adaptive 8-point Legendre-Gauss algorithm.

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower bound of the integration

real(kind=wp), intent(in) :: b

upper bound of the integration

real(kind=wp), intent(in) :: error_tol

is a requested pseudorelative error tolerance. normally pick a value of abs(error_tol) so that dtol < abs(error_tol) <= 1.0e-3 where dtol is the larger of 1.0e-18and the real unit roundoff d1mach(4). ans will normally have no more error than abs(error_tol) times the integral of the absolute value of f(x). usually, smaller values of error_tol yield more accuracy and require more function evaluations.

real(kind=wp), intent(out) :: ans

computed value of integral

integer, intent(out) :: ierr

status code:

Read more…
real(kind=wp), intent(out) :: err

an estimate of the absolute error in ans. the estimated error is solely for information to the user and should not be used as a correction to the computed integral.

public recursive subroutine dsimpson(f, a, b, error_tol, ans, ierr)

Numerically evaluate integral using adaptive Simpson rule.

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower bound of the integration

real(kind=wp), intent(in) :: b

upper bound of the integration

real(kind=wp), intent(in) :: error_tol

relative error tolerance

real(kind=wp), intent(out) :: ans

computed value of integral

integer, intent(out) :: ierr

status code:

Read more…

public recursive subroutine dlobatto(f, a, b, error_tol, ans, ierr)

Numerically evaluate integral using adaptive Lobatto rule

Read more…

Arguments

Type IntentOptional Attributes Name
procedure(func) :: f

function subprogram defining the integrand function f(x).

real(kind=wp), intent(in) :: a

lower bound of the integration

real(kind=wp), intent(in) :: b

upper bound of the integration

real(kind=wp), intent(in) :: error_tol

relative error tolerance

real(kind=wp), intent(out) :: ans

computed value of integral

integer, intent(out) :: ierr

status code:

Read more…