R: Indefinite Integral

indefinteg {spatstat.random} | R Documentation

## Indefinite Integral

### Description

Computes the indefinite integral of the given function.

### Usage

      indefinteg(f, x, ...,
                 method=c("trapezoid", "quadrature"),
                 lower=min(x), nfine=8192)

### Arguments

`f` | an R function taking a numeric first argument and returning a numeric vector of the same length.
`x` | Vector of values of the argument for which the indefinite integral should be evaluated.
`...` | additional arguments to be passed to `f`.
`method` | String (partially matched) specifying how to compute the integrals.
`lower` | Lower limit of integration. A single number.
`nfine` | Number of sub-intervals to use for computation if `method='trapezoid'`.

### Details

The indefinite integral of the given function `f` is computed numerically at each of the desired values `x`. The lower limit of integration is taken to be `min(x)`.

The result is a numeric vector `y` of the same length as `x`, with entries

y[i] = integral[lower]^(x[i]) f(t) dt

If `method='trapezoid'` (the default), the integrals are computed rapidly using the trapezoid rule. If `method='quadrature'` the integrals are computed accurately but much more slowly, using the numerical quadrature routine `integrate`.

If `method='trapezoid'` the function `f` is first evaluated on a finer grid of values of the function argument. The fine grid contains `nfine` sample points. The values of the indefinite integral on the fine grid are computed using the trapezoidal approximation. Finally the values of the indefinite integral are extracted at the desired argument values `x`.

### Value

Numeric vector of the same length as `x`.

### Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au.

### See Also

`integrate`

### Examples

      curve(indefinteg(sin, x), to=pi)

[Package spatstat.random version 2.1-0 Index]