[R] multiple summation

2004-03-16 Thread Paolo Bulla
Hello, I have to compute a multiple summation (not an integration because the independent variables a are discrete) for all the values of a function of several variables f (x_1,...,x_n), that is sum ... sum f(x_1,...,x_n) x_1 x_n have you some suggestion? Is it possible? I know that for

Re: [R] multiple summation

2004-03-16 Thread Uwe Ligges
Paolo Bulla wrote: Hello, I have to compute a multiple summation (not an integration because the independent variables a are discrete) for all the values of a function of several variables f (x_1,...,x_n), that is sum ... sum f(x_1,...,x_n) x_1 x_n have you some suggestion? Is it possible?

Re: [R] multiple summation

2004-03-16 Thread Giovanni Petris
sum, I guess, as in x - seq(0,2*pi,length=10) y - x - seq(0,2*pi,length=10) X - cbind(x,y) sum(sapply(1:NROW(X), function(i) sin(X[i,1])*cos(X[i,2]))) [1] 1.991599e-16 There may be more efficient ways to deal with the `sapply' part, especially if your function is vectorized. HTH,

RE: [R] multiple summation

2004-03-16 Thread Ted Harding
On 16-Mar-04 Paolo Bulla wrote: Hello, I have to compute a multiple summation (not an integration because the independent variables are discrete) for all the values of a function of several variables f(x_1,...,x_n), that is sum ... sum f(x_1,...,x_n) x_1 x_n have you some