# integral

0th

Percentile

##### Monte Carlo Integration

Integrates multidimensional functions, expressions, and characters in arbitrary orthogonal coordinate systems.

##### Usage
integral(f, ..., err = 0.01, rel = TRUE, coordinates = "cartesian",
verbose = TRUE)
##### Arguments
f

function, expression or characters.

...

integration bounds.

err

acuracy requested.

rel

logical. Relative accuracy? If FALSE, use absolute accuracy.

coordinates

coordinate system to use. One of: cartesian, polar, spherical, cylindrical, parabolic, parabolic-cylindrical or a character vector of scale factors for each varibale.

verbose

logical. Print on progress?

##### Value

list with components

value

the final estimate of the integral.

abs.error

estimate of the modulus of the absolute error.

• integral
##### Examples
# NOT RUN {
# integrate character
integral('sin(x)', x = c(0,2*pi), rel = FALSE)

# integrate expression
integral(parse(text = 'x'), x = c(0,1))

# integrate function
integral(function(x) exp(x), x = c(0,1))

# multivariate integral
integral(function(x,y) x*y, x = c(0,1), y = c(0,1))

# surface of a sphere
integral('1', r = 1, theta = c(0,pi), phi = c(0,2*pi), coordinates = 'spherical')

# volume of a sphere
integral('1', r = c(0,1), theta = c(0,pi), phi = c(0,2*pi), coordinates = 'spherical')

##################################
# Electric charge contained in a region of space
# (see divergence theorem and Maxwell's equations)
#

# electric potential of unitary point charge
V <- '1/(4*pi*r)'

# electric field
E <- -1 %prod% gradient(V, c('r', 'theta', 'phi'), coordinates = 'spherical')

# electric charge
integral(E, r = 1, theta = c(0,pi), phi = c(0,2*pi), coordinates = 'spherical')

# }

Documentation reproduced from package calculus, version 0.1.0, License: GPL-3

### Community examples

Looks like there are no examples yet.