type/constant
check for a constant
Calling Sequence
Parameters
Description
Examples
type(x, constant)
constants
constants := constants, y
x
-
any expression
y
a symbol
The call type(x, constant) verifies whether x is a constant.
The global variable constants is an expression sequence of all names which are initially known as symbolic constants in Maple. These are: false, gamma, infinity, true, Catalan, FAIL and Pi.
The values undefined and Float(undefined) do not appear on this list because neither is a constant.
The user can declare any name other than undefined to be a constant by appending it to constants. In order to make the evalf command evaluate such a constant to a floating-point number, define a procedure of the form `evalf/constant/y`, where y is the name of the constant. This process is described on the detailed evalf help page.
Users may only add or remove new symbolic constants. Maple's default constants listed above must remain. Maple will raise an error if an assignment to constants would remove any of the initially known constants.
Changing the value assigned to constants can change the results from Maple's library routines. However changing constants will not invalidate remembered results. Therefore one should only change the value of constants before beginning computations or after a restart.
The numeric constants in Maple are integers, fractions, floating-point numbers, and complex numbers whose real and imaginary parts are any of these types of numbers.
The expression (-1)^(1/2) is implemented as Complex(1).
More generally, a Maple expression is of type constant if it is an unevaluated function with all arguments of type constant, or a sum, product, or power with all operands of type constant.
Additionally, the RootOf function can be a constant. This is determined by calling the indets command on it. Suppose r is of the form RootOf(...). If indets(r, name) only returns entries that occur in constants, then r is a constant, and otherwise it is not.
type⁡5,constant
true
type⁡0.05,constant
type⁡ln⁡−π,constant
type⁡∞,constant
type⁡g⁡1,constant
type⁡false,constant
type⁡x2,constant
false
false,γ,∞,true,Catalan,FAIL,π
type⁡f⁡exp⁡γ+3+14,constant
type⁡f⁡exp⁡γ+x+14,constant
constants≔constants,x
constants≔false,γ,∞,true,Catalan,FAIL,π,x
Here are two examples of RootOf calls, one a constant, the other not:
r1≔RootOf⁡sin⁡z+π6−z2,z
r1≔RootOf⁡−sin⁡_Z+π6+_Z2
indets⁡r1,name
π
type⁡r1,constant
r2≔RootOf⁡sin⁡z+y−z2,z
r2≔RootOf⁡−sin⁡_Z+y+_Z2
indets⁡r2,name
type⁡r2,constant
See Also
evalf/details
float
fraction
integer
type
type/complex
type/complexcons
type/numeric
type/realcons
undefined
Download Help Document