View source: R/num_integrate.R
num_integrate | R Documentation |
The function returns a single numeric scalar as a result for the integration between upper and lower bounds
num_integrate(X,Y, xmin=2, xmax=5)
num_integrate(X,Y,xmin=2, xmax=5, type='avg')
num_integrate(X,Y, xmin=2, xmax=5, type='left')
num_integrate(X,Y, xmin=2, xmax=5, type='right')
X |
A numeric vector containing the X values of the curve you want to integrate |
Y |
A numeric vector containing the Y values of the curve you want to integrate |
xmin |
The lower bound of the integral. |
xmax |
The upper bound of the integral |
type |
The type defines the kind of reimann integral and is ordinaarily set to "avg". |
The X vector should include the bounds of xmax and xmin or else an error will be thrown. Look at the arguments section above.
The funcion is by default set to type='avg'. Hence, if needed, this factor can be changed to 'left' or 'right'.
The no. of points within the bounds of xmax and xmin should at least be 4.
The sampling density in the dataset should allow on an average for at least 4 points within the xmax and xmin window length.
The function always returns a numeric scalar
Chitran Ghosal
https://en.wikipedia.org/wiki/Riemann_integralReimann Integration
X <- seq(0,10, by=0.001)
Y <-2*X
num_integrate(X, Y, xmin=2, xmax=8)
num_integrate(X, Y, xmin=2, xmax=8, type='avg')
num_integrate(X, Y, xmin=2, xmax=8, type='left')
num_integrate(X, Y, xmin=2, xmax=8, type='right')
num_integrate(X,Y, xmin=2, xmax=2)
num_integrate(X,Y, xmin=6, xmax=6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.