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

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

Search the Archive

Re: Sorting complex points

  • To: mathgroup at smc.vnet.net
  • Subject: [mg55886] Re: Sorting complex points
  • From: Marcus Stollsteimer <marcus314 at yahoo.com>
  • Date: Sat, 9 Apr 2005 03:55:22 -0400 (EDT)
  • Organization: Comp.Center (RUS), U of Stuttgart, FRG
  • References: <d356km$ovn$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

OT wrote:

> I'm trying to sort lists of random complex points on the unit circle
> using their angles as criterion to sort them: I mean, if
> z=Cos[a]+I*Sin[a] and w=Cos[b]+I*Sin[b]( 0<=a,b<2*Pi ),
> I want z<w if a<b;
> 
> how can i do that?

Hi, try


MyArg[x_] := Mod[Arg[x], 2 Pi]

list={0.625162 + 0.835834 I,0.502244 + 0.43736 I}

sortedlist = Sort[list, MyArg[#1] < MyArg[#2] &]


Regards,
Marcus

-- 
Kant was right: The mind imposes order.
It also tells you how much to tip. -- W. Allen


  • Prev by Date: Problems with Derivative, Piecewise, Assuming
  • Next by Date: Re: Newly Released Mathematica 5.1 Delivers Unmatched Performance for Handling Data
  • Previous by thread: Re: Sorting complex points
  • Next by thread: Re: Sorting complex points