

   NNuummeerriiccaall IInntteeggrraattiioonn ooff aa FFuunnccttiioonn

        int(f, a="-infty", b="infty", type="Romberg", eps=1.0e-6, max, d, p=0)

   AArrgguummeennttss::

          f: The function (of one variable) to integrate,
             returning either a scalar or a vector.

          a: A scalar or vector giving the lower bound. If non-
             numeric, taken to be -infty, in which case it must
             be the same for the whole vector.

          b: A scalar or vector giving the upper bound. If non-
             numeric, taken to be infty, in which case it must
             be the same for the whole vector.

       type: The algorithm to be used, by default Romberg inte-
             gration.  Otherwise, it uses the TOMS614 algo-
             rithm.

        eps: Precision.

        max: For Romberg, the maximum number of steps, by
             default set to 16. For TOMS614, the maximum number
             of function evaluations, by default set to 100.

          d: For Romberg, the number of extrapolation points so
             that 2k is the order of integration, by default
             set to 5; d=2 is Simpson's rule. For TOMS614,
             heuristic termination = any real number; determin-
             istic termination = a number in the range 0 < d <
             pi/2 by default, set to 1.

          p: For TOMS614, p = 0: heuristic termination, p = 1:
             deterministic termination with the infinity norm,
             p > 1: deterministic termination with the p-th
             norm.

   DDeessccrriippttiioonn::

        `int' performs numerical integration of a given func-
        tion using either Romberg integration or algorithm 614
        of the collected algorithms from ACM. Only the former
        is vectorized. The latter appeared in ACM-Trans. Math.
        Software, Vol.10, No. 2, Jun., 1984, p. 152-160 and
        uses formulae optimal in certain Hardy spaces h(p,d);
        see Sikorski,K., Optimal quadrature algorithms in HP
        spaces, Num. Math., 39, 405-410 (1982).

        Functions may have singularities at one or both end-
        points of the interval (a,b).

   AAuutthhoorr((ss))::

        J.K. Lindsey

   EExxaammpplleess::

        f <- function(x) sin(x)+cos(x)-x^2
        int(f, a=0, b=2)
        #
        f <- function(x) exp(-(x-2)^2/2)/sqrt(2*pi)
        int(f, a=0:3)
        1-pnorm(0:3, 2)

