cmna (version 1.0.3)

romberg: Romberg Integration

Description

Romberg's adaptive integration

Usage

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

Value

the value of the integral

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.

See Also

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

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

Examples

Run this code
# NOT RUN {
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)

# }

Run the code above in your browser using DataLab