Thanks,Hans!

I agree that this is a good way of solving this problem. 

Here is another way. Instead of defining a vector of uni-dimensional
functions and trying to integrating
each component (a uni-dimensional function), we can do something below

my.integrand<-function(x,k)
{
return(f[x,k]) ## use matrix to represent the sequence of uni-dimensional
functions
}

my.integral<-function(k) ## k=1,...,5000 denotes the function labels
{
return(integrate(my.integrand,lower=...,upper=...,k)$value)
}

When calculating the integrals, just perform

sapply(1:5000, my.integral)

This is a way of avoiding loops but the computing time needs to be carefully
examined.

Jeff



--
View this message in context: 
http://r.789695.n4.nabble.com/efficiently-finding-the-integrals-of-a-sequence-of-functions-tp4179452p4183323.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org 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.

Reply via email to