Bill Allombert on Sat, 04 Jun 2011 11:57:53 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Multiple Summation Question

On Sat, Jun 04, 2011 at 03:09:39AM +0000, McLaughlin, James wrote:
> >Well, you can start by defining a function f that takes i, [j_1,...,j_k] and the other parameters
> >and returns f_i (j_1,j_2, ..., j_i, other parameters).
> >At this point you should be able to finish with forvec.
> Displaying my ignorance again, but I don't see how to define such a function f in k variables j_1,j_2, ..., j_k when k is a parameter that changes.

You missed the brackets above: the idea was to pass the variables as a single vector

> Just to keep it simple, set j_0=0, and 
>  F(k)=
> Sum_{j_1=1}^1 Sum_{j_2=1}^2 ... Sum_{j_k=1}^k 
> Product_{i=1}^k f_i (j_1,j_2, ..., j_i)
> where
> f_i (j_1,j_2, ..., j_i) = 1+ j_1*j_2*...*j_i + 2^(i*j_i - (i-1)*j_{i-1}).
> I can write a program to evaluate this kind of expression for any particular k, but I still can't really see how to do it for every k.

Define f as follow:


(you will have to fix f for i=1)