Difference between revisions of "Sort Command"
From GeoGebra Manual
m (formating) |
|||
Line 7: | Line 7: | ||
* <code>Sort[{"pears", "apples", "figs"}]</code> gives you the list elements in alphabetical order. | * <code>Sort[{"pears", "apples", "figs"}]</code> gives you the list elements in alphabetical order. | ||
* <code>Sort[{(3, 2), (2, 5), (4, 1)}]</code> gives you ''{(2, 5), (3, 2), (4, 1)}''.</div>}} | * <code>Sort[{(3, 2), (2, 5), (4, 1)}]</code> gives you ''{(2, 5), (3, 2), (4, 1)}''.</div>}} | ||
+ | {{betamanual|version=4.2| | ||
+ | {{Note|1=From GeoGebra 4.2, this syntax will work too: Sort[ <Values>, <Keys> ]. This will sort the Values according to the corresponding Keys, for example: <br><code>list1 = {ComplexRoot[x^10-1]}<br> | ||
+ | Polygon[ Sort[ list1, arg(list1) ] ] </code> <br>}} | ||
+ | }} |
Revision as of 11:53, 5 July 2012
- Sort[List]
- Sorts a list of numbers, text objects, or points.
Note: Lists of points are sorted by x-coordinates.
Example:
Sort[{3, 2, 1}]
gives you the list {1, 2, 3}.Sort[{"pears", "apples", "figs"}]
gives you the list elements in alphabetical order.Sort[{(3, 2), (2, 5), (4, 1)}]
gives you {(2, 5), (3, 2), (4, 1)}.
Following text is about a feature that is supported only in GeoGebra 4.2.
Note: From GeoGebra 4.2, this syntax will work too: Sort[ <Values>, <Keys> ]. This will sort the Values according to the corresponding Keys, for example: list1 = {ComplexRoot[x^10-1]} |