## `Type::Constant` -- a type representing constant objects

#### Introduction

`Type::Constant` represents constant objects, i.e., objects not containing symbolic identifiers.

#### Call(s)

`testtype(obj,` Type::Constant)

#### Parameters

`obj` | - | any MuPAD object

#### Returns

see `testtype`

#### Related Functions

`testtype`

#### Details

- Numbers, strings, Boolean constants, points, polygons, `NIL`, `FAIL` and the identifiers `PI`, `EULER` and `CATALAN` in the set `Type::ConstantIdents` are regarded as constant objects. A composite object is constant, if all its operands are constant.
- Any function is identified as a constant, if all arguments are constant, also if the function is not defined (e.g., an identifier).
- This type does not represent a property: it cannot be used in `assume` to mark an identifier as a constant.

#### Example 1

The following objects are elementary constants:

    >> testtype(3, Type::Constant),
       testtype(sin(3/2), Type::Constant),
       testtype(TRUE, Type::Constant),
       testtype("MuPAD", Type::Constant),
       testtype(FAIL, Type::Constant)

                           TRUE, TRUE, TRUE, TRUE, TRUE

The following expression contains an indeterminate x and, consequently, is not a constant object:

    >> testtype(exp(x + 1), Type::Constant)

                                       FALSE

All constant operands of an expression are selected:

    >> select(x^2 + 3*x - 2, testtype, Type::Constant)

                                        -2

Any function call is considered constant, if the arguments are constant:

    >> testtype(f(1, 2, 3, 4), Type::Constant)

                                       TRUE

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000