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