Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Iterator problem.

  • To: mathgroup at
  • Subject: [mg52353] Re: Iterator problem.
  • From: "Steve Luttrell" <steve_usenet at>
  • Date: Wed, 24 Nov 2004 02:32:25 -0500 (EST)
  • References: <cnuoj6$squ$>
  • Sender: owner-wri-mathgroup at

This does what you want (I assume you want to suppress cases that are 
symmetrically related, so I use 1<=i<=j<=k<=3):

Table[a[i] + a[j] + a[k], {k,1,3},{j,1,k},{i,1,j}]//Flatten

In Mathematica the outermost iterator is the one on the LEFT.

Steve Luttrell

"Robert G. Wilson v" <rgwv at> wrote in message 
news:cnuoj6$squ$1 at
> Hello,
> I am having a problem with iterators in Mathematica.
> I have a sequence of integers defined by a[n]. I wish to build a table
> of integers out of the above such that this table only contains integers 
> of
> the form a(i)+a(j)+a(k).
> I tried Table[a[i] + a[j] + a[k], {k, 1, 3}, {j, i, k}, {i, 1, j}] but
> the iterators do not have appropriate bounds.
> Any help would be greatly appreciated.
> Sincerely,
> Bob.

  • Prev by Date: integration using PSQL algorithm
  • Next by Date: Re: UnitStep
  • Previous by thread: Re: Iterator problem.
  • Next by thread: Re: Iterator problem.