#' Title
#'
#' @param f
#' @param lower
#' @param upper
#' @param ...
#' @param subdivisions
#'
#' @return
#' @export
#'
#' @examples
finiteIntegrate <- function(f, lower, upper, ..., subdivisions = 200L) {
f <- match.fun(f)
if(!is.finite(lower) | !is.finite(upper)) {
# cat('finiteIntegrate infinite boundary!') # TEST
return(NULL)
}
dx <- (upper - lower) / subdivisions
x <- seq(lower,upper,length=subdivisions)
return(sum(f(x, ...)*dx))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.