Message Boards Message Boards

0
|
4112 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Sort & Permutation

Posted 11 years ago

Greetings,

I would like to obtain the permutation resulting from the sorting of the given list (as opposed to the sorted list):

input = {5.3, 2.7, 9.2, 0.0}
output = {0.0, 2.7, 5.3, 9.2}
Desired Output = {4, 2, 1, 3}

Thanks in advance

2 Replies

In[17]:= input = {5.3, 2.7, 9.2, 0.0}

Out[17]= {5.3, 2.7, 9.2, 0.}

In[18]:= Ordering[input, 4]

Out[18]= {4, 2, 1, 3}

POSTED BY: S M Blinder

Ordering does this.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract