Skip to main content
23-Emerald V
Sep 23, 2025 9:42 PM UTC
Question

Sorting Complex Numbers

Reference https://community.ptc.com/t5/Mathcad/Sum-in-Mathcad-Prime/m-p/1035397/highlight/true#M218879

 

Following on from the discussion re minima and maxima of various Mathcad data types, I gave up on trying to fault-find my original (messy) complex sort worksheet, and present the following simplified Mathcad Prime 11 version for your edification.  It's based on merge sort.

 

2025 09 23 H.png

 

zv is the complex-valued vector to sort, and I've rerun the results in MATLAB.

.

Stuart  

5 replies

Werner_E
25-Diamond I
Sep 23, 2025 10:48 PM UTC

What am I missing?

Werner_E_1-1758667709640.png

 

 

Translate
Werner_E
25-Diamond I
Sep 24, 2025 5:46 AM UTC

A quick hack to fix the problem with 1-column matrices:

Werner_E_1-1758692285018.png

Werner_E_4-1758692767567.png

Translate
23-Emerald V
Sep 24, 2025 10:06 AM UTC

Yes, effectively the same solution.   Great minds ... 😈

 

Then I realised that, in terms of testing, I'm busy doing all the barking when I've got a perfectly good laptop that can do that for me:

 

2025 09 24 C.png

 

Stuart

Translate