MathGroup Archive 2006

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

Search the Archive

Re: product formula in mathematica


The iterator (i.e. the second argument of Product) has to be a standard
iterator. Therefore your input will not work.

But you can write your own product function, which does what you want.
If you define

   myProduct[f_, arr_] := Apply[Times, Thread[f[arr]]]


   myProduct[Sin, {1, 3, 4, 9, 12}]

will give

   Sin[1] Sin[3] Sin[4] Sin[9] Sin[12]

Best Regards
Norbert Marxer

frou wrote:
> 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.
> Thanks

  • Prev by Date: Re: Several functions in a single 2D-plot
  • Next by Date: Re: distance function
  • Previous by thread: RE: product formula in mathematica
  • Next by thread: RE: product formula in mathematica