Type::Odd
-- a type and a property
representing odd integersType::Odd
represents odd integers.
Type::Odd
is a property, too, which can be used in an
assume
call.
testtype(obj,
Type::Odd)
assume(x,
Type::Odd)
is(ex,
Type::Odd)
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::Even
, Type::Property
testtype(obj,
Type::Odd) checks,
whether obj
is an odd 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(domtype((x-1)/2) =
DOM_INT)
holds.assume(x,
Type::Odd) marks the identifier x
as an odd number.
The call is(ex,
Type::Odd) derives, whether the expression ex
is an odd
number (or this property can be derived).
assume
and is
.The following numbers are of type
Type::Odd
:
>> testtype(1, Type::Odd), testtype(-3, Type::Odd), testtype(7, Type::Odd), testtype(-11113, Type::Odd), testtype(4185296581467695597, Type::Odd)
TRUE, TRUE, TRUE, TRUE, TRUE
Assume an identifier is odd:
>> assume(x, Type::Odd): is(x, Type::Odd)
TRUE
All odd numbers are integer:
>> assume(x, Type::Odd): is(x, Type::Integer)
TRUE
However, integers can be odd or not:
>> assume(x, Type::Integer): is(x, Type::Odd)
UNKNOWN
However, even numbers are not odd:
>> assume(x, Type::Odd): is(2*x, Type::Odd)
FALSE
>> assume(n, Type::Even): is(x*n, Type::Odd)
FALSE
>> is(x*n + 1, Type::Odd)
TRUE
>> delete x, n: