Type::PosRat -- a type and a
property representing positive rational numbers
IntroductionType::PosRat represents positive rational numbers.
Type::PosRat is a property, too, which can be used in an
assume call.
Call(s)testtype(obj, Type::PosRat)
assume(x, Type::PosRat)
is(ex, Type::PosRat)
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::PosRat) checks,
whether obj is a positive 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::PosRat) marks the identifier x as a positive
rational number.
The call is(ex,
Type::PosRat) derives, whether the expression ex is a
positive rational number (or this property can be derived).
assume and is.
Example
1The following numbers are of type
Type::PosRat:
>> testtype(2, Type::PosRat), testtype(3/4, Type::PosRat), testtype(55/111, Type::PosRat), testtype(1, Type::PosRat), testtype(111/111111, Type::PosRat)
TRUE, TRUE, TRUE, TRUE, TRUE
Example
2Assume an identifier is positive rational:
>> assume(x, Type::PosRat): is(x, Type::PosRat)
TRUE
Also positive rational numbers are rational:
>> assume(x, Type::PosRat): is(x, Type::Rational)
TRUE
However, rational numbers can be positive rational or not:
>> assume(x, Type::Rational): is(x, Type::PosRat)
UNKNOWN
>> delete x: