Documentation

# `Dom`::`Complex`

Field of complex 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::Complex(`x`)
```

## Description

`Dom::Complex` is the domain of complex constants represented by expressions of type `DOM_INT`, `DOM_RAT`, `DOM_FLOAT` or `DOM_COMPLEX`. An expression of type `DOM_EXPR` is considered a complex number if it is of type `Type::Arithmetical` and if it contains only indeterminates which are of type `Type::ConstantIdents` or if it contains no indeterminates, cf. Example 2.

`Dom::Complex` 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::Complex` 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::Complex` is a facade domain which creates elements of domain type `DOM_INT`, `DOM_RAT`, `DOM_FLOAT`, `DOM_COMPLEX` or `DOM_EXPR`.

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

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

`Dom::Complex` has the domain `Dom::BaseDomain` as its super domain, i.e., it inherits each method which is defined by `Dom::BaseDomain` and not re-implemented by `Dom::Complex`. Methods described below are re-implemented by `Dom::Complex`.

## Superdomain

`Dom::ArithmeticalExpression`

## Axioms

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

## Examples

### Example 1

Creating some complex numbers using `Dom::Complex`:

`Dom::Complex(2/3)`
` `
`Dom::Complex(2/3 + 4*I)`
` `

### Example 2

It's also possible to use expressions or constants for creating an element of `Dom::Complex`:

`Dom::Complex(PI)`
` `
`Dom::Complex(sin(2))`
` `
`Dom::Complex(sin(2/3*I) + 3)`
` `

If the expression cannot be converted to an element of `Dom::Complex` we will get an error message:

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

## Parameters

 `x` An expression of type `DOM_INT`, `DOM_RAT`, `DOM_FLOAT`, `DOM_COMPLEX`. An expression of type `DOM_EXPR` is also possible if it is of type `Type::Arithmetical` and if it contains only indeterminates which are of type `Type::ConstantIdents` or if it contains no indeterminates.

## Entries

 "characteristic" the characteristic of this field is 0. "one" the unit element; it equals `1`. "zero" The zero element; it equals `0`.

## Methods

expand all

#### Mathematical Methods

`_divide(x, y)`

`_invert(x)`

`_mult(x, y, …)`

`_negate(x)`

`_plus(x, y, …)`

`_power(x, y)`

`_unequal(x, y)`

`conjugate(x)`

`D(x)`

`diff(z, <x, …>)`

`equal(x, y)`

`expr(x)`

`iszero(x)`

`norm(x)`

`random()`

`random(n)`

`random(m .. n)`

`random(n)` returns a random number generator which creates complex random numbers where the real parts and the imaginary parts are positive integers between 0 and n - 1.

`random(m..n)` returns a random number generator which creates complex random numbers where the real parts and the imaginary parts are positive integers between m and n.

`unequal(x, y)`

#### Conversion Methods

`convert(x)`

An arithmetical expression can be converted if it only contains subexpression of the types just mentioned.

If the conversion fails, `FAIL` is returned.

`convert_to(x, T)`

If the conversion fails, `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_COMPLEX` and `DOM_EXPR`.

`normal(x)`

#### Mathematical Modeling with Symbolic Math Toolbox

Get examples and videos