Dom::Real -- the field of real
numbers
IntroductionDom::Real is the field of real numbers represented by
elements of the kernel domains DOM_INT, DOM_RAT, DOM_FLOAT and DOM_EXPR.
Creating
ElementsDom::Real(x)
Parametersx |
- | An expression of type DOM_INT,
DOM_RAT or DOM_FLOAT. An expression of type
DOM_EXPR is also allowed if it is of type Type::Arithmetical and if it
contains no indeterminates which are not of type Type::ConstantIdents and if it
contains no imaginary part. |
Cat::DifferentialRing
Related
DomainsDom::Complex, Dom::Float, Dom::Integer, Dom::Numerical, Dom::Rational
DetailsDom::Real is the domain of real numbers represented by
expressions of type DOM_INT, DOM_RAT or
DOM_FLOAT. An expression of type DOM_EXPR is
considered as a real number if it is of type Type::Arithmetical and if it
contains no indeterminates which are not of type Type::ConstantIdents and if it
contains no imaginary part, cf. Example 2.Dom::Real has category Cat::Field because of pragmatism. This
domain actually is not a field because bool(1.0 = float(3) / float(3)) returns
FALSE for example.bool(0 = sin(2)^2 + cos(2)^2 - 1) returns FALSE.Dom::Real are usually not created
explicitly. However, if one creates elements using the usual syntax, it
is checked whether the input expression can be converted to a number.
This means Dom::Real is a faēcade domain which creates
elements of domain type DOM_INT, DOM_RAT,
DOM_FLOAT or DOM_EXPR.Dom::Real has no normal representation, because
0 and 0.0 both represent zero.Dom::Real is trivial,
it contains constants only.Dom::Real has the domain Dom::Numerical as its super domain,
i.e., it inherits each method which is defined by
Dom::Numerical and not re-implemented by
Dom::Real. Methods described below are re-implemented by
Dom::Real._less(dom x, dom
y)_less._leequal(dom x, dom
y)_leequal._power(dom z, any
n)n is
an integer, a floating point or a rational number or if n
can be converted to a Dom::Real. Otherwise, an error
message is issued.conjugate(dom x)x.Im(dom x)random()random(integer n)random(integer m..integer n)Re(dom x)x.convert(any x)x to a number of type
Dom::Real. If the conversion fails, then FAIL is returned.convert_to(dom x, any
T)x to an
element of type T, or, if T is not a domain,
to the domain type of T. If the conversion fails, then
FAIL is returned.T: DOM_INT, Dom::Integer, DOM_RAT, Dom::Rational, DOM_FLOAT, Dom::Float, Dom::Numerical, Dom::ArithmeticalExpression,
Dom::Complex.
Example
1>> Dom::Real(2/3)
2/3
>> Dom::Real(0.5666)
0.5666
Example
2>> Dom::Real(PI)
PI
>> Dom::Real(sin(2))
sin(2)
>> Dom::Real(sin(2/3 * I) + 3)
Error: illegal arguments [Dom::Real::new]
>> Dom::Real(sin(x))
Error: illegal arguments [Dom::Real::new]
Super-DomainAx::systemRep
, Ax::canonicalOrder, Ax::efficientOperation("_divide"),
Ax::efficientOperation("_mult"),
Ax::efficientOperation("_invert")