Jump to content

Maxima/Features

From Wikibooks, open books for an open world

Maxima recognizes certain mathematical properties of:

  • functions and variables
  • system. There is a list of non-mathematical, system-dependent features. See status.

which called features.

 declare (x, foo) /* gives the property foo to the function or variable x */
 declare (foo, feature) /* declares a new feature foo. */ 
 declare ([red, green, blue], feature) /* declares three new features, red, green, and blue. */

The predicate

 featurep (x, foo) 

returns true if x has the foo property, and false otherwise.

The infolist features is a list of known features. These are

   integer        noninteger      even
   odd            rational        irrational
   real           imaginary       complex
   analytic       increasing      decreasing
   oddfun         evenfun         posfun
   constant       commutative     lassociative
   rassociative   symmetric       antisymmetric
   integervalued

plus any user-defined features.

features is a list of mathematical features.

Example:

(%i1) declare (FOO, feature);
(%o1)                         done
(%i2) declare (x, FOO);
(%o2)                         done
(%i3) featurep (x, FOO);
(%o3)                         true

Declare

[edit | edit source]

declare recognizes the following properties:

  • 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.
  • 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.


Declare tells:

  • evenp()
  • oddp()
  • integerp()
  • and so on

what to return.


Compare with:

  • mode_decalre