Skip to contents

Integrates y = f(x) over the points x, as catR::integrate.catR() does.

Usage

integrate_cat(x, y)

Arguments

x

Numeric vector of the points of integration, in increasing order.

y

Numeric vector of the values of the function at x.

Value

The integral, a number.

Examples

x <- seq(from = -3, to = 3, length = 33)
integrate_cat(x = x, y = exp(x))
#> [1] 20.09441
exp(3) - exp(-3) # the exact value
#> [1] 20.03575