Type::Real -- a type and a property
representing real numbers
IntroductionType::Real represents real numbers.
Type::Real is a property, too, which can be used in an
assume call.
Call(s)testtype(obj, Type::Real)
assume(x, Type::Real)
is(ex, Type::Real)
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::Real) checks,
whether obj is a real number and, if it is, returns
TRUE, otherwise FALSE.testtype only
performs a syntactical test identifying MuPAD objects of type
DOM_INT, DOM_RAT and DOM_FLOAT. This does not include
arithmetical expressions such as exp(1), which are not
identified as of type Type::Real.assume(x,
Type::Real) marks the identifier x as a real number.
The call is(ex,
Type::Real) derives, whether the expression ex is a real
number (or this property can be derived).
assume and is.
Example
1The following numbers are of type
Type::Real:
>> testtype(2, Type::Real), testtype(3/4, Type::Real), testtype(0.123, Type::Real), testtype(-1, Type::Real), testtype(-1.02, Type::Real)
TRUE, TRUE, TRUE, TRUE, TRUE
The following expressions are exact representations of
real numbers, but syntactically they are not of
Type::Real:
>> testtype(exp(1), Type::Real), testtype(PI^2 + 5, Type::Real), testtype(sin(2), Type::Real)
FALSE, FALSE, FALSE
The function is performs a semantical, mathematically
more useful check:
>> is(exp(1), Type::Real), is(PI^2 + 5, Type::Real), is(sin(2), Type::Real)
TRUE, TRUE, TRUE
Example
2Integers are real numbers:
>> assume(x, Type::Integer): is(x, Type::Real)
TRUE
But real numbers can be integer or not:
>> assume(x, Type::Real): is(x, Type::Integer)
UNKNOWN
The sine of a real number is a real number in the interval [-1,1]:
>> getprop(sin(x))
[-1, 1] of Type::Real
>> delete x: