Type::Negative -- a type and a
property representing negative numbers
IntroductionType::Negative represents negative numbers.
Type::Negative is a property, too, which can be used in an
assume call.
Call(s)testtype(obj, Type::Negative)
assume(x, Type::Negative)
is(ex, Type::Negative)
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::Real, Type::Property
Detailstesttype(obj, Type::Negative)
checks, whether obj is a negative real number and returns
TRUE, if it holds,
otherwise FALSE.testtype only
performs a syntactical test identifying MuPAD objects of type
DOM_INT, DOM_RAT and DOM_FLOAT and checks, if bool(obj < 0) holds. This does
not include arithmetical expressions such as -exp(1),
which are not identified as of type Type::Negative.assume(x,
Type::Negative) marks the identifier x as a negative real
number.
The call is(ex,
Type::Negative) derives, whether the expression ex is a
negative real number (or this property can be derived).
assume and is.Type::Negative the assumption can also be
assume(x < 0).
Example
1The following numbers are of type
Type::Negative:
>> testtype(-2, Type::Negative), testtype(-3/4, Type::Negative), testtype(-0.123, Type::Negative), testtype(-1, Type::Negative), testtype(-1.02, Type::Negative)
TRUE, TRUE, TRUE, TRUE, TRUE
The following expressions are exact representations of
negative numbers, but syntactically they are not of
Type::Negative:
>> testtype(-exp(1), Type::Negative), testtype(-PI^2 - 5, Type::Negative), testtype(-sin(2), Type::Negative)
FALSE, FALSE, FALSE
Example
2Assume an identifier is negative:
>> assume(x, Type::Negative): is(x, Type::Negative)
TRUE
This is equal to:
>> assume(x < 0): is(x < 0)
TRUE
Also negative numbers are real:
>> assume(x, Type::Negative): is(x, Type::Real)
TRUE
However, real numbers can be negative or not:
>> assume(x, Type::Real): is(x, Type::Negative)
UNKNOWN
>> delete x: