MathGroup Archive 2006

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

Search the Archive

Re: product formula in mathematica


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.

Times @@ MapThread[f[Subscript[x, #1]] & , {{1, 3, 4, 9}}]

--> f[Subscript[x, 1]]*f[Subscript[x, 3]]*f[Subscript[x, 
4]]*f[Subscript[x, 9]]

Times @@ MapThread[f[x[#1]] & , {{1, 3, 4, 9}}]

--> f[x[1]]*f[x[3]]*f[x[4]]*f[x[9]]

http://documents.wolfram.com/mathematica/functions/Apply
http://documents.wolfram.com/mathematica/functions/MapThread

HTH,
Jean-Marc


  • Prev by Date: Re: calculate Recurrence Equations
  • Next by Date: NonlinearFit + Sums
  • Previous by thread: RE: product formula in mathematica
  • Next by thread: question?