File: sortcommand.htm

package info (click to toggle)
extrema 4.3.6-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 19,212 kB
  • ctags: 6,452
  • sloc: cpp: 86,428; sh: 8,229; makefile: 814
file content (82 lines) | stat: -rw-r--r-- 2,875 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<HTML>
<HEAD>
<TITLE>SORT command</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

<P><font size="+3" color="green"><B>SORT command</B></font></P>

<TABLE border="1" cols="2" frame="box" rules="all" width="572">
<TR>
<TD width="15%" valign="top"><B>Syntax</B>:</TD>
<TD width="85%" valign="top"><CODE>SORT x { x1 x2 ... }</CODE></TD></TR>
<TR>
<TD valign="top"><B>Qualifiers</B>:</TD>
<TD valign="top"><CODE>\UP, \DOWN</CODE></TD></TR>
<TR>
<TD valign="top"><B>Defaults</B>:</TD>
<TD valign="top"><CODE>\UP</CODE></TD></TR>
</TABLE>
<P>
 The <CODE>SORT</CODE> command sorts vectors into
 ascending or descending order. By default, the vector
 <CODE>x</CODE> is sorted into ascending order.
 Ascending order means that element <CODE>1</CODE> will be the smallest
 element. To sort vector <CODE>x</CODE> into
 descending order, use the <CODE>\DOWN</CODE>
 qualifier. Descending order means that element <CODE>1</CODE> will
 be the largest.  Vector <CODE>x</CODE> will be
 altered. If other vectors, <CODE>xI</CODE>, are
 entered, then they will not be sorted, but they will be re-arranged in
 the same way that <CODE>x</CODE> is re-arranged.
 For example, if element <CODE>x[i]</CODE> becomes
 <CODE>x[j]</CODE> because of sorting, then <CODE>xI[i]</CODE> will become <CODE>xI[j]</CODE>.</P>
<P>
 <font size="+1" color="green">Example 1</font></p>
<p>
 Suppose you have a data vector, <CODE>X = [1;2;3;4;5]</CODE><br />
 To sort <CODE>X</CODE> into descending order, enter:</p>
<p>
 <CODE><font color="blue">SORT\DOWN X</font></CODE></p>
<p>
 after which <CODE>X = [5;4;3;2;1]</CODE></p>
<P>
 <font size="+1" color="green">Example 2</font></p>
<p>
 Suppose you have three data vectors, <CODE>X</CODE>, <CODE>Y</CODE>, and
 <CODE>Z</CODE>, which represent rectangular coordinates and an associated
 altitude:
 <CODE>X = [1;2;3;4;5]</CODE>,
 <CODE>Y = [10;8;6;4;2]</CODE>,
 <CODE>Z = [-.3;-1;-.5;2;-2]</CODE></p>
<p>
 If you want to sort <CODE>Z</CODE> into descending order, without breaking
 up the triplets, enter:</p>
<p>
 <CODE><font color="blue">SORT\DOWN Z X Y</font></CODE></p>
<p>
 After which the vectors are:
 <CODE>X = [4;1;3;2;5]</CODE>,
 <CODE>Y = [4;10;6;8;2]</CODE>,
 <CODE>Z = [2;-.3;-.5;-1;-2]</CODE></p>
<P>
 <font size="+1" color="green">Example 3</font></p>
<p>
 Suppose you have three data vectors, <CODE>X</CODE>, <CODE>Y</CODE>, and
 <CODE>Z</CODE>, which represent rectangular coordinates and an associated
 altitude:
 <CODE>X = [1;2;3;4;5]</CODE>,
 <CODE>Y = [10;8;6;4;2]</CODE>,
 <CODE>Z = [-.3;-1;-.5;2;-2]</CODE></p>
<p>
 If you want to sort <CODE>Y</CODE> into ascending order, without breaking up
 the triplets, enter:</p>
<p>
 <CODE><font color="blue">SORT\DOWN Y X Z</font></CODE></p>
<p>
 After which the vectors are:
 <CODE>X = [5;4;3;2;1]</CODE>,
 <CODE>Y = [2;4;6;8;10]</CODE>,
 <CODE>Z = [-2;2;-.5;-1;-.3]</CODE></P>
</BODY>
</HTML>