|
|
| Up to Main Lab Page |
Some useful Maple data types are given here.
Note that this is not an exhaustive list, if you want to see them all try
> ?type
You should be aware that data types can overlap. For example, given
f := x -> x^2
then f is an operator, a name, a scalar and a string.
You can check the type of an expression using the Maple type keyword. The syntax is:
type(expression, type)type returns a boolean value, either true or false. For example
| Logical Types | |
|---|---|
| boolean | A Boolean expression is an expression of type relation or of type logical or one of the Boolean constants true or false. |
| relation | A relational expression is an expression involving `=`, `<>`, `<` or `<=`. |
| logical | A logical expression is an expression involving and, or, or not. |
| Numeric Types | |
| complex | A complex constant, of type constant and does not involve one of the non-numeric constants (true, false, FAIL, infinity). |
| constant | A complex constant, including ±infinity. |
| float | An object is of type float if it is a floating point number, that is, a sequence of digits and a decimal point. |
| fraction | An object is of type fraction if it is represented by a signed integer divided by a positive integer (posint) |
| infinity | ±infinity, or complex infinity. |
| integer | An expression is of type integer if it is an (optionally signed) sequence of one or more digits. |
| numeric | An object is of type numeric if it is either an integer, a fraction, or a float. |
| rational | An object is of type rational if it is either of type fraction or of type integer. |
| realcons | A real constant is ±infinity or an expression for which evalf will return a float. |
| Algeraic Types | |
| anything | Any valid Maple expression, except an expression sequence (exprseq) |
| algebraic | An expression is of type algebraic if it is one of the following types: integer, fraction, float, string, indexed, series, function, operator (and several more) |
| equation | An equality '=' with a left and right hand side, e.g. 'a = b' |
| function | An uneveluated function call e.g. 'f(x)', where f is undefined. Note that if f is defined f := x -> x^2; this becomes an operator. Usually you want type operator not type function |
| operator | A function defined with the -> operator, e.g. f := x -> x^2, f is of type operator. |
| range | A range defined with ellipsis e.g. 'a..b'. |
| Indexed Types | |
| array | A variable declared with the array keyword (see lesson 6). |
| exprseq | A sequence of expressions, possibly in square brackets or braces. Expression sequences (or simply sequences) are created using the comma operator ','. e.g. s := 1,2,3 assigns s the sequence 1,2,3. In Maple, sequences form the basis of many data types. In particular, they appear in function calls, lists, sets and subscripts. |
| list | A list is an ordered sequence of expressions enclosed in square brackets [..]. |
| set | A set is an unordered sequence of distinct expressions enclosed in braces {..}, representing a set in the mathematical sense. |
| matrix | A matrix is defined to be a two-dimensional array with indices starting at 1. |
| scalar | A scalar is anything which is not of type vector or matrix. |
| vector | A vector is defined to be an one-dimensional array indexed from 1. |
| String Types | |
| name | A name is usually a string, which in its simplest form is a letter followed by zero or more letters, digits, and underscores. |
| string | Any text string, not a numeric value. |
Some other types are given below.
| Function types | |
|---|---|
| arctrig | An expression which is one of the inverse trigonometric or hyperbolic functions: arcsin, arccos, arctan, arcsec, arccsc, arccot, arcsinh, arccosh, arctanh, arcsech, arccsch, arccoth. |
| trig | An expression which is one of the trigonometric functions: sin, cos, tan, sec, csc, cot, sinh, cosh, tanh, sech, csch, coth |
| linear | An expression which is linear, i.e. of the form ax + b. |
| quadratic | An expression which is quadratic, i.e. of the form ax2 + bx + c. |
| cubic | An expression which is cubic, i.e. of the form ax3 + bx2 + cx + d. |
| quartic | An expression which is quartic, i.e. of the form ax4 + bx3 + cx2 + dx + e. |
| polynom | An expression which is a polynomial. |
| Integer Types | |
| posint | Of type integer and positive (> 0). |
| negint | Of type integer and negative (< 0). |
| nonnegint | Of type integer and not negative (>= 0). |
| even | Of type integer and even. |
| odd | Of type integer and odd. |
| prime | Of type integer and prime (see the function isprime). |
| Other Types | |
| nothing | No valid Maple expression is of this type. That is, this type always returns false. |
| protected | A Maple protected (reserved) word. |
| procedure | A procedure name. |
| type | A valid data type. The call type(a, type) checks to see if a is a valid type. By definition, a type is any expression afor which the command type(expr, a) could succeed. e.g. type(integer, type) is true |
| uneval | An expression is of type uneval if it is enclosed in single quotes, 'x'. Maple will not evaluate expressions in single quotes. |
| Up to Main Lab Page | Top of this Page |