Services & Resources / Wolfram Forums
MathGroup Archive
*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
  • Subject: [mg52515] Re: sort procedure
  • From: Bill Rowe <readnewsciv at>
  • Date: Tue, 30 Nov 2004 05:24:35 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 11/29/04 at 1:22 AM, tarpanelli at (paolo ) wrote:

>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

And how did you use Sort? If you correctly specify the ordering function then Sort should work fine. For example:

data = Table[{Random[], 1/Random[]}, {5}]; 
Sort[data, OrderedQ[{Last[#1], Last[#2]}] & ]

{{0.0853819963788964,  1.1126376511652434}, 
 {0.12440319976153577, 1.4220646967618538}, 
 {0.8122355791743191,  4.349104929218276}, 
 {0.6792157180842403,  6.721164898417004}, 
 {0.7037212527850069, 11.641624761351718}}
To reply via email subtract one hundred and four

  • Prev by Date: Re: Proving inequalities with Mathematica
  • Next by Date: Animating Solutions of NDSolve with respect to Initial Conditions
  • Previous by thread: Re: sort procedure
  • Next by thread: Re: sort procedure