Items tagged with sort sort Tagged Items Feed

Sort alpha list...

January 17 2014 brian bovril 394


I know the following:{A>E,F>Z,F<P,Z>E,P<A} , all real Numbers

can I get maple to sort these in order largest to smallest.

[in this case:  A>P>F>Z>E ]

I have a variable with some assumptions: assume(0<=W<=1).

Now, when I make a list and sort it, everything goes fine:

k := [W, (1/3)*W, (1/3)*W, (1/3)*W]:
sort(k, (a,b)->is(a>b))

I get [(1/3)W, (1/3)W, (1/3)W, W] as expected.

Now I try this:

k:= Vector[column]([W, (1/3)*W, (1/3)*W, (1/3)*W]) 
sort(k, (a,b)->is(a>b))

And Maple gets stuck on this computation. I have tried on both Windows and Linux, on several different computers.


I'm trying to sort a list of symbols respecting some assumptions I have made about them. For example, I'd like to assume that 0<x<1, and I would like [x, x^2, x^3] to be sorted into [x^3, x^2, x]. How would I accomplish that? Making an assumption with assume() does not affect anything, as the sort() function does not seem to be actually comparing the values of symbols (only numeric values). Any help will be appreciated.

Thank you. 

 hi everyone,   

I have a list of coordinates  and would like to sort them so that in the new order, the last coordinate will be the first coordinate and the first coordinate will be the first: 

   for example:  


should sort to  

  P:=array[ [6,1], [6,5], [4,1],[3,2],[2,3],[1,4]]  

Attached is my sheet. Please have a look.

Have a look at the last command of the sheet.

I am trying to extract integrals from the equaions(eq10_1, for example) using 'op', but it isn't working as expected, is it a bug or I am doing something wrong?

Second question: 

I am not been able to do sorting for all these equations, any suggestions?

Hi I am writing a program that studies the stability of a dynamical system. I want to sort the eigenvalues of the matrix by magnitude in ascending order and then assign theses eigenvalues to a variable and then check to know those that are outside the unit circle. I am dealing with a 5 by 5 matrix. Do not want to go through  the permuation of thses eigenvalue which is lengthy. can someone help me out. JUS HOW TO ASSIGN EACH EIGENVALUE TO A VARIABLE. THANK YOU

How to successfully deploy Matlab function [B, IX] = sort (A, ...)
IX is a permutation vector of the corresponding column of A

M := Matrix(6, 3, [2, 3, 3, 5, 7, 8, 12, 5, 9, -3, 4.1, 7, 7, 7, -3, 9, 3, 8]):
L := <(seq(op(convert(sort(M[() .. (), j]), list)), j = 1 .. op(M)[2]))>;
L := ArrayTools[Alias](L, [op(M)[1 .. 2]], Fortran_order);
P := Matrix(op(M)[1 .. 2],  (i, j)-> ListTools[Search](L[i, j], M[() .. (), j]));
# from Matlab



I have a problem when I call the Eigenvectors i get:


i get the answer i want but every time i execute the worksheet my eigenvalues swich places aswell as the eigenvector.

Someone that can help me how i can sort or something like that to freeze the eigenvector output? so i can use some of the output to caluculate furhtere on and when i execute the worksheet i know that me eigenvectors and eigenvalues...



I am working with wedge products, and I came up with this question: how can I efficiently sort a list of indices, and obtain the sign of the associated permutation?

So for [4,3] I would like to obtain [3,4]-

for [1,4,2] I would want to obtain [1,2,4] -

for [2,1,4,3] I would want to obtain [1,2,3,4]+

I know I can do sort([4,3]) but what about the sign of that permutation?



Likely has been asked before, but I cannot find the answer:

I have a table with a good number of entries, all of them indexed by strings. I'd like to sort the table by ascending index (i.e. alphabetically A...,B... etc) before I write the result to a file. Obviously, the entries have to stay with their respective indices.


Table([B=4,C=2,A=3]); to be sorted as A=3,B=4,C=2.

The sort command in Maple works with Arrays only; I understand.

Hi, I have a 18x1 matrix. I am trying to sort it from smallest value to the largest value. But how to I as it to show which was the original position?

For example, M is my 18x1 matrix, i wrote "sort(M)".

In matlab I would write [Q,F]=sort(M);

Q will rearrange it for me and F will tell me the original position where it is from.

Please advice. Thank you very much.

I explain my problem with an example:


When I write


the answer is

      3    2        
 3 x  + x  + x + 1

 But when I write


answer is


while I want this form:

 x  + 2 x + 1

Even when I type only


into a blank page, again the answer is 



I have a rather large multivatiate polynomial "Dtest"  I need to divie it by a cubic poly "DGm" using rem and quo. Both are determinants multiplied out,  both given below. Have spent the past 2 nights trying to sort, collect, expand, equate coefficients plex groebner etc. Am trying to collect up all the powers of c3 but cant anything to work. even expand doesn't fully expand "Dtest". If I set c1 and c2 to 1 things are...

When I do the following command in Maple:

Sleep Sort...

June 16 2011 John May 1827 Maple 15

Sleep Sort is a hilarious (to me anyway) joke dressed up as a sorting algorithm.

Here it is in non-obfuscated (if somewhat garbagey) Maple code (need version 15 since it uses ?Threads,Sleep )

SleepSort := proc(L::list(posint),$)
local Lout, p, i;
    Lout := NULL;

    p := proc(n::posint,$)
        Lout := Lout, n;
    end proc:

    Threads:-Wait( seq( Threads:-Create( p(i...
1 2 Page 1 of 2