whattype - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

whattype

query the basic data type of an expression

 Calling Sequence whattype(expr) whattype[kernel](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 array assignment complex(extended_numeric) do exprseq extended_numeric float foreign fraction function hfarray if implies indexed integer list Matrix module moduledefinition not object or package procedure python record SDMPoly series set string symbol table uneval unknown Vector[column] Vector[row] xor zppoly

 • 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.
 • If the expression is an object whose type name occurs either the object itself, or specifically to whattype, the object type's name is returned. If the object's type is not known, whattype returns object as the type.
 • The whattype function produces slightly different output if invoked as whattype[kernel](expr):
 – If expr is a software or hardware floating point, whattype returns float or hfloat respectively, instead of returning float for both cases.
 – If expr is an object, whattype returns object for any object, even if it has a known name.

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)
 > $q≔\mathrm{DEQueue}\left(5,6,7\right)$
 ${q}{≔}{\mathrm{DEQueue}}{}\left({5}{,}{6}{,}{7}\right)$ (18)
 > $\mathrm{whattype}\left(q\right)$
 ${\mathrm{DEQueue}}$ (19)
 > $\mathrm{whattype}\left[\mathrm{kernel}\right]\left(q\right)$
 ${\mathrm{object}}$ (20)