SimpsonInt {asymmetry.measures} | R Documentation |
Simpson integration
Description
Implements simpson's extended integration rule.
Usage
SimpsonInt(xin,h)
Arguments
xin |
A vector of design points where the integral will be evaluated. |
h |
Assuming a<b and n is a positive integer. |
Details
Simpson's extended numerical integration rule is implemented for n+1
equally spaced subdivisions (where n
is even) of [a, b]
as
\int_{a}^{b} f(x)\, dx = \frac{h}{3} \left \{ f(a) + 4f(x_1) + 2f(x_2) + 4f(x_3) + 2f(x_4) + ... + 4f(x_{n-1}) + f(b)\right \}
where hx=(b-a)/n
and x_i=a+ihx
. Simpson's rule will return an exact result when the polynomial in question has a degree of three or less. For other functions, Simpson's Rule only gives an approximation.
Value
A scalar, the approximate value of the integral.
Author(s)
Dimitrios Bagkavos and Lucia Gamez Gallardo
R implementation and documentation: Dimitrios Bagkavos <dimitrios.bagkavos@gmail.com> , Lucia Gamez Gallardo <gamezgallardolucia@gmail.com>
References
Examples
x.in<- seq(0,pi/4,length=5)
h.out <- pi/8
SimpsonInt(x.in,h.out)