MathGroup Archive 2005

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

Search the Archive

Re: sorting complex number?

  • To: mathgroup at
  • Subject: [mg57469] Re: [mg57461] sorting complex number?
  • From: "David Park" <djmp at>
  • Date: Sun, 29 May 2005 01:03:27 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

complexlist =
    Table[Random[Integer, {-100, 100}] +
        I Random[Integer, {-100, 100}], {50}];

Sort[complexlist, Re[#1] < Re[#2] ||
    (Re[#1] == Re[#2] && Im[#1] < Im[#2]) & ] // TableForm

David Park
djmp at

From: Sean2 [mailto:sshiau2 at]
To: mathgroup at

Hi, I need some help
  I am trying to sort a list of complext number, say, List={a+b*I, c+d*I};
 and I want a>c and b>d. I know that Sort can do this with a small list of
complex numbers, but what I deal with is a list of about 100000 and maybe
more, and it doesn't seem to work with the imaginary part when you just
 Does anyone have a small program to do this?
 thank you

  • Prev by Date: Re: sorting complex number?
  • Next by Date: Re: Limit of list
  • Previous by thread: Re: sorting complex number?
  • Next by thread: Re: sorting complex number?