Maxima Manual. Node: Definitions for Lists
Introduction to Lists
1.2: Definitions for Lists
- Function: APPEND
(list1, list2, ...)
returns a single list of the elements of
list1 followed by the elements of list2,... APPEND also works on
general expressions, e.g. APPEND(F(A,B), F(C,D,E)); -> F(A,B,C,D,E).
Do EXAMPLE(APPEND); for an example.
- Function: ATOM
is TRUE if exp is atomic (i.e. a number or name) else
FALSE. Thus ATOM(5) is TRUE while ATOM(A) and ATOM(SIN(X)) are
FALSE. (Assuming A and X are unbound.)
- Function: CONS
returns a new list constructed of the element exp as
its first element, followed by the elements of list. CONS also works
on other expressions, e.g. CONS(X, F(A,B,C)); -> F(X,A,B,C).
- Function: COPYLIST
creates a copy of the list L.
- Function: DELETE
removes all occurrences of exp1 from exp2. Exp1
may be a term of exp2 (if it is a sum) or a factor of exp2 (if it is a
(D1) Y + X
DELETE(exp1, exp2, integer) removes the first integer occurrences of
exp1 from exp2. Of course, if there are fewer than integer
occurrences of exp1 in exp2 then all occurrences will be deleted.
- Function: ENDCONS
returns a new list consisting of the elements of
list followed by exp. ENDCONS also works on general expressions, e.g.
ENDCONS(X, F(A,B,C)); -> F(A,B,C,X).
- Function: FIRST
yields the first part of exp which may result in the first
element of a list, the first row of a matrix, the first term of a sum,
etc. Note that FIRST and its related functions, REST and LAST, work
on the form of exp which is displayed not the form which is typed on
input. If the variable INFLAG [FALSE] is set to TRUE however, these
functions will look at the internal form of exp. Note that the
simplifier re-orders expressions. Thus FIRST(X+Y) will be X if INFLAG
is TRUE and Y if INFLAG is FALSE. (FIRST(Y+X) gives the same
- Function: GET
retrieves the user property indicated by i associated with
atom a or returns FALSE if a doesn't have property i.
(C4) TYPEOF(EXP) := BLOCK([Q],
IF NOT ATOM(EXP)
THEN RETURN(MAPLIST('TYPEOF, EXP)),
Q : GET(EXP, 'TYPE),
THEN ERRCATCH(ERROR(EXP,"is not numeric.")) ELSE Q)$
X is not numeric.
(D5) [[TRANSCENDENTAL, ], [ALGEBRAIC, TRANSCENDENTAL]]
(D6) [TRANSCENDENTAL, [ALGEBRAIC, TRANSCENDENTAL]]
- Function: LAST
yields the last part (term, row, element, etc.) of the exp.
- Function: LENGTH
gives (by default) the number of parts in the external
(displayed) form of exp. For lists this is the number of elements,
for matrices it is the number of rows, and for sums it is the number
of terms. (See DISPFORM). The LENGTH command is affected by the
INFLAG switch [default FALSE]. So, e.g. LENGTH(A/(B*C)); gives 2 if
INFLAG is FALSE (Assuming EXPTDISPFLAG is TRUE), but 3 if INFLAG is
TRUE (the internal representation is essentially A*B^-1*C^-1).
- Variable: LISTARITH
default: [TRUE] - if FALSE causes any arithmetic operations
with lists to be suppressed; when TRUE, list-matrix operations are
contagious causing lists to be converted to matrices yielding a result
which is always a matrix. However, list-list operations should return
- Function: LISTP
is TRUE if exp is a list else FALSE.
- Function: MAKELIST
returns a list as value. MAKELIST may be called as
MAKELIST(exp,var,lo,hi) ["lo" and "hi" must be integers], or as
MAKELIST(exp,var,list). In the first case MAKELIST is analogous to
SUM, whereas in the second case MAKELIST is similar to MAP. Examples:
MAKELIST(CONCAT(X,I),I,1,6) yields [X1,X2,X3,X4,X5,X6]
MAKELIST(X=Y,Y,[A,B,C]) yields [X=A,X=B,X=C]
- Function: MEMBER
returns TRUE if exp occurs as a member of list (not
within a member). Otherwise FALSE is returned. Member also works on
non-list expressions, e.g. MEMBER(B, F(A,B,C)); -> TRUE.
- Function: REST
yields exp with its first n elements removed if n is
positive and its last -n elements removed if n is negative. If n is 1
it may be omitted. Exp may be a list, matrix, or other expression.
Introduction to Lists
- Function: REVERSE
reverses the order of the members of the list (not
the members themselves). REVERSE also works on general expressions,
e.g. REVERSE(A=B); gives B=A.
REVERSE default: [FALSE] - in the Plotting functions, if TRUE cause a
left-handed coordinate system to be assumed.