check for a constant
constants := constants, y
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 symbol 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.
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.
constants ≔ constants,x
Here are two examples of RootOf calls, one a constant, the other not:
r1 ≔ RootOf⁡sin⁡z+Pi6−z2,z
r2 ≔ RootOf⁡sin⁡z+y−z2,z
Download Help Document