simpson {bccp}R Documentation

Computing integration numerically through the Simpson's method

Description

Computes the integration for a real-valued function.

Usage

simpson(fun, lb, ub, N = 100)

Arguments

fun

Integrand expression

lb

Lower bound of integration.

ub

Upper bound of integration.

N

An even integer value indicating the number of subdivisions for applying Simpson's integration method.

Author(s)

Mahdi Teimouri

References

E. Suli and D. Mayers 2003. An Introduction to Numerical Analysis, Cambridge University Press.

Examples

    fun <- function(x) 1/sqrt( 2*pi*sigma^2 )*exp( -.5*(x-mu)^2/sigma^2 )
    mu <- 0
 sigma <- 1
    lb <- 0
    ub <- Inf
     N <- 100
simpson(fun = fun, lb = lb, ub = ub, N = N)

[Package bccp version 0.5.0 Index]