“Sort 指令”的版本间的差异
来自GeoGebra Manual
(未显示同一用户的1个中间版本) | |||
第6行: | 第6行: | ||
:* <code>Sort({3, 2, 1})</code> 產生串列 ''{1, 2, 3}''。 | :* <code>Sort({3, 2, 1})</code> 產生串列 ''{1, 2, 3}''。 | ||
:* <code>Sort({"pears", "apples", "figs"})</code> 以英文字母排序產生一個串列。 | :* <code>Sort({"pears", "apples", "figs"})</code> 以英文字母排序產生一個串列。 | ||
− | :* <code>Sort({(3, 2), (2, 5), (4, 1)}) </code> 產生 ''{(2, 5), (3, 2), (4, 1)}''。</div>}} | + | :* <code>Sort({(3, 2), (2, 5), (4, 1)})</code> 產生 ''{(2, 5), (3, 2), (4, 1)}''。</div>}} |
− | ; Sort( <值>, <鍵> ): <值> | + | ; Sort( <值 串列>, <鍵 串列> ): <值 串列> 元素會依據相對應的 <鍵 串列> 元素來進行排序。 |
:{{Examples|1=<div> | :{{Examples|1=<div> | ||
− | :* | + | :* 為了將多項式串列 <code>list1 = {x^3, x^2, x^6}</code> 依據次數(degree)來排序,先建立一個相依的次數串列 <code>list2 = Zip(Degree(a), a, list1)</code> 。接著輸入 <code> Sort(list1, list2)</code> 會產生所求串列 ''list3 = {x^2, x^3, x^6}'' 。 |
− | :* | + | :* 為了將 <math>x^{10}-1</math> 的複數根按照幅角(argument)順序作為頂點來畫出多邊形,先建立 <code>list1 = {ComplexRoot(x^10-1)}</code> ,接著使用指令 <code>Polygon(Sort(list1, arg(list1)))</code> 產生 ''poly1 = 2.94'' 。</div>}} |
− | {{note| | + | {{note| 有一種替代方案能對任意物件的串列進行排序,請參閱教學文件「[https://wiki.geogebra.org/en/Tutorial:Advanced_List_Sorting 進階串列排序(英文)] 」。}} |
2021年11月15日 (一) 11:12的最新版本
本页为官方文件,一般使用者无法修改,若有任何误谬,请与官方联络。如欲编辑,请至本页的开放版。
- Sort( <串列> )
- 对一个数值、文字或点的 <串列> 进行排序。
- 备注: 点串列以 x 坐标作为排序依据。
- 范例:
Sort({3, 2, 1})
产生串列 {1, 2, 3}。Sort({"pears", "apples", "figs"})
以英文字母排序产生一个串列。Sort({(3, 2), (2, 5), (4, 1)})
产生 {(2, 5), (3, 2), (4, 1)}。
- Sort( <值串列>, <键串列> )
- <值串列> 元素会依据相对应的 <键串列> 元素来进行排序。
- 范例:
- 为了将多项式串列
list1 = {x^3, x^2, x^6}
依据次数(degree)来排序,先建立一个相依的次数串列list2 = Zip(Degree(a), a, list1)
。接著输入Sort(list1, list2)
会产生所求串列 list3 = {x^2, x^3, x^6}。 - 为了将 x^{10}-1 的复数根按照幅角(argument)顺序作为顶点来画出多边形,先建立
list1 = {ComplexRoot(x^10-1)}
,接著使用指令Polygon(Sort(list1, arg(list1)))
产生 poly1 = 2.94。
- 为了将多项式串列
备注: 有一种替代方案能对任意物件的串列进行排序,请参阅教学文件“进阶串列排序(英文)”。