[R] writing an equation with multiple summation

Maram SAlem marammagdysalem at gmail.com
Tue Sep 29 16:59:23 CEST 2015

My first problem is that the counters involved in the summation are
dependent, For instance for each r[i], 0<r[i]< m-(r[1] +r[2]+...+r[i-1])
 so I tried using seq() and for loops to express all the possible
combinations but I couldn't.

On 28 September 2015 at 17:26, Maram SAlem <marammagdysalem at gmail.com>

> 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 g(r[2]))......(sum from
> r[m] to g(r[m]))] {the sum is over some complicated expression in
> r[1],r[2],.....,r[m]},
> where g(r[i]) = m- (r[1] +r[2]+...+r[i-1])
> Any suggestions for some function or a package that can help me with this?
> Many Thanks,
> Maram

	[[alternative HTML version deleted]]

More information about the R-help mailing list