Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*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 2004

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

Search the Archive

Re: sort procedure

  • To: mathgroup at smc.vnet.net
  • Subject: [mg52509] Re: sort procedure
  • From: "Steve Luttrell" <steve_usenet at _removemefirst_luttrell.org.uk>
  • Date: Tue, 30 Nov 2004 05:24:21 -0500 (EST)
  • References: <coefho$rei$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

The Sort function with a user-defined sort function is the most flexible way 
of doing this sort of thing.

Here is an example:

Define a data set with 10 paired observations:

s=Map[Reverse,Partition[Table[Random[],{10}],2,1]]

{{0.12873,0.696262},{0.884034,0.12873},{0.576172,0.884034},{0.707075,
    0.576172},{0.340009,0.707075},{0.687427,0.340009},{0.513483,
    0.687427},{0.99377,0.513483},{0.78212,0.99377}}

Sort it as specified:

Sort[s, #2[[2]] > #1[[2]] & ]

{{0.884034,0.12873},{0.687427,0.340009},{0.99377,0.513483},{0.707075,
    0.576172},{0.513483,0.687427},{0.12873,0.696262},{0.340009,
    0.707075},{0.576172,0.884034},{0.78212,0.99377}}

Steve Luttrell

"paolo " <tarpanelli at libero.it> wrote in message 
news:coefho$rei$1 at smc.vnet.net...
> If I have a data serie of n paired observations (x_t,x_t-1) ordered 
> according to time, how can i re-order this serie according to the size of 
> x_t-1
>
> The procedure Sort it seems it does not work well.
> anyone has suggestions?
> thanks
>
> P.
>
>
>
> ____________________________________________________________
> Libero ADSL: navighi gratis a 1.2 Mega, senza canone e costi di 
> attivazione.
> Abbonati subito su http://www.libero.it
>
> 



  • Prev by Date: Re: sort procedure
  • Next by Date: Re: canonical mathematical expression represenation?
  • Previous by thread: Re: sort procedure
  • Next by thread: Proving inequalities with Mathematica