Re: Sorting complex points
- To: mathgroup at smc.vnet.net
- Subject: [mg55888] Re: [mg55874] Sorting complex points
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 9 Apr 2005 03:55:25 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
Needs["Graphics`"];
mlp[data_List]:=MultipleListPlot[{Re[#],Im[#]}&/@data,
SymbolLabel->{Range[Length[data]]},
PlotRange->All,Ticks->None];
data=Table[(2*Random[]-1)+I*(2*Random[]-1),{10}];
mlp[data];
sortedData=Sort[data, Arg[#1]<Arg[#2]&];
mlp[sortedData];
Bob Hanlon
>
> From: OT <montoz at iol.it>
To: mathgroup at smc.vnet.net
> Date: 2005/04/08 Fri AM 01:37:06 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg55888] [mg55874] Sorting complex points
>
> 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
>
>