## `Dom::ArithmeticalExpression` -- the domains of arithmetical expressions

#### Introduction

`Dom::ArithmeticalExpression` creates the domain of arithmetical expressions built up by the system functions and operators like `+` and `*`.

#### Creating Elements

`Dom::ArithmeticalExpression(x)`

#### Parameters

`x` | - | an arithmetical expression

#### Categories

`Cat::BaseCategory`

#### Related Domains

`Dom::Expression`

#### Details

- `Dom::ArithmeticalExpression` is a faēcade domain of arithmetical expressions built up by the system functions and operators like `+` and `*`.
- This domain has almost no algebraic structure because unqualified expressions have no normal form. (For example, there are rational expressions for zero which are not normalized to `0`.) The main purpose of `Dom::ArithmeticalExpression` is to provide implementations for methods used by faēcade sub-domains like `Dom::Integer` which are represented by a subset of the arithmetical expressions.
- Elements of `Dom::ArithmeticalExpression` are usually not created explicitly. However, if one creates elements using the usual syntax, the input is converted to an expression using `expr`, then it is checked whether the result is an arithmetical expression.

#### Entries

key

  The name of this domain.

one

  The neutral element w.r.t. `"_mult"`: the constant `1`.

zero

  The neutral element w.r.t. `"_plus"`: the constant `0`.

#### Method _divide: divides arithmetical expressions

- `_divide(dom f, dom g)`
- - Returns the arithmetical expression `f/g`.
  - This method overloads the function `_divide`.
  - For details, please see `_divide`.

#### Method _invert: inverts an arithmetical expression

- `_invert(dom f)`
- - Returns the arithmetical expression `1/f`.
  - This method overloads the function `_invert`.
  - For details, please see `_invert`.

#### Method _mult: multiplies arithmetical expressions

- `_mult( <f,g...> )`
- - Multiplies an arbitrary number of arithmetical expressions and returns the (simplified) arithmetical expression `f*g*...`
  - This method overloads the function `_mult`.
  - For details, please see `_mult`.

#### Method _negate: negates an arithmetical expression

- `_negate(dom f)`
- - Returns the arithmetical expression `-f`.
  - This method overloads the function `_negate`.
  - For details, please see `_negate`.

#### Method _plus: adds arithmetical expressions

- `_plus( <f,g...> )`
- - Adds an arbitrary number of arithmetical expressions and returns the (simplified) arithmetical expression `f+g+...`
  - This method overloads the function `_plus`.
  - For details, please see `_plus`.

#### Method _power: power operator

- `_power(dom f, dom g)`
- - Returns the arithmetical expression `f^g`.
  - This method overloads the function `_power`.
  - For details, please see `_power`.

#### Method _subtract: subtracts an arithmetical expression

- `_subtract(dom f, dom g)`
- - Returns the arithmetical expression `f-g`.
  - For details, please see `_subtract`.

#### Method D: differential operator for functions

- `D(function f)`
- `D(list of nonnegative integers [n1,...], function f)`
- - `D(f)` computes the derivative of `f` and returns a function or functional expression which may contain unevaluated calls of `D`.
  - This method overloads the function `D`.
  - For details, please see `D`.

#### Method diff: differentiates an arithmetical expression

- `diff(dom f <,x...>)`
- - Differentiates `f` with respect to the given sequence of variables in the given order and returns an arithmetical expression. If `x` is not a variable, `f` will be evaluated and returned without differentiation.
  - This method overloads the function `diff`.
  - For details, please see `diff`.

#### Method intmult: multiplies an arithmetical expression with an integer

- `intmult(dom f, integer n)`
- - Returns the arithmetical expression `f*n`.
  - This method overloads the function `_mult`.
  - For details, please see `_mult`.

#### Method iszero: test for zero

- `iszero(dom f)`
- - Tests whether `f` is zero and returns `TRUE` or `FALSE`.
  - This method overloads the function `iszero`.
  - For details, please see `iszero`.

#### Method max: maximum of numbers

- `max(dom x <,y...> )`
- - Calculates the maximum of numerical elements. If one of the arguments cannot be evaluated to a number, then the function call with all non-numerical and the minimum of the numerical arguments is returned.
  - All numerical arguments must be real.
  - This method overloads the function `max`.
  - For details, please see `max`.

#### Method min: minimum of numbers

- `min(dom x <,y...> )`
- - Calculates the minimum of numerical elements. If one of the arguments cannot be evaluated to a number, then the function call with all non-numerical and the minimum of the numerical arguments is returned.
  - All numerical arguments must be real.
  - This method overloads the function `min`.
  - For details, please see `min`.

#### Method norm: norm of an arithmetical expression

- `norm(dom f)`
- - Computes the norm of `f` as the absolute value of `f`.
  - This method overloads the function `abs`.
  - For details, please see `abs`.

#### Method convert: check for being an arithmetical expression

- `convert(any x)`
- - Tests whether `x` is an arithmetical expression. If yes, `x` is returned; otherwise the result is `FAIL`.

#### Example 1

For brevity, we will use `AE` as a shorthand notation for `Dom::ArithmeticalExpression`:

    >> AE := Dom::ArithmeticalExpression

                            Dom::ArithmeticalExpression

An element of this domain can not be created as follows:

    >> e := AE(2*sin(x) + f(x)/y)

                                             f(x)
                                  2 sin(x) + ----
                                              y

Since `Dom::ArithmeticalExpression` is a faēcade domain, `e` is not a domain element, but an expression:

    >> domtype(e)

                                     DOM_EXPR

The fact that no error was returned yields the information that `e` is an arithmetical expression. This can also be checked as follows:

    >> testtype(e,AE)

                                       TRUE

In contrast to its super-domain `Dom::Expression`, this domain only allows elements which are valid arguments for the arithmetical functions, thus the following yields an error:

    >> AE([a, b])

          Error: illegal arguments [Dom::ArithmeticalExpression::new]

#### Super-Domain

`Dom::Expression`

#### Axioms

`Ax::systemRep`

#### Changes

- no changes

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