Sponsored links: Algebra eBooks
 

Help Index

A

B

C

D

E

F

G

H

I

J

K

L

M

N

O

P

Q

R

S

T

U

V

W

X

Y

Z

The Maxima on-line user's manual

Algebra Calculator

Search:

Orderlessp Calculator

Orderlessp

Function: orderlessp (<expr_1>, <expr_2>) ordergreatp returns true if <expr_1> succeeds <expr_2> in the canonical ordering of Maxima expressions, and false otherwise.

orderlessp returns true if <expr_1> precedes <expr_2> in the canonical ordering of Maxima expressions, and false otherwise.

All Maxima atoms and expressions are comparable under ordergreatp and orderlessp, although there are isolated examples of expressions for which these predicates are not transitive; that is a bug.

The canonical ordering of atoms (symbols, literal numbers, and strings) is the following.

(integers and floats) precede (bigfloats) precede (declared constants) precede (strings) precede (declared scalars) precede (first argument to orderless) precedes ... precedes (last argument to orderless) precedes (other symbols) precede (last argument to ordergreat) precedes ... precedes (first argument to ordergreat) precedes (declared main variables)

For non-atomic expressions, the canonical ordering is derived from the ordering for atoms. For the built-in + * and ^ operators, the ordering is not easily summarized. For other built-in operators and all other functions and operators, expressions are ordered by their arguments (beginning with the first argument), then by the name of the operator or function. In the case of subscripted expressions, the subscripted symbol is considered the operator and the subscript is considered an argument.

The canonical ordering of expressions is modified by the functions ordergreat and orderless, and the mainvar, constant, and scalar declarations.

See also sort.

Examples:

Ordering ordinary symbols and constants. Note that %pi is not ordered according to its numerical value.

          (%i1) stringdisp : true;
          (%o1)                         true
          (%i2) sort ([%pi, 3b0, 3.0, x, X, "foo", 3, a, 4, "bar", 4.0, 4b0]);
          (%o2) [3, 3.0, 4, 4.0, 3.0b0, 4.0b0, %pi, "bar", "foo", a, x, X]

Effect of ordergreat and orderless functions.

          (%i1) sort ([M, H, K, T, E, W, G, A, P, J, S]);
          (%o1)           [A, E, G, H, J, K, M, P, S, T, W]
          (%i2) ordergreat (S, J);
          (%o2)                         done
          (%i3) orderless (M, H);
          (%o3)                         done
          (%i4) sort ([M, H, K, T, E, W, G, A, P, J, S]);
          (%o4)           [M, H, A, E, G, K, P, T, W, J, S]

Effect of mainvar, constant, and scalar declarations.

          (%i1) sort ([aa, foo, bar, bb, baz, quux, cc, dd, A1, B1, C1]);
          (%o1)   [aa, bar, baz, bb, cc, dd, foo, quux, A1, B1, C1]
          (%i2) declare (aa, mainvar);
          (%o2)                         done
          (%i3) declare ([baz, quux], constant);
          (%o3)                         done
          (%i4) declare ([A1, B1], scalar);
          (%o4)                         done
          (%i5) sort ([aa, foo, bar, bb, baz, quux, cc, dd, A1, B1, C1]);
          (%o5)   [baz, quux, A1, B1, bar, bb, cc, dd, foo, C1, aa]

Ordering non-atomic expressions.

          (%i1) sort ([1, 2, n, f(1), f(2), f(2, 1), g(1), g(1, 2), g(n), f(n, 1)]);
          (%o1) [1, 2, f(1), g(1), g(1, 2), f(2), f(2, 1), n, g(n),
                                                                   f(n, 1)]
          (%i2) sort ([foo(1), X[1], X[k], foo(k), 1, k]);
          (%o2)            [1, foo(1), X , k, foo(k), X ]
                                        1              k

(%o1)                                true
(%i2) 

Orderlessp Example

Related Examples

orderlessp

? orderlessp;

Calculate

orderlessp-sort

sort([12,23,3,14,124,...

Calculate

orderlessp

orderlessp(4*x^5+2*x^...

Calculate

orderlessp-sort

sort([123,123,124,11,...

Calculate

orderlessp

? orderlessp ;

Calculate

orderlessp

? orderlessp;

Calculate

orderlessp-sort

sort([12,23,3,14,124,...

Calculate

orderlessp

orderlessp(4*x^5+2*x^...

Calculate

orderlessp-sort

sort([123,123,124,11,...

Calculate

orderlessp

? orderlessp ;

Calculate