MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Product over an arbitrary index.


On Aug 16, 2006, at 3:36 AM, quantieny at gmail.com wrote:

> I have a function f(x,y)   that I would like to compute the product
> over indices i,j
> where i goes from an arbitrary list {1,4,3}  and j goes 1 to m.

This statement is a little unclear, are you taking the product f[i,j]  
where i is the sequence {1,4,3}, j is 1..m?

The way to do this in Mathematica is to store the sequence for i in a  
list and use the index of the iterator in product to get the  
appropriate sequence element.  If your sequence is very long but you  
have a generating function, just pass the index to the generating  
function.

> Is this possible in mathematica the function Product itself seems to
> only work over a continous sequence and it is not clear how I can use
> two set of indices.

You can specify as many indices as you want for example

iSequence={1,4,3};
m=50;
Product[f[iSequence[[i]],j],{i,Length[iSequence]},{j,m}]

> Additionally can I specify the product over an intersection or
> complement of a list?.

Using the technique above you can do pretty much anything you want,  
all you need is a function that maps an index to a sequence value.

Regards,

Ssezi


  • Prev by Date: RE: position lists
  • Next by Date: Re: Product over an arbitrary index.
  • Previous by thread: Product over an arbitrary index.
  • Next by thread: RE: Product over an arbitrary index.