| Author |
Comment/Response |
Mike
|
09/22/04 01:30am
Hi all,
Normally, to get a double sum, I'd use something like this:
Sum[a[i,j], {i,1,3}, {j,1,3}]
However, I have a function (a module, really) where the number of iteration variables depends on the input. I can construct a list which has the right form, but it obviously doesn't work. Here's the 2-variable example:
Sum[a[i,j], {{i,1,3},{j,1,3}}]
It fails because {{i,1,3},{j,1,3}} isn't really an iterator. It just looks like one. :)
Is there _any_ elegant way to compute a sum (or table, product, etc) when you don't know in advance how many iterators there will be? More generally, is there any way to construct an iterator sequence?
I've been all through the online help and google, and I haven't found anything yet...
Thanks,
Mike
URL: , |
|