# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `Dom`::`ExpressionField`

Domains of expressions forming a field

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

## Syntax

### Domain Creation

`Dom::ExpressionField(<`Normal, <IsZero>`>)`

### Element Creation

`Dom::ExpressionField(Normal, IsZero)(`e`)`

## Description

### Domain Creation

`Dom::ExpressionField(Normal, IsZero)` creates a domain of expressions forming a field, where the functions `Normal` and `IsZero` are used to normalize expressions and test for zero.

The function `Normal` is used to normalize the expressions representing the elements, the function `IsZero` is used to test the expressions for zero. It is assumed that the field has characteristic 0.

The domain cannot decide if the element expressions—given the normalizing function and zero test—actually form a field. It is up to the user to choose correct functions for normalizing and zero test and to enter only valid expressions as domains elements.

One should view this domain constructor as a pragmatic way to create a field of characteristic 0 in an ad-hoc fashion. Note that the default of using `id` and `iszero` does not yield a field really, but it is often convenient and sensible to use the resulting structure as a field.

`Normal` must be a function which takes an expression representing a domain element and returns the normalized expression. `Normal` should return `FAIL` if the expression is not valid.

If `Normal` is not given, then the system function `id` is used, i.e., only the kernel simplifier is used to normalize expressions.

If a normalizing function other than `id` is given, it is assumed that this functions returns a normal form where the zero element is uniquely represented by the constant `0`.

`IsZero` must be a function which takes an expression representing a domain element and returns `TRUE` if the expression represents zero and `FALSE` otherwise.

If `IsZero` is not given, then ```iszero @ Normal``` is used for zero testing. If `Normal` is equal to `id` this functional expression is simplified to `iszero`.

If `Normal` is equal to `id` and `IsZero` is equal to `iszero`, a façade domain is created, i.e., the domain elements are simply expressions and are not explicitly created by `new`.

Otherwise the elements of the domain are explicitly created by `new`. Each such element has one operand, which is the expression representing the domain element. The element expressions are normalized after each operation using the function `Normal`.

### Element Creation

`Dom::ExpressionField(Normal, IsZero)(e)` creates a field element represented by the expression `e`. The expression is normalized using the function `Normal`.

If `Normal` returns `FAIL`, it is assumed that the expression does not represent a valid field element. If this test is not fully implemented the domain cannot decide if the expression represents a valid field element. In this case it is up to the user to enter only valid expressions as field elements.

If `Normal` is equal to `id` and `IsZero` is equal to `iszero`, the domain is only a façade domain. In this case the expression `e` is returned after being simplified by the built-in kernel simplifier.

## Superdomain

If `Normal = id` and `IsZero = iszero`, then `Dom::ArithmeticalExpression`, else `Dom::BaseDomain`.

## Axioms

`Ax::indetElements`

If `Normal = id` and `IsZero = iszero`, then ``` Ax::efficientOperation ("_divide"), Ax::efficientOperation ("_mult"), Ax::efficientOperation("_invert")```, else `Ax::normalRep`.

If `Normal = id` and ```IsZero = iszero``` and `IsZero = iszero`, then `Ax::systemRep`.

## Examples

### Example 1

`Dom::ExpressionField(normal)` creates a field of rational expressions over the rationals. The expressions representing the field elements are allways normalized by `normal`:

```Fn := Dom::ExpressionField(normal): a := Fn((x^2 - 1)/(x - 1))```

The field elements are explicit elements of the domain:

`domtype(a)`

### Example 2

In the domain `Dom::ExpressionField(id, iszero@normal)` the expressions representing the elements are normalized by the kernel simplifier only:

```Fi := Dom::ExpressionField(id, iszero@normal): a := Fi((x^2 - 1)/(x - 1))```

The elements of this domain are not normalized (when viewed as rational expressions over the rationals), thus the domain does not have the axiom `Ax::normalRep`:

`b := a/Fi(x + 1) - Fi(1)`

