Type::Positive
-- a type and a
property representing positive numbersType::Positive
represents positive numbers.
Type::Positive
is a property, too, which can be used in an
assume
call.
testtype(obj,
Type::Positive)
assume(x,
Type::Positive)
is(ex,
Type::Positive)
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::Property
testtype(obj,
Type::Positive)
checks, whether obj
is a positive 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::Positive
.assume(x,
Type::Positive) marks the identifier x
as a positive real
number.
The call is(ex,
Type::Positive) derives, whether the expression ex
is a
positive real number (or this property can be derived).
assume
and is
.Type::Positive
the assumption can also be
assume(x > 0)
.The following numbers are of type
Type::Positive
:
>> testtype(2, Type::Positive), testtype(3/4, Type::Positive), testtype(0.123, Type::Positive), testtype(1, Type::Positive), testtype(1.02, Type::Positive)
TRUE, TRUE, TRUE, TRUE, TRUE
The following expressions are exact representations of
positive numbers, but syntactically they are not of
Type::Positive
:
>> testtype(exp(1), Type::Positive), testtype(PI^2 + 5, Type::Positive), testtype(sin(2), Type::Positive)
FALSE, FALSE, FALSE
Ths function is
, however, realizes that they are,
indeed, positive:
>> is(exp(1), Type::Positive), is(PI^2 + 5, Type::Positive), is(sin(2), Type::Positive)
TRUE, TRUE, TRUE
Assume an identifier is positive:
>> assume(x, Type::Positive): is(x, Type::Positive)
TRUE
This is equivalent to:
>> assume(x > 0): is(x > 0)
TRUE
Also positive numbers are real:
>> assume(x, Type::Positive): is(x, Type::Real)
TRUE
But real numbers can be positive or not:
>> assume(x, Type::Real): is(x, Type::Positive)
UNKNOWN
>> delete x: