411 REFERENCE · Wikibooks
Maxima/Features
Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.
Properties and Features
Inconsistent and imprecise use of technical terms has tended to make this topic confusing. To start, bear in mind that properties and features apply most essentially and usefully to identifiers – atoms. When "atom" is referred to in this context, string atoms and numerical atoms are not included. Properties and features are often put to use within programming expressions and in setting certain "flags" that can have affects that vary with the specific flag. Properties and features do not change the value of atoms.
In Maxima, features are a specific mathematical subset of a broad set of properties recognized by the Maxima system database. All features are properties, but not all properties are categorized as features. You assign both properties and features using the declare operator, but they serve different organizational and logical roles. Maxima’s Database https://maxima.sourceforge.io/docs/manual/Maxima_0027s-Database.htmlCAS Maxima Workbook https://roland-salz.de/Maxima_Workbook.pdfDOE-Maxima Reference Manual https://www.math.u-szeged.hu/~kovzol/SzAAMT-2003/macref.pdfMaxima CAS An Introduction https://www.slideshare.net/slideshow/maxima-cas-an-introduction/250411682
Properties:
A broad category: Attributes or "flags" assigned to identifiers and functions ( e.g. x and f(x) ) using declare(object, property), where object is an atom or a list of atoms.
Functionality: Can control evaluation behavior, syntax parsing, or system flags.
Examples: evfun, evflag, bindtest, noun, constant, scalar, and nonscalar.
Testing: Queried via various methods depending on the specific property type.Maxima Expressions https://maths.cnam.fr/Membres/wilk/MathMax/help/Maxima/maxima_6.htmlMaxima’s Database https://maxima.sourceforge.io/docs/manual/Maxima_0027s-Database.html For example the property nonscalar has an associated nonscalarp operator. However, not all properties have a unique operator for testing. Those properties may be tested using featurep(object,property) which at best is an annoying inconsistency in terminology that can lead to confusion.
Features:
A specific subset of properties: Mathematical attributes of identifiers and functions that are tracked in a global list called features.
Functionality: Used for logical inferences, algebraic simplification, and testing mathematical traits via featurep.
Examples: Built-in traits like even, odd, integer, rational, commutative, symmetric, or user-defined features.
Extensibility: You can declare a new, user-defined feature foo, for example,using declare(foo, feature) and then assign that new feature to identifiers and functions.
Testing: All features are queried explicitly using featurep(object, feature) operator form, where object is an atom or a list of atoms.Maxima 5.49.0 Manual https://maxima.sourceforge.io/docs/manual/maxima_singlepage.htmlFunctions and Variables for Properties https://pmsf.eu/pub/cmucl/maxima/new-cat/maxima_58.html
Maxima recognizes properties as:
non-mathematical properties of functions and identifiers
mathematical properties called features of functions and identifiers
user-defined features of functions and identifiers
Maxima system-dependent properties
There is a list object of non-mathematical, system-dependent properties. See status(feature).Function: status https://maxima.sourceforge.io/docs/manual/Runtime-Environment.html#index-status The use of the argument feature in this context is regrettable. (%i1) status (feature);
(%o1) [quicklisp,asdf3.3,asdf3.2,asdf3.1,asdf3,asdf2,asdf,os\-unix,non\-base\-chars\-exist\-p,asdf\-unicode,has\-distinct\-double\-float,has\-distinct\-single\-float,
lisp\-unicode\-capable,cl,mk\-defsystem,cltl2,arena\-allocator,x86\-64,gencgc,64\-bit,ansi\-cl,common\-lisp,elf,ieee\-floating\-point,linux,little\-endian,
package\-local\-nicknames,sb\-ldb,sb\-package\-locks,sb\-thread,sb\-unicode,sbcl,unix]Some examples of some properties, features, and associated operators:/* declare x to have the property mainvar */
(%i2) declare (x, mainvar);
(%o2) done
/* query x for the property mainvar */
(%i3) featurep (x, mainvar);
(%o3) true
/* declare y to have the feature real */
(%i4) declare (y, real);
(%o4) done
/* query y for the feature real */
(%i5) featurep (y, real );
(%o5) true
/* declare foo to be a feature */
(%i6) declare (foo, feature);
(%o6) done
/* declare z to have the feature foo */
(%i7) declare (z, foo);
(%o7) done
/* query z for the feature foo */
(%i8) featurep (z, foo );
(%o8) true
/* declare w to have the property no0nscalar */
(%i9) declare (w, nonscalar);
(%o9) done
/* query w for the property scalar */
(%i10) scalarp(w);
(%o10) false
/* query w for the property nonscalar */
(%i11) nonscalarp(w);
(%o11) true
/* a list of features */
(%i12) [red, green, blue]
(%o12) done
/* declare a to have the list of features */
(%i13) declare(a, [red, green, blue]);
(%o13) done
/* query a for the feature red */
(%i14) featurep(a,red);
(%o14) true
/* declare r, g, and b to have the list of features */
(%i15) declare([r,g,b], [red, green, blue]);
(%o15) done
/* query g for the feature red */
(%i16) featurep(g,red);
(%o16) true
/* return a list of identifiers with the property nonscalar */
(%i17) propvars(nonscalar);
(%o17) [w]
/* remove the property nonscalar from w */
(%i18) remove(w,nonscalar);
(%o18) done
/* query w for the property nonscalar */
(%i19) nonscalarp(w);
(%o19) false
/* return a list of identifiers with the feature green */
(%i20) propvars(green);
(%o20) [a,r,g,b]
/* remove the features red and blue from a, r, and b */
(%i21) remove([a,r,b],[red,blue]);
(%o21) done
/* return a list of identifiers with the feature red */
(%i22) propvars(red);
(%o22) [g]
/* return a list of identifiers with the feature blue */
(%i23) propvars(blue);
(%o23) [g]
/* return a list of identifiers with the feature green */
(%i24) propvars(green);
(%o24) [a,r,g,b]
/* use a feature in a block with a conditional */
(%i25) (stringdisp: false,
if featurep (g,red) then
print ('g, "is red") else
print ('g, "is not red"),
"")$
g is red
The declare Operator
declare (a_1, p_1, a_2, p_2, …)
Assigns the atom or list of atoms a_i the property or list of properties p_i. When a_i and/or p_i are list objects, each of the atoms gets all of the properties.
The declare operator recognizes the following properties and features. Features are underlined:
additive : Tells Maxima to simplify a_i expressions by the substitution a_i(x + y + z + ...) --> a_i(x) + a_i(y) + a_i(z) + .... The substitution is carried out on the first argument only.
alphabetic : Tells Maxima to recognize all characters in a_i (which must be a string) as alphabetic characters.
analytic: Tells Maxima that the specified function is an analytic function (having a convergent power series expansion)
antisymmetric, commutative, symmetric : Tells Maxima to recognize a_i as a symmetric or antisymmetric function. commutative is the same as symmetric.
bindtest : Tells Maxima to trigger an error when a_i is evaluated unbound.
constant : Tells Maxima to consider a_i a symbolic constant.
even, odd : Tells Maxima to recognize a_i as an even or odd integer variable.
evenfun, oddfun : Tells Maxima to recognize a_i as an odd or even function.
evflag : Makes a_i known to the ev function so that a_i is bound to true during the execution of ev when a_i appears as a flag argument of ev. See evflag.
evfun : Makes a_i known to ev so that the function named by a_i is applied when a_i appears as a flag argument of ev. See evfun.
feature : Tells Maxima to recognize a_i as the name of a feature. Other atoms may then be declared to have the a_i property.
increasing, decreasing : Tells Maxima to recognize a_i as an increasing or decreasing function.
integer, noninteger : Tells Maxima to recognize a_i as an integer or noninteger variable.
integervalued : Tells Maxima to recognize a_i as an integer-valued function.
lassociative, rassociative : Tells Maxima to recognize a_i as a right-associative or left-associative function.
linear : Equivalent to declaring a_i both outative and additive.
mainvar : Tells Maxima to consider a_i a "main variable". A main variable succeeds all other constants and variables in the canonical ordering of Maxima expressions, as determined by ordergreatp.
multiplicative : Tells Maxima to simplify a_i expressions by the substitution a_i(x * y * z * ...) --> a_i(x) * a_i(y) * a_i(z) * .... The substitution is carried out on the first argument only.
nary : Tells Maxima to recognize a_i as an n-ary function. The nary declaration is not the same as calling the nary function. The sole effect of declare(foo, nary) is to instruct the Maxima simplifier to flatten nested expressions, for example, to simplify foo(x, foo(y, z)) to foo(x, y, z).
nonarray : Tells Maxima to consider a_i not an array. This declaration prevents multiple evaluation of a subscripted variable name.
nonscalar : Tells Maxima to consider a_i a nonscalar variable. The usual application is to declare a variable as a symbolic vector or matrix.
noun : Tells Maxima to parse a_i as a noun. The effect of this is to replace instances of a_i with 'a_i or nounify(a_i), depending on the context.
outative : Tells Maxima to simplify a_i expressions by pulling constant factors out of the first argument. When a_i has one argument, a factor is considered constant if it is a literal or declared constant. When a_i has two or more arguments, a factor is considered constant if the second argument is a symbol and the factor is free of the second argument.
posfun : Tells Maxima to recognize a_i as a positive function.
rational, irrational : Tells Maxima to recognize a_i as a rational or irrational real variable.
real, imaginary, complex : Tells Maxima to recognize a_i as a real, pure imaginary, or complex variable.
scalar : Tells Maxima to consider a_i a scalar variable.