powered by
Use Simpson's rule to integrate a function
simp(f, a, b, m = 100)
function to integrate
the a-bound of integration
the b-bound of integration
the number of subintervals to calculate
the value of the integral
The simp function uses Simpson's rule to calculate the integral of the function f over the interval from a to b. The parameter m sets the number of intervals to use when evaluating. Additional options are passed to the function f when evaluating.
simp
f
a
b
m
Other integration: adaptint, gaussint, giniquintile, mcint, midpt, revolution-solid, romberg, simp38, trap
adaptint
gaussint
giniquintile
mcint
midpt
revolution-solid
romberg
simp38
trap
Other newton-cotes: adaptint, giniquintile, midpt, romberg, simp38, trap
# NOT RUN { f <- function(x) { sin(x)^2 + cos(x)^2 } simp(f, -pi, pi, m = 10) simp(f, -pi, pi, m = 100) simp(f, -pi, pi, m = 1000) # }
Run the code above in your browser using DataLab