Skip to main content
1-Visitor
February 12, 2015
Question

Vectors and Matrics

  • February 12, 2015
  • 8 replies
  • 5414 views

If we have an arbitrary vector (V) like the one shown. Using Mathcad we want to order data from lowest to highest like the one shown on right. How would we do that?

image is attached

8 replies

24-Ruby IV
February 12, 2015

VV.png

(My answer as long as everyone in Europe and America are sleeping)

1-Visitor
February 12, 2015

Thanks for answering, however the main idea is to move down through the array comparing adjacent pairs and swapping the values if they are out of order. can you do it this way?

24-Ruby IV
February 12, 2015

Zack Alhashim wrote:

Thanks for answering, however the main idea is to move down through the array comparing adjacent pairs and swapping the values if they are out of order. can you do it this way?

Would you like to know how does the built-in function sort work?

Werner_E
25-Diamond I
February 12, 2015

In case you have difficulties finding a decent sorting algorithm to implement (which is very unlikely, I guess), I'd recommend this site: http://www.sorting-algorithms.com/

You can compare different algorithms, watch animations and look at the algorithm's pseudo code.

Find attached an attempt to create that kind of animiation in Mathcad for the bubble sort algorithm.

You may play around with the attached sheet, but the sort routine is protected for obvious reasons.

24-Ruby IV
February 13, 2015

One KISS-program

Sort.png

PS

We need swap(a, b) function (a procedure) in Mathcad!?