## `Dom::Expression` -- the domain of all MuPAD objects of basic type

#### Introduction

`Dom::Expression` comprises all objects only consisting of operands of built-in types.

#### Creating Elements

`Dom::Expression(x)`

#### Parameters

`x` | - | An object of basic type consisting only of operands of built-in types, or any other object convertible to such using `expr`.

#### Categories

`Cat::BaseCategory`

#### Related Domains

`Dom::ExpressionField`

#### Details

- `Dom::Expression` is a faēcade domain: it has no domain elements, but uses system representation.
- Unlike `Dom::ExpressionField`, `Dom::Expression` does not belong to any arithmetical category, and its elements need not be arithmetical expressions.
- `Dom::Expression` mainly serves as a super-domain to `Dom::ArithmeticalExpression`; it rarely makes sense to use it directly.

#### Entries

randomIdent

  an identifier used for creating random elements

#### Method convert: conversion of objects

- `convert(any x)`
- - `expr` is used to convert `x` into an object of basic type. This method does not create elements of `Dom::Expression`, since `Dom::Expression` has system representation.

#### Method convert_to: conversion to other domains

- `convert_to(expression x, any T)`
- - This method always returns `FAIL` unless `T` is `Dom::Expression`; in the latter case, `x` is returned.

#### Method expr: just return the argument

- `expr(expression x)`
- - Since the argument(s) are expressions already, they are just returned.

#### Method testtype: tests whether its argument is an expression

- `testtype(any x,` Dom::Expression)
- - This method returns `TRUE` if `x` can be converted to an expression, and `FAIL` otherwise. The second argument must equal `Dom::Expression`; this is not checked.
  - This method overloads `testtype`; since `Dom::Expression` has no domain elements, the overloading can only be caused by the second argument.

#### Method float: convert numbers to floats

- `float(expression x)`
- - This method is identical to the kernel function `float`.

#### Method subs: substitution

- `subs(expression x, substitution s...)`
- - This is just the method `subs` of the standard library; see there for details about the calling syntax.

#### Method subsex: extended substitution

- `subsex(expression x, substitution s...)`
- - This is just the method `subsex` of the standard library; see there for details about the calling syntax.

#### Method random: create random expression

- `random()`
- - This method returns a randomly chosen rational expression in one variable.

#### Example 1

Almost every MuPAD object can be converted to an expression. Objects of basic type are expressions.

    >> Dom::Expression([3, array(1..2), rectform(exp(I))])

                    --    +-          -+                    --
                    |  3, | ?[1], ?[2] |, cos(1) + I sin(1)  |
                    --    +-          -+                    --

The `convert` method flattens its argument: hence expression sequences are not allowed.

    >> Dom::Expression((3, x))

          Error: expecting one argument [Dom::Expression::convert]

#### Super-Domain

`Dom::BaseDomain`

#### Axioms

`Ax::systemRep`

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

#### Changes

- no changes

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