Question: efficient sums evaluation?

probably I should not have written my question as a comment here
http://www.mapleprimes.com/forum/how-to-evaluate-faster, si I now put it as a new topic. Thanks for your time and help.

The problem is to evaluate as effectively as possible an n-fold sum of N additions, e.g., for n=3

FF := proc (N) options operator, arrow; evalhf(add(add(add((1/2*1/3*1/4)*(1/2)^j*(3/4)^g*(2/3)^i/(.4*i+.4+.1*j+.1+.3*g+.3), i = 0 .. N), j = 0 .. N), g = 0 .. N)) end proc

On my PC it takes about a second to evaluate it for N=80. My first code in R needed 20 secs to do teh same, however, I was advised that a much faster version is possible if I remove loops and vectorize. Here is the R code:

start <- Sys.time()
z <- expand.grid(y=0:80,x=0:80,g=0:80)
sum1 <- sum(1/2*(1/2)^z$y*1/3*(2/3)^z$x*1/4*(3/4)^z$g/(0.4*z$x+0.4+0.1*z$y+0.1+0.3*z$g+0.3))
sum1
Sys.time() - start

It takes it 0.6 sec to evaluate the nested sum. I wonder can Maple do better than R by using similar or any other tricks? I think there must be something interesting. Thanks.

Please Wait...