domtype
-- the data type of an
objectdomtype(
object)
returns the domain type (the data type) of the object.
domtype(object)
object |
- | any MuPAD object |
the data type, i.e., an object of type DOM_DOMAIN
.
object
coerce
, DOM_DOMAIN
, domain
, hastype
, testtype
, type
, Type
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.domtype
does not
flatten arguments that are expression sequences.domtype
is a function of the system kernel.Real floating point numbers are of domain type DOM_FLOAT
:
>> domtype(12.345)
DOM_FLOAT
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)
DOM_COMPLEX, 1, -2 DOM_COMPLEX, 1/2, -1 DOM_COMPLEX, 2.0, -3.0
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])
DOM_EXPR, "_plus" DOM_EXPR, "_plus" DOM_EXPR, "_mult" DOM_EXPR, "_power" DOM_EXPR, "_index"
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))
DOM_INT
>> delete a:
Here the identifier a
is first evaluated to
the expression sequence
3, 4
. Its domain type is DOM_EXPR
, its type is "_exprseq"
:
>> a := 3, 4: domtype(a), type(a)
DOM_EXPR, "_exprseq"
>> delete a:
factor
creates objects of the domain type Factored
:
>> domtype(factor(x^2 - x))
Factored
matrix
creates objects of the domain type Dom::Matrix()
:
>> domtype(matrix([[1, 2], [3, 4]]))
Dom::Matrix()
Domains are of the domain type DOM_DOMAIN
:
>> domtype(DOM_INT), domtype(DOM_DOMAIN)
DOM_DOMAIN, DOM_DOMAIN
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)
d, d, "domain type d"
>> delete d, e: