You could approximate it with splines and then integrate that: x <- 0:10/10 f <- function(x) 1 + x + x^2 + x^3 + x^4 y <- f(x) fs <- splinefun(x, y) integrate(fs, 0, 1) integrate(f, 0, 1)
On 11/8/06, Xiaofan Cao <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm trying to integrate f(x) over x where f(x) does not have a close form > but only numerical values at certurn knots of x. Is there a way that I can > use any generical R function (such as integrate) or any package to do so? > > Thanks! I appreciate your time. > > Best Regards, > Martha Cao > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
