whattype - Maple Help

whattype

query the basic data type of an expression

 Calling Sequence whattype(expr)

Parameters

 expr - any expression

Description

 • The whattype(expr) function returns the data type name of expr, which may be any of the following basic data types:

 * + . .. :: < <= <> = ^ || and Array complex complex(extended_numeric) exprseq extended_numeric float fraction function hfarray implies indexed integer list module moduledefinition not object or package procedure record series set string symbol table uneval unknown xor zppoly Matrix Vector[column] Vector[row]

 • Although exprseq is not a type name known to the type function, it is the name of the internal data structure for expression sequences.
 • For a general expression, whattype returns the "top level" data type as determined by the order of precedence of the operators.

Examples

 > $\mathrm{whattype}\left(x+y\right)$
 ${\mathrm{+}}$ (1)
 > $\mathrm{whattype}\left(x-y\right)$
 ${\mathrm{+}}$ (2)
 > $\mathrm{whattype}\left(-x\right)$
 ${\mathrm{*}}$ (3)
 > $\mathrm{whattype}\left({x}^{2}f\left(y\right)\right)$
 ${\mathrm{*}}$ (4)
 > $\mathrm{whattype}\left(\frac{x}{y}\right)$
 ${\mathrm{*}}$ (5)
 > $\mathrm{whattype}\left({x}^{y}\right)$
 ${\mathrm{^}}$ (6)
 > $\mathrm{whattype}\left(\frac{1}{x}\right)$
 ${\mathrm{^}}$ (7)
 > $\mathrm{whattype}\left(x,y\right)$
 ${\mathrm{exprseq}}$ (8)
 > $\mathrm{whattype}\left(\left[x,y,z\right]\right)$
 ${\mathrm{list}}$ (9)
 > $\mathrm{whattype}\left(2+4I\right)$
 ${\mathrm{complex}}{}\left({\mathrm{extended_numeric}}\right)$ (10)
 > $\mathrm{whattype}\left(a\right)$
 ${\mathrm{symbol}}$ (11)
 > $a≔1:$
 > $\mathrm{whattype}\left(a\right)$
 ${\mathrm{integer}}$ (12)
 > $b≔"hello":$
 > $\mathrm{whattype}\left(b\right)$
 ${\mathrm{string}}$ (13)
 > $M≔\mathrm{rtable}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (14)
 > $\mathrm{whattype}\left(M\right)$
 ${\mathrm{Array}}$ (15)
 > $N≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right)$
 ${N}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (16)
 > $\mathrm{whattype}\left(N\right)$
 ${\mathrm{Matrix}}$ (17)