0

I am currently writing a piece of code that will order complex numbers, however I am not sure how to order them. For example, if I am given the numbers: 6, 3+4i, -4, 1+i and 0, how would these be ordered?

Is it sufficient just to take the magnitude of each number and order them that way?

Thanks for the help.

2 Answers2

0

This depends entirely on your implementation. Note that when using magnitude for ordering that different elements can have the same magnitude. E.g. $i$ and $1$.

Ruben
  • 2,082
0

It's up to you, since there is no standard ordering in the complex field. You could order them by magnitude, or you could - for example - use the lexicographic order: w > z if the real part of w is bigger than the real part of z. If the two real parts are equal, w > z if the imaginary part of w is bigger than the imaginary part of z.

Tomoms
  • 1