domtype

Data type of an object

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

domtype(object)

Description

domtype(object) returns the domain type (the data type) of the object.

For most data types, the domain type as returned by domtype coincides with the type returned by the function type. Only for expressions of domain type DOM_EXPR, the function type yields a distinction according to the 0-th operand. Cf. Example 2.

In contrast to most other functions, domtype does not flatten arguments that are expression sequences.

Examples

Example 1

Real floating-point numbers are of domain type DOM_FLOAT:

domtype(12.345)

Complex numbers are of domain type DOM_COMPLEX. The operands may be integers (DOM_INT), rational numbers (DOM_RAT), or floating-point numbers (DOM_FLOAT). The operands can be accessed via op:

domtype(1 - 2*I), op(1 - 2*I);
domtype(1/2 - I), op(1/2 - I);
domtype(2.0 - 3.0*I), op(2.0 - 3.0*I)

Example 2

Expressions are objects of the domain type DOM_EXPR. The type of expressions can be queried further with the function type:

domtype(x + y), type(x + y);
domtype(x - 1.0*I), type(x - 1.0*I);
domtype(x*I), type(x*I);
domtype(x^y), type(x^y);
domtype(x[i]), type(x[i])

Example 3

domtype evaluates its argument. In this example, the assignment is first evaluated and domtype is applied to the return value of the assignment. This is the right hand side of the assignment, i.e., 5:

domtype((a := 5))

delete a:

Example 4

Here the identifier a is first evaluated to the expression sequence3, 4. Its domain type is DOM_EXPR, its type is "_exprseq":

a := 3, 4: domtype(a), type(a)

delete a:

Example 5

factor creates objects of the domain type Factored:

domtype(factor(x^2 - x))

Example 6

matrix creates objects of the domain type Dom::Matrix():

domtype(matrix([[1, 2], [3, 4]]))

Example 7

Domains are of the domain type DOM_DOMAIN:

domtype(DOM_INT), domtype(DOM_DOMAIN)

Example 8

domtype is overloadable, i.e., a domain can pretend to be of another domain type. The special slot"dom" always gives the actual domain:

d := newDomain("d"): d::domtype := x -> "domain type d":
e := new(d, 1): e::dom, type(e), domtype(e)

delete d, e:

Parameters

object

Any MuPAD® object

Return Values

Data type, i.e., an object of type DOM_DOMAIN.

Overloaded By

object

See Also

MuPAD Domains

MuPAD Functions

Was this topic helpful?