Difference between revisions of "Sort Command"

From GeoGebra Manual
Jump to: navigation, search
Line 12: Line 12:
 
:{{Example|1=<code>list1 = {ComplexRoot[x^10-1]}</code>,  <code>Polygon[Sort[list1, arg(list1)]] </code>}}
 
:{{Example|1=<code>list1 = {ComplexRoot[x^10-1]}</code>,  <code>Polygon[Sort[list1, arg(list1)]] </code>}}
 
}}
 
}}
{{note|There is a workaround to sort lists of arbitrary objects which is explained in [[Tutorial:Advanced List Sorting|this tutorial]].}}
+
{{note|There is a workaround to sort lists of arbitrary objects which is explained in the [[Tutorial:Advanced List Sorting]].}}

Revision as of 11:09, 10 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)}.
Note: There is a workaround to sort lists of arbitrary objects which is explained in the Tutorial:Advanced List Sorting.
© 2024 International GeoGebra Institute