trapezoid_adpt: Adapted trapezoidal integration

Description Usage Arguments Details References See Also Examples

Description

The function returns a vector of length 2 whose first element is the integration and whose second element is the number of function evaluations required.

Usage

1
trapezoid_adpt(ftn, a, b, tol = 10^(-8), trace = FALSE)

Arguments

ftn

a function of single variable.

a

lower bound of the integration. Must be finite.

b

upper bound of the integration. Must be finite and assume b > a.

tol

the partition used is recursively refined until the estimate on successive partitions differs by at most tol.

trace

if trace is TRUE then intermediate results are printed.

Details

The variable tol is the tolerant error of the approximated integration and the partitions are subdivided. t.recursion is the function that recursively improves the partitions such that the summation of the errors is less than the tolerant error.

References

Owen Jones,Robert Maillardet,Andrew Robinson (2014).Introduction to Scientific Programming and Simulation Using R ; Second Edition

See Also

integrate

Examples

1
2
ftn1 <- function(x) return(4 * x^3)
trapezoid_adpt(ftn1, 0, 1, 0.00001, trace = FALSE)

david850803/MC.makes.perfect documentation built on June 16, 2019, 12:04 a.m.