Type::Constant
-- a type
representing constant objectsType::Constant
represents constant objects, i.e.,
objects not containing symbolic identifiers.
testtype(obj,
Type::Constant)
obj |
- | any MuPAD object |
see testtype
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.assume
to mark an
identifier as a constant.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