But nevertheless this domain also represents the field of rational expressions over the rationals, because zero is detected correctly by the function `iszero @ normal`:

`iszero(b)`

## Parameters

 `Normal` A function used to normalize the expressions of the domain; default is `id`. `IsZero` A function used to test the expressions of the domain for zero; default is `iszero @ Normal`. `e` An expression representing a field element.

## Entries

 "characteristic" The characteristic of the fields created by this constructor is assumed to be `0`. "one" The element represented by the expression `1` is assumed to be a neutral element w.r.t. `"_mult"`. "zero" The element represented by the expression `0` is assumed to be a neutral element w.r.t. `"_plus"`.

## Methods

expand all

#### Mathematical Methods

`abs(x)`

Overloads the function `abs`, thus may be called via `abs(x)`.

`combine(x, <a>)`

Overloads the function `combine`, thus may be called via `combine(x,...)`.

`conjugate(x)`

Overloads the function `conjugate`, thus may be called via `conjugate(x)`.

`D(<l>, x)`

Overloads the function `D`, thus may be called via `D(x)` or ```D(l, x)```.

`denom(x)`

Overloads the function `denom`, thus may be called via `denom(x)`.

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

Overloads the function `diff`, thus may be called via `diff(x,...)`.

`_divide(x, y)`

Overloads the function `_divide`, thus may be called via `x/y` or ```_divide(x, y)```.

`equal(x, y)`

`expand(x)`

Overloads the function `expand`, thus may be called via `expand(x)`.

`factor(x)`

Overloads the function `factor`, thus may be called via `factor(x)`.

`float(x)`

Overloads the function `float`, thus may be called via `float(x)`.

`gcd(x, …)`

Overloads the function `gcd`, thus may be called via `gcd(x,...)`.

`Im(x)`

Overloads the function `Im`, thus may be called via `Im(x)`.

`int(x, <v>)`

Overloads the function `int`, thus may be called via `int(x,...)`.

`intmult(x, n)`

`_invert(x)`

Overloads the function `_invert`, thus may be called via `1/x` or `_invert(x)`.

`iszero(x)`

Overloads the function `iszero`, thus may be called via `iszero(x)`.

`lcm(x, …)`

Overloads the function `lcm`, thus may be called via `lcm(x, ...)`.

`_leequal(x, y)`

Please note that the function `_leequal` can only test numbers (in a syntactical sense), but not constant expressions like PI or `sqrt(2)`.

Overloads the function `_leequal`, thus may be called via `x <= y`, ```y >= x``` or `_leequal(x, y)`.

`_less(x, y)`

Please note that the function `_less` can only test numbers (in a syntactical sense), but not constant expressions like PI or `sqrt(2)`.

Overloads the function `_less`, thus may be called via `x < y`, ```y > x``` or `_less(x, y)`.

`limit(x, <v, …>)`

Overloads the function `limit`, thus may be called via `limit(x,...)`.

`max(x, …)`

Overloads the function `max`, thus may be called via `max(x,...)`.

`min(x, …)`

Overloads the function `min`, thus may be called via `min(x,...)`.

`_mult(x, …)`

If all arguments are of this domain or can be coerced to this domain (using the method `coerce`), the product of the expressions representing the arguments is calculated using the function `_mult`.

If one of the arguments cannot be coerced, the arguments up to the offending one are multiplied and then the method `"_mult"` of the domain of the offending argument is called to multiply the remaining arguments.

Overloads the function `_mult`, thus may be called via `x*...` or `_mult(x,...)`.

`_negate(x)`

Overloads the function `_negate`, thus may be called via `-x` or `_negate(x)`.

`norm(x)`

Overloads the function `norm`, thus may be called via `norm(x)`.

Please note that the system function `norm`, applied to an expression, computes the norm of that expression interpreted as a polynomial expression and not the absolute value of the expression. This may be regarded as an inconsistency.

`normal(x)`

Overloads the function `normal`, thus may be called via `normal(x)`.

