romberg {cmna}R Documentation

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

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

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)


[Package cmna version 1.0.5 Index]