Type::Odd -- a type and a property
representing odd integers
IntroductionType::Odd represents odd integers.
Type::Odd is a property, too, which can be used in an
assume call.
Call(s)testtype(obj, Type::Odd)
assume(x, Type::Odd)
is(ex, Type::Odd)
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::Even, Type::Property
Detailstesttype(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.
Example
1The 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
Example
2Assume 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: