Type::NonNegInt
-- a type and
a property representing nonnegative integersType::NonNegInt
represents nonnegative integers.
Type::NonNegInt
is a property, too, which can be used in an
assume
call.
testtype(obj,
Type::NonNegInt)
assume(x,
Type::NonNegInt)
is(ex,
Type::NonNegInt)
obj |
- | any MuPAD object |
x |
- | an identifier or one of the expressions Re(u) or Im(u) with an identifier
u |
ex |
- | an arithmetical expression |
testtype
, is
, assume
, Type::Integer
, Type::Property
testtype(obj,
Type::NonNegInt)
checks, whether obj
is a nonnegative integer number and
returns TRUE
, if it
holds, otherwise FALSE
.testtype
only
performs a syntactical test identifying MuPAD objects of type
DOM_INT
and checks, if
bool(obj >= 0)
holds.assume(x,
Type::NonNegInt) marks the identifier x
as a nonnegative
integer number.
The call is(ex,
Type::NonNegInt) derives, whether the expression ex
is a
nonnegative integer number (or this property can be derived).
assume
and is
.The following numbers are of type
Type::NonNegInt
:
>> testtype(2, Type::NonNegInt), testtype(3/4, Type::NonNegInt), testtype(55/111, Type::NonNegInt), testtype(1, Type::NonNegInt), testtype(111/111111, Type::NonNegInt)
TRUE, FALSE, FALSE, TRUE, FALSE
Assume an identifier is nonnegative rational:
>> assume(x, Type::NonNegInt): is(x, Type::NonNegInt)
TRUE
Also nonnegative integers are integers:
>> assume(x, Type::NonNegInt): is(x, Type::Integer)
TRUE
However, integers can be nonnegative or not:
>> assume(x, Type::Integer): is(x, Type::NonNegInt)
UNKNOWN
>> delete x: