Romberg Integration

Share:

Description

Romberg's adaptive integration

Usage

1
romberg(f, a, b, m, tab = FALSE)

Arguments

f

function to integrate

a

the lowerbound of integration

b

the upperbound of integration

m

the maximum number of iterations

tab

if TRUE, return the table of values

Details

The romberg function uses Romberg's rule to calculate the integral of the function f over the interval from a to b. The parameter m sets the number of intervals to use when evaluating. Additional options are passed to the function f when evaluating.

Value

the value of the integral

See Also

Other integration: adaptint, gaussint, giniquintile, mcint, midpt, revolution-solid, simp38, simp, trap

Other newton-cotes: adaptint, giniquintile, midpt, simp38, simp, trap

Examples

1
2
3
4
f <- function(x) { sin(x)^2 + log(x)}
romberg(f, 1, 10, m = 3)
romberg(f, 1, 10, m = 5)
romberg(f, 1, 10, m = 10)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.