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 2005

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

Search the Archive

Re: Sorting complex points

  • To: mathgroup at
  • Subject: [mg55881] Re: Sorting complex points
  • From: "" <petsie at>
  • Date: Sat, 9 Apr 2005 03:55:16 -0400 (EDT)
  • Organization: 1&1 Internet AG
  • References: <d356km$ovn$>
  • Sender: owner-wri-mathgroup at

OT wrote:
> Hi all,
> 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?
> I tried to define Angle[z] as a piecewise funztion, but I still don't 
> understand how to use it with Sort...
> Thanks,
> andrea
Have a look at the help for Sort[list,p]. p is a function which takes
two arguments and returns True or False. This relation defines the
order. You want to compare the Arg[] of two complex numbers, so the
following should do what you want:

(*lookAt[] visualizes the list of complex numbers*)

and now use Sort[] to get an open star-shaped plot


Peter Pein

  • Prev by Date: Re: Sorting complex points
  • Next by Date: Re: Re: spiral cipher
  • Previous by thread: Re: Sorting complex points
  • Next by thread: Re: Sorting complex points