Hello, I am trying to sort a list for a program that contains numbers. After running SortA, the list reads as {0, 2π, 3π/2, π/2). How can I get it to read as {0, π/2, 3π/2, 2π), the correct numerical order?
You'd think it would be clever enough to sort symbolic numeric expressions properly.

The quickest workaround I can think of is the following:

Code:
{0, 2π, 3π/2, π/2}→lst
approx(lst)→lst2
SortA lst2,lst

This creates a second list with the approximate floating-point equivalents of the first list (which the 89 should sort properly). Then it sorts the second list, arranging the elements in the first list to match, resulting in the correct order for the first list:

{0, π/2, 3π/2, 2π}
No idea how this works, but ok.
I also get a dimension error here. I don't really know how much to give you because crit can be of any size.

FIXED


Code:

newList(0)→test
For i,1,dim(crit)    //The error occurs here
 If crit[i]=-(infinity) Then
  /* append things to the end of test */
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement