Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Product over an arbitrary index.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg68692] Re: [mg68683] Product over an arbitrary index.
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Thu, 17 Aug 2006 04:17:51 -0400 (EDT)
  • References: <200608160736.DAA06150@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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.