Description Usage Arguments Value Author(s) References Examples
View source: R/simpson_coefficients.R
Takes an increasing, equally spaced numeric vector 'x' and returns Simpson's Rule cofficients used in numerical integration.
1 2 3 4 5 6 | simpson_coefficients(
x,
return_list = FALSE,
diff_TOL = 0.001,
suppress_warning = TRUE
)
|
x |
numeric vector of abcissa values in ascending order. |
return_list |
logical whether to return computed coefficients in a vector or the separate components in a list. |
diff_TOL |
numeric measure of how uneven the x-values can be (they should be evenly spaced). |
suppress_warning |
logical for whether to return warning. |
vector of numeric cofficients if return_list is TRUE; list of integers coefficients and interval size "h" separately if return_list is FALSE
Bill Forrest <forrest@gene.com>
Bill Forrest forrest@gene.com
1 2 3 4 5 | x <- seq(0, 1, by = .1); y <- 6 * x * ( 1 - x )
w <- simpson_coefficients( x )
print( sum( w * y ) )
simpson_coefficients( x, return_list = TRUE )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.