MathGroup Archive 2006

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

Search the Archive

RE: product formula in mathematica


Hi,

> Hi I am interested in doing a product over a set of indices 
> that are not continuous
> Product [ f(x_i) , { x_i, 1,3,4,9}]     Is this possible it appears
> that the iterator wouldonly take sequences such as 1...10 etc.

Depends exactly what you want ....

There is a form of the product function that takes a step, eg.

	Product[i, {i, 1, 10, 2}]

However, if you want something particularly unusual, then you can simulate
Product by applying Times[] to a list, eg.

	Times @@ Range[1, 10, 2]

Or

	Times @@ (# &) /@ {2, 3, 5, 7, 11, 13, 17, 19}

Which should be the same as

	Product[Prime[x], {x, 8}]

Regards,

Dave.


  • Prev by Date: Re: distance function
  • Next by Date: RE: product formula in mathematica
  • Previous by thread: Re: product formula in mathematica
  • Next by thread: RE: product formula in mathematica