Hello all R users

I want to calculate this univariate integral:
exp(-x)*sum(y^x)  respect to x  from 0 to 3  where y is a vector y=(2,3,5).
In fact, the original y vector has a large number of elements but I propose
with 3 elements.

I know that I can resolve this problem doing

fun <- function(x) exp(-x)*(2^x+3^x+5^x)
integrate(fun,0,3)

When the y vector has a large number of elements the last solution is not
possible,
if I use this another way I can not obtain the true answer

   y <- c(2,3,5)
fun1 <- function(x) exp(-x)*sum(y^x)
integrate(fun1,0,3)

Someone could give me a help with the problem?
Thanks.


Freddy Hernández Barajas

	[[alternative HTML version deleted]]