`numer(x)`

Overloads the function `numer`, thus may be called via `numer(x)`.

`_plus(x, …)`

If all arguments are of this domain or can be coerced to this domain (using the method `coerce`) the sum of the expressions representing the arguments is calculated using the function `_plus`.

If one of the arguments cannot be coerced the arguments up to the offending one are added and then the method `"_plus"` of the domain of the offending argument is called to add the remaining arguments.

Overloads the function `_plus`, thus may be called via `x+...` or `_plus(x,...)`.

`_power(x, y)`

`_power(x, y)`

If both arguments are of this domain the power is calculated by mapping the function `_power` to the expressions representing the arguments.

If one of the arguments is not of this domain it is coerced to this domain, then the power is computed. If the coercion fails an error is raised.

Note that it is assumed that at least one of the arguments is of this domain.

Overloads the function `_power`, thus may be called via `x^y` or ```_power(x, y)```.

`radsimp(x)`

Overloads the function `radsimp`, thus may be called via `radsimp(x)`.

`random()`

See `polylib::randpoly` for details about creating random polynomials.

`Re(x)`

Overloads the function `Re`, thus may be called via `Re(x)`.

`sign(x)`

Overloads the function `sign`, thus may be called via `sign(x)`.

`simplify(x, <a>)`

Overloads the function `simplify`, thus may be called via `simplify(x,...)`.

`solve(x, <a, …>)`

Note that this method will never return an element of this domain. See `solve` for details about results and optional additional arguments.

Overloads the function `solve`, thus may be called via `solve(x,...)`.

`sqrfree(x)`

Overloads the function `polylib::sqrfree`, thus may be called via `polylib::sqrfree(x)`.

`_subtract(x, y)`

Overloads the function `_subtract`, thus may be called via `x-y` or ```_subtract(x, y)```.

#### Conversion Methods

`convert(x)`

`convert_to(x, T)`

`expr(x)`

This method is called by the function `expr` if a subexpression of the argument is an element of this domain.

`new(x)`

Overloads the function call operator for this domain, thus may be called via `F(x)` where `F` is this domain.

#### Access Methods

`nops(x)`

Overloads the function `nops`, thus may be called via `nops(x)`.

`op(x)`

`op(x, i)`

Returns the operand with index `i` of the expression representing `x`. If `i` is `0` then the operator of the expression is returned, which usually is not an element of this domain. The other operands are converted to elements of this domain.

This method is called by the function `op` when an element of this domain is contained, as a subexpression, in the first argument of `op`. Operand ranges and paths are handled by `op` and need not be handled by this method. See `op` for details.

`subs(x, e, …)`

Maps `subs` to the expression representing `x`. The resulting expression is converted to an element of this domain.

This method is called by the function `subs` when an element of this domain is contained, as a subexpression, in the first argument of `subs`. See `subs` for details.

```subsex(x, e, , …)```

Maps `subsex` to the expression representing `x`. The resulting expression is converted to an element of this domain.

This method is called by the function `subsex` when an element of this domain is contained, as a subexpression, in the first argument of `subsex`. See `subsex` for details.

```subsop(x, e, , …)```

This method is called by the function `subsop` when an element of this domain is contained, as a subexpression, in the first argument of `subsop`. Operand ranges and paths are handled by `subsop` and need not be handled by this method. See `subsop` for details.

#### Technical Methods

`indets(x, <optionName>)`

Overloads the function `indets`, thus may be called via `indets(x)` and ```indets(x, optionName)```, respectively.

`length(x)`

Overloads the function `length`, thus may be called via `length(x)`.

```map(x, f, <a, …>)```

Overloads the function `map`, thus may be called via `map(x, f,...)`.

```rationalize(x, <a, …>)```

Note that this method does not overload the function `rationalize` from the standard library package, but the function `numeric::rationalize` from the `numeric` package instead. Thus the method may be called via `numeric::rationalize(x,...)`.

`pivotSize(x)`