Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: Lists and rules

  • To: mathgroup at smc.vnet.net
  • Subject: [mg66496] Re: Lists and rules
  • From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
  • Date: Wed, 17 May 2006 03:29:28 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <e4bj1m$1b9$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

something like

t1 = Table[Random[Integer, {1, 3}], {100}];

s[j_] := MapIndexed[If[j === #1, #2[[1]], 0] &, 
t1]

Regards
  Jens

"Thomas Schmelzer" <thomas.??? at balliol.ox.ac.uk> 
schrieb im Newsbeitrag 
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
|
|
| 



  • Prev by Date: fixing contours
  • Next by Date: Re: compound symmetrical primes
  • Previous by thread: Re: Lists and rules
  • Next by thread: Re: Lists and rules