Expression Type Functions
The functions in this topic are primarily used when writing Derive function definitions to determine the data type of expressions. By convention, the function names includes a ? to emphasize that they are predicates that return a truth-value (i.e. true or false).
INTEGER?(u) simplifies to true if u is an integer; otherwise it simplifies to false. For example, 5, 0, -1, and 3 are integers. Note that, the expressions FLOOR(x) and SIGN(x) are not integers, although their data type is integer. Use INTEGER-TYPE? to test for such expressions.
RATIONAL?(u) simplifies to true if u is rational number (including integers); otherwise it simplifies to false. For example, 2/3, -7/2, 5, and 0 are rational numbers.
EVEN?(u) simplifies to true if u is an even number (including fractions whose numerator or denominator is even); otherwise it simplifies to false. For example, 4, 0, -6, 2/3, and 3/2 are even numbers.
ODD?(u) simplifies to true if u is an odd number (including fractions whose numerator and denominator is odd); otherwise it simplifies to false. For example, 1, -7, and 3/5 are odd numbers.
NUMBER?(u) simplifies to true if u is a real or complex number; otherwise it simplifies to false. For example, 3, -2/3, 2·î, and 3-5·î are numbers. Note that, the expressions SIN(x) and x^2 are not numbers, although their data type is number. Use REAL_TYPE? and NUMBER-TYPE? to test for such expressions.
VARIABLE?(u) simplifies to true if u is a variable; otherwise it simplifies to false. For example, x, a, and Real are variables.
STRING?(u) simplifies to true if u is a string variable; otherwise it simplifies to false. For example, "a=b" and "Derive" are string variables.
SUM?(u) simplifies to true if u is a sum; otherwise it simplifies to false. For example, x+y and x-y are sums.
PRODUCT?(u) simplifies to true if u is a product; otherwise it simplifies to false. For example, x·y and x/y are products.
POWER?(u) simplifies to true if u is a power having a numeric degree; otherwise it simplifies to false. For example, x^2 and SQRT(x) are powers.
VECTOR?(u) simplifies to true if u is a vector or matrix; otherwise it simplifies to false. For example, [a, b, c] and [a, b; c, d] are vectors. Note that, the variable v is not a vector, even though the data type of v has been declared vector using the Author > Variable Domain command8MNT4Y. Use VECTOR_TYPE? to test for such variables.
MATRIX?(u) simplifies to true if u is a matrix (i.e. a vector of one or more vectors of equal length); otherwise it simplifies to false. For example, [a, b; c, d] (or equivalently, [[a, b], [c, d]]) is a matrix.
SET?(u) simplifies to true if u is a set; otherwise it simplifies to false. For example, {a, b, c} and { } are sets. Note that, the variable s is not a set, even though the data type of s has been declared set using the Author > Variable Domain command8MNT4Y. Use SET_TYPE? to test for such variables.
LOGICAL?(u) simplifies to true if u is a logical truth-value; otherwise it simplifies to false. true and false are the only two truth-values. Note that, the variable p is not a logical truth-value, even though the data type of p has been declared logical using the Author > Variable Domain command8MNT4Y. Use LOGICAL_TYPE? to test for such variables.
INTEGER_TYPE?(u) simplifies to true if the data type of u is an integer; otherwise it simplifies to false. For example, the data type of 3, FLOOR(x), and SIGN(x) is integer.
REAL_TYPE?(u) simplifies to true if the data type of u is a real number; otherwise it simplifies to false. For example, the data type of 3, -2/3, x+y, and SIN(x) is real.
NUMBER_TYPE?(u) simplifies to true if the data type of u is a real or complex number; otherwise it simplifies to false. For example, the data type of a-3·î, SQRT(x), and LN(x) is a real or complex number.
VECTOR_TYPE?(u) simplifies to true if the data type of u is a vector; otherwise it simplifies to false. For example, the data type of [a, b, c] and [a, b; c, d] is vector.
SET_TYPE?(u) simplifies to true if the data type of u is a set; otherwise it simplifies to false. For example, the data type of {a, b, c} and a UNION b is set.
LOGICAL_TYPE?(u) simplifies to true if the data type of u is a logical truth-value; otherwise it simplifies to false. For example, the data type of true and p AND q is logical.
IDENTICAL?(u, v) simplifies to true if u is identical to v; otherwise it simplifies to false.
Other Built-in Functions and ConstantsBuilt_in_Functions_and_Constants
Created with the Personal Edition of HelpNDoc: Generate Kindle eBooks with ease