powered by
Perform numerical integration by Simpson's rule or the trapezoidal rule.
simp(f, a, b, tol = 0.00000001, max.step = 1000, ...)
The integral of f from a to b.
f
a
b
The integrand; must be a vectorized function.
Lower limit of integration.
Upper limit of integration.
Tolerance for choosing the number of grid points.
Log base 2 of the total number of grid points.
Other arguments passed to the integrand, f.
Iterately doubles the number of grid points for the numerical integral, stopping when the integral decreases by less than tol.
tol
stats::integrate()
f <- function(x) x*x*(1-x)*sin(x*x) I1 <- trap(f,0,2) I2 <- simp(f,0,2)
Run the code above in your browser using DataLab