Last chance! 50% off unlimited learning
Sale ends in
quadl(f, xa, xb, tol = .Machine$double.eps^0.5, trace = FALSE, ...)
f
. The function f
needs to be vectorized though this could be changed
easily.
quad
# options(digits=15)
f <- function(x) x * cos(0.1*exp(x)) * sin(0.1*pi*exp(x))
quadl(f, 0, 4) # 1.2821290743501
integrate(f, 0, 4)
# 1.28212907435010 with absolute error < 4.1e-06
## Not run:
# xx <- seq(0, 4, length.out = 200)
# yy <- f(xx)
# plot(xx, yy, type = 'l')
# grid()## End(Not run)
Run the code above in your browser using DataLab