type/constant - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/constant

type/constant

check for a constant

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

type(x, constant)

constants

constants := constants, y

Parameters

x

-

any expression

y

-

a symbol

Description

• 

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 it r is a constant, and otherwise it is not.

Examples

type5,constant

true

(1)

type0.05,constant

true

(2)

typelnπ,constant

true

(3)

type,constant

true

(4)

typeg1,constant

true

(5)

typefalse,constant

true

(6)

typex2,constant

false

(7)

constants

false,γ,,true,Catalan,FAIL,π

(8)

typefexpγ+3+14,constant

true

(9)

typefexpγ+x+14,constant

false

(10)

constantsconstants,x

constantsfalse,γ,,true,Catalan,FAIL,π,x

(11)

typefexpγ+x+14,constant

true

(12)

Here are two examples of RootOf calls, one a constant, the other not:

r1RootOfsinz+π6z2,z

r1RootOfsin_Z+π6+_Z2

(13)

indetsr1,name

π

(14)

typer1,constant

true

(15)

r2RootOfsinz+yz2,z

r2RootOfsin_Z+y+_Z2

(16)

indetsr2,name

y

(17)

typer2,constant

false

(18)

See Also

evalf/details

float

fraction

integer

type

type/complex

type/complexcons

type/numeric

type/realcons

undefined