Integrate: Integrate a function

View source: R/Integrate.R

IntegrateR Documentation

Integrate a function

Description

Calculates the definite integral of a function. That is, the result of the integration will be a number. There can be no free parameters in the function being integrated. (If you want free parameters, use antiD().) Integrate() can handle integration over up to 3 variables.

Usage

Integrate(tilde, domain, ..., tol = 1e-05)

Arguments

tilde

A tilde expression describing the function.

domain

The domain over which to perform the integration

...

values assigned to free parameters in the tilde expression, e.g. a=1

tol

numerical tolerance for integration, see stats::integrate().

Details

For functions constructed as a spline interpolant, Integrate() can handle more segments than antiD(). It's reasonable to do up to 2000 segments with Integrate(), whereas antiD() handles only about 100.

Examples

Integrate(dnorm(x) ~ x, domain(x=-2:2))
Integrate(dnorm(x, sd=sigma) ~ x, domain(x=-2:2), sigma=2)
Integrate(sqrt(1- x^2) ~ x, domain(x=-1:1)) # area of semi-circle


mosaicCalc documentation built on Sept. 11, 2024, 9:10 p.m.