Learn R Programming

pracma (version 0.5-3)

romberg: Romberg Integration

Description

Romberg Integration

Usage

romberg(f, a, b, kmax = 16, tol = .Machine$double.eps^(2/3), ...)

Arguments

f
function to be integrated.
a, b
end points of the interval.
kmax
maximum number of iterations
tol
requested tolerance.
...
variables to be passed to the function.

Value

  • List of value and absolute error.

Details

Simple Romberg integration with an explicit Richardson method applied to a series of trapezoidal integrals.

References

Mathews, J. H., and K. D. Fink (1999). Numerical Methods Using Matlab. Third Edition, Prentice Hall.

See Also

quadQK15

Examples

Run this code
romberg(sin, 0, pi)  #  2.000000000000001 , rel.error: 6.6e-13
romberg(exp, 0, 1)   #  1.718281828459044 , rel.error: 3.6e-13
                     #  1.718281828459045 , i.e. exp(1) - 1

Run the code above in your browser using DataLab