jose romero wrote:
> Hey fellas:
>
> I would like to integrate the following function:
>
> integrand <- function (x,t) {
> exp(-2*t)*(2*t)^x/(10*factorial(x))
> }
>
> with respect to the t variable, from 0 to 10.
> The variable x here works as a parameter: I would like to integrate the said
> function for each value of x in 0,1,..,44.
>
> I have tried Vectorize to no avail.
>
>
Will this do?
sapply(0:44,function(x)integrate(integrand,x=x, lower=0, upper=10)$value
--
O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907
______________________________________________
[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.