Documentation

Dom::Real

Field of real numbers

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

Dom::Real(x)

Description

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

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. See Example 2.

Dom::Real has category Cat::Field due to practical reasons. This domain actually is not a field because bool(1.0 = 1e100 + 1.0 - 1e100) 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çade 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::Complex as its super domain, i.e., it inherits each method which is defined by Dom::Complex and not re-implemented by Dom::Real. Methods described below are re-implemented by Dom::Real.

Dom::Complex

Examples

Example 1

The following lines demonstrate how to generate elements of Dom::Real. The rational and the floating-point numbers are elements of the real numbers:

Dom::Real(2/3) Dom::Real(0.5666) Example 2

The numbers PI and sin(2) are real numbers whereas sin(2/3 * I) + 3 and sin(x) for general symbolic x are not real numbers. If we try to create the elements Dom::Real(sin(2/3 * I) + 3) and Dom::Real(sin(x)) an error message is produced.

Dom::Real(PI) Dom::Real(sin(2)) Dom::Real(sin(2/3 * I) + 3)
Error: Invalid arguments. [Dom::Real::new]
Dom::Real(sin(x))
Error: Invalid arguments. [Dom::Real::new]

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.

Methods

expand all

Mathematical Methods

_less(x, y)

_leequal(x, y)

_power(z, n)

conjugate(x)

Im(x)

random()

random(n)

random(m .. n)

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

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

Re(x)

Conversion Methods

convert(x)

convert_to(x, T)

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.