Documentation

# `Dom`::`Numerical`

Field of 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.

## Syntax

```Dom::Numerical(`x`)
```

## Description

`Dom::Numerical` is the field of numbers.

`Dom::Numerical` is the domain of numbers represented by one of the kernel domains `DOM_INT`, `DOM_RAT`, `DOM_FLOAT`, or `DOM_COMPLEX`.

`Dom::Numerical` is of category `Cat::Field` due to pragmatism. This domain actually is not a field because ```bool(1.0 = float(3) / float(3))``` returns `FALSE`, for example.

Elements of `Dom::Numerical` are usually not created explicitly. However, if one creates elements using the usual syntax, it is checked whether the input expression can be converted into a number (see below).

This means that `Dom::Numerical` is a façade domain which creates elements of domain type `DOM_INT`, `DOM_RAT`, `DOM_FLOAT` or `DOM_COMPLEX`. Every system function dealing with numbers can be applied, and computations in this domain are performed efficiently.

`Dom::Numerical` has no normal representation, because `0` and `0.0` both represent zero.

Viewed as a differential ring, `Dom::Numerical` is trivial. It only contains constants.

If `x` is a constant arithmetical expression such as `sin(2)` or ```PI + 2```, the system function `float` is applied to convert `x` into a floating-point approximation.

An error message is issued if the result of this conversion is not of domain type `DOM_FLOAT` or `DOM_COMPLEX`.

## Superdomain

`Dom::ArithmeticalExpression`

## Axioms

`Ax::canonicalRep`, `Ax::systemRep`, `Ax::efficientOperation``("_divide")`, `Ax::efficientOperation``("_mult")`, `Ax::efficientOperation``("_invert")`

## Examples

### Example 1

`Dom::Numerical` contains numbers of the domains `DOM_INT`, `DOM_RAT`, `DOM_FLOAT` and `DOM_COMPLEX`:

```Dom::Numerical(2), Dom::Numerical(2/3), Dom::Numerical(3.141), Dom::Numerical(2 + 3*I)```
` `

Constant arithmetical expressions are converted into a real and complex floating-point number, respectively, i.e., into an element of the domain `DOM_FLOAT` or `DOM_COMPLEX` (see the function `float` for details):

`Dom::Numerical(exp(5)), Dom::Numerical(sin(2/3*I) + 3)`
` `

Note that the elements of this domain are elements of kernel domains, there are no elements of the domain type `Dom::Numerical`!

An error message is issued for non-constant arithmetical expressions:

`Dom::Numerical(sin(x))`
```Error: Invalid arguments. [Dom::Numerical::new] ```

### Example 2

`Dom::Numerical` is regarded as a field, and it therefore can be used as a coefficient ring of polynomials or as a component ring of matrices, for example.

We create the domain of matrices of arbitrary size (see `Dom::Matrix`) with numerical components:

`MatN := Dom::Matrix(Dom::Numerical)`
` `

Next we create a banded matrix, such as:

`A := MatN(4, 4, [-PI, 0, PI], Banded)`
` `

and a row vector with four components as a 1 ×4 matrix:

`v := MatN([[2, 3, -1, 0]])`
` `

Vector-matrix multiplication can be performed with the standard operator `*` for multiplication:

`v * A`
` `

Finally we compute the determinant of the matrix `A`, using the function `det`:

`det(A)`
` `

## Parameters

 `x`

## Entries

 "characteristic" is zero.

## Methods

expand all

#### Mathematical Methods

`D(a)`

See the function `D` for details and further calling sequences.

`diff(a, x)`

See the function `diff` for details and further calling sequences.

`norm(a)`

`random()`

#### Conversion Methods

`convert(x)`

If `x` is of the domain type `DOM_INT`, `DOM_RAT`, `DOM_FLOAT` or `DOM_COMPLEX`, `x` is returned.

Otherwise `float(x)` is computed and the result is returned, if it is of the domain type `DOM_FLOAT` or `DOM_COMPLEX`. If it is not, `FAIL` is returned.

`convert_to(a, T)`

If the conversion fails, `FAIL` is returned.

It currently handles the following domains for `T`: `DOM_INT`, `Dom::Integer`, `DOM_RAT`, `Dom::Rational`, `DOM_FLOAT`, `Dom::Float` and `DOM_COMPLEX`.

`testtype(a, T)`

This method is called from the function `testtype`.

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos