# Sorting a list by decreasing order: SortD

### 5.40.20 Sorting a list by decreasing order: SortD

The SortD command sorts a list or a matrix in decreasing order.

- SortD takes one argument:
  L, a list.
- If L is not a matrix:
  SortA(L) returns a copy of L with the elements in decreasing order.
  If L is a matrix:
  SortA(L) returns a copy of L where the columns are sorted according to decreasing order in the first row.

#### Examples.

- Input:
  SortD([3,4,2])
  Output:

  ⎡ ⎣ | 4,3,2 | ⎤ ⎦

- Input:
  SortD([[3,4,2],[6,4,5]])
  Output:

  ⎡
  ⎢
  ⎣

  4 | 3 | 2
  4 | 6 | 5

  ⎤
  ⎥
  ⎦