Type::PosInt -- a type and a
property representing positive integers
IntroductionType::PosInt represents positive integers.
Type::PosInt is a property, too, which can be used in an
assume call.
Call(s)testtype(obj, Type::PosInt)
assume(x, Type::PosInt)
is(ex, Type::PosInt)
Parametersobj |
- | any MuPAD object |
x |
- | an identifier or one of the expressions Re(u) or Im(u) with an identifier
u |
ex |
- | an arithmetical expression |
Returns
Related
Functionstesttype, is, assume, Type::Property
Detailstesttype(obj, Type::PosInt) checks,
whether obj is a positive 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::PosInt) marks the identifier x as a positive integer
number.
The call is(ex,
Type::PosInt) derives, whether the expression ex is a
positive integer number (or this property can be derived).
assume and is.
Example
1The following numbers are of type
Type::PosInt:
>> testtype(2, Type::PosInt), testtype(3, Type::PosInt), testtype(55, Type::PosInt), testtype(1, Type::PosInt), testtype(111, Type::PosInt)
TRUE, TRUE, TRUE, TRUE, TRUE
Example
2Assume an identifier is positive integer:
>> assume(x, Type::PosInt): is(x, Type::PosInt)
TRUE
Also positive integers are integers:
>> assume(x, Type::PosInt): is(x, Type::Integer)
TRUE
However, integers can be positive or not:
>> assume(x, Type::Integer): is(x, Type::PosInt)
UNKNOWN
>> delete x: