Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*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 1996

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

Search the Archive

Re: Reordering lists?!

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4552] Re: Reordering lists?!
  • From: Gennady <stupakov at slac.stanford.edu>
  • Date: Wed, 7 Aug 1996 04:17:59 -0400
  • Organization: SLAC
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4tkbna$q63 at dragonfly.wolfram.com> Paul Abbott,
paul at physics.uwa.edu.au writes:
>Andre and Alain wrote:
>
>>  Hey! I have a list of Numbers, 1 to 4, and wish to rescale them so
>> that 1 replkaces 4 and 3 replaces 2 and 2 replaces 3 etc. I made a 
>> little code to do this on an element per element basis and it doesn't 
>> seem to do
>> it! Could someone let me know what I'm doing wrong or whether it's a 
>> Mma problem? Thanks


After having read different answers to this problem, I noticed that
the simplest way to get the result somehow evaded the respectable
mathgroupers. Here it is:

In[1]:=
list={2, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 2, 2, 1, 1, 3, 1, 1, 2, 1, 2, 1,
2, 1, 1,
1, 1, 2, 1, 2, 1, 3, 1, 
  2, 2, 1, 2, 1, 2, 3, 2, 4, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 2, 2, 1, 2, 1,
2,
3, 2, 2, 2, 1, 2, 1, 
  2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1};

In[2]:=
5-list

Out[2]=
{3, 4, 4, 4, 4, 3, 4, 3, 4, 4, 4, 3, 3, 4, 4, 2, 4, 4, 3, 
 
  4, 3, 4, 3, 4, 4, 4, 4, 3, 4, 3, 4, 2, 4, 3, 3, 4, 3, 
 
  4, 3, 2, 3, 1, 4, 4, 4, 4, 3, 4, 4, 4, 4, 3, 3, 3, 4, 
 
  3, 4, 3, 2, 3, 3, 3, 4, 3, 4, 3, 3, 3, 3, 3, 3, 4, 4, 
 
  4, 4, 4, 4, 3, 3, 3, 4}

Regards,
Gennady.

==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: Horner scheme function ?
  • Next by Date: Re: Revealing HiddenSurfaces
  • Previous by thread: Re: Re; Reordering lists?!
  • Next by thread: Re: Reordering lists?!