On Fri, Nov 9, 2012 at 10:02 AM, Cleber N.Borges <kle...@yahoo.com.br>wrote:

> Hello useRs,
>
> The results of the SORT function differ from Scilab/Matlab for Complex
> Numbers in my example.
> This design is the desirable in R?
>

Well, it's deliberate and documented.

R sorts complex numbers by real part then by imaginary part.  Matlab,
according to its documentation, sorts by modulus then phase.

There isn't a unique way to sort complex numbers, so you're going to get
differences.  Personally, I think the R method is more straightforward,
since you don't need to decide and remember where the branch cut goes on
the phase coordinate.

   -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to