MathGroup Archive 2004

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

Search the Archive

Re: sort procedure


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