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
>
>