Hi,

  The following works.

> f2
function(z)
{
  f1 <- function(t)
  {
    z*t + z*t^2
  }
  return(f1)
}
> sapply(1:5,function(x)integrate(f2(x),0,1)$value)
[1] 0.8333333333 1.6666666667 2.5000000000 3.3333333333 4.1666666667



--
View this message in context: 
http://r.789695.n4.nabble.com/integrate-with-vector-arguments-tp4703906p4703925.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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