Re: [R] writing an equation with multiple summation

2015-09-29 Thread Maram SAlem
My first problem is that the counters involved in the summation are dependent, For instance for each r[i], 0 wrote: > Dear All, > > I'm trying to write and evaluate an equation which involves multiple > summations but can't figure out how to do it. > > I've an numeric vector r > r<-vector(mode = "

Re: [R] writing an equation with multiple summation

2015-09-28 Thread Jeff Newmiller
The brute force answer involves for loops or apply functions, with or without defining your own functions for calculating terms. More optimized methods usually require understanding the specific structure of the summations and unwinding them with functions like expand.grid. For more specific hel

[R] writing an equation with multiple summation

2015-09-28 Thread Maram SAlem
Dear All, I'm trying to write and evaluate an equation which involves multiple summations but can't figure out how to do it. I've an numeric vector r r<-vector(mode = "numeric", length = m) and I have multiple summations (for ex.) of the form: [(sum from r[1]=0 to g(r[1])) (sum from r[2] =0 to