MathGroup Archive 2006

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

Search the Archive

Re: Lists and rules


"Thomas Schmelzer" <thomas.??? at balliol.ox.ac.uk>
news:e4bj1m$1b9$1 at smc.vnet.net...
> Experts,
> I would like to produce a decent piece of code for one of my projects.
> I am constructing a list of sets
>
> S_1, S_2 and S_3
>
> where S_j = { m  ,   T[[1,m]] == j, m running from 1 to 100}
>
> T[[1,*]] is a row vector containing only 1, 2 and 3.
>
> I could setup a for loop and work with append. I have done that, but I
> believe this approach is neither efficient nor elegant. Any hints for a
> newbie?
>
> Best,
> Thomas
>
>
>
Hi Thomas,
a glance at Table[] command in the Help browser could help you.
Also make practice with this:
Range[i_max]  generates the list {1, 2, . , i_max}

Table[expr, {i_max}]  generates a list of  i_max copies of expr



Hope this helps,

    ~Scout~




  • Prev by Date: Re: compound symmetrical primes
  • Next by Date: RE: ContourListPlot
  • Previous by thread: Re: Lists and rules
  • Next by thread: Re: Lists and rules