Type::NonNegRat
-- a type and
a property representing nonnegative rational numbersType::NonNegRat
represents nonnegative rational
numbers. Type::NonNegRat
is a property, too, which can be used in an
assume
call.
testtype(obj,
Type::NonNegRat)
assume(x,
Type::NonNegRat)
is(ex,
Type::NonNegRat)
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::Rational
, Type::Property
testtype(obj,
Type::NonNegRat)
checks, whether obj
is a nonnegative rational number and
returns TRUE
, if it
holds, otherwise FALSE
.testtype
only
performs a syntactical test identifying MuPAD objects of type
DOM_INT
and DOM_RAT
and checks, if bool(obj >= 0)
holds.assume(x,
Type::NonNegRat) marks the identifier x
as a nonnegative
rational number.
The call is(ex,
Type::NonNegRat) derives, whether the expression ex
is a
nonnegative rational number (or this property can be derived).
assume
and is
.The following numbers are of type
Type::NonNegRat
:
>> testtype(2, Type::NonNegRat), testtype(3/4, Type::NonNegRat), testtype(55/111, Type::NonNegRat), testtype(0, Type::NonNegRat), testtype(111/111111, Type::NonNegRat)
TRUE, TRUE, TRUE, TRUE, TRUE
Assume an identifier is nonnegative rational:
>> assume(x, Type::NonNegRat): is(x, Type::NonNegRat)
TRUE
Also nonnegative rational numbers are rational:
>> assume(x, Type::NonNegRat): is(x, Type::Rational)
TRUE
However, rational numbers can be nonnegative rational or not:
>> assume(x, Type::Rational): is(x, Type::NonNegRat)
UNKNOWN
>> delete x: