Return a vector of Simpson's Composite numerical integration
coefficients.
Usage
simpsonCoefs(n)
Value
A vector of Simpson Composite rule coefficients
suitable for numeric integration. The return is a vector of
integers alternating between 4 and 2, with 1's on each end.
Arguments
n
Number of coefficients, which is the number of points
at which the function of interest is evaluated. The number of
intervals is (n-1)/2. This number must be odd.
Details
Let x be an vector of equally spaced points in the domain
of a function f (equally spaced is critical).
Let y = f(x). The numeric integral of f from min(x)
to max(x) is
sum(simpsonCoefs(length(y)) * y) * (x[2] - x[1]) / 3.