## `Dom::Real` -- the field of real numbers

#### Introduction

`Dom::Real` is the field of real numbers represented by elements of the kernel domains `DOM_INT`, `DOM_RAT`, `DOM_FLOAT` and `DOM_EXPR`.

#### Creating Elements

`Dom::Real(x)`

#### Parameters

`x` | - | 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.

#### Categories

`Cat::DifferentialRing`

, `Cat::Field`, `Cat::OrderedSet`

#### Related Domains

`Dom::Complex`, `Dom::Float`, `Dom::Integer`, `Dom::Numerical`, `Dom::Rational`

#### Details

- `Dom::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.
- Elements may not have an unique representation, for example `bool(0 = sin(2)^2 + cos(2)^2 - 1)` returns `FALSE`.
- Elements of `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.
- Viewed as a differential ring, `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`.

#### Method _less: Boolean operator ``less''

- `_less(dom x, dom y)`
- - Behaves like the Boolean operator `_less`.

#### Method _leequal: Boolean operator ``less or equal''

- `_leequal(dom x, dom y)`
- - Behaves like the Boolean operator `_leequal`.

#### Method _power: power operator

- `_power(dom z, any n)`
- - This method returns zn if `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.

#### Method conjugate: complex conjugate

- `conjugate(dom x)`
- - This method returns `x`.

#### Method Im: imaginary part of a real number

- `Im(dom x)`
- - This method returns 0.

#### Method random: random number generation

- `random()`
- - This methods returns a randomly generated positive integer between 0 and 1012-1.

- `random(integer n)`
- - This method returns a random number generator which creates positive integer between 0 and n-1.

- `random(integer m..integer n)`
- - This method returns a random number generator which creates positive integer between m and n.

#### Method Re: real part of a real number

- `Re(dom x)`
- - This method returns `x`.

#### Method convert: conversion of objects

- `convert(any x)`
- - This method tries to convert `x` to a number of type `Dom::Real`. If the conversion fails, then `FAIL` is returned.

#### Method convert_to: conversion to other domains

- `convert_to(dom x, any T)`
- - This method tries to convert the number `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.
  - The following domains are allowed for `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-Domain

`Dom::Complex`

#### Axioms

`Ax::systemRep`

, `Ax::canonicalOrder`, `Ax::efficientOperation("_divide")`, `Ax::efficientOperation("_mult")`, `Ax::efficientOperation("_invert")`

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000