 hastype - Maple Help

hastype

test for a specified type Calling Sequence hastype(expr, t) hastype(expr, t, 'exclude_container') Parameters

 expr - any expression t - any Maple type exclude_container - option Description

 • The hastype(expr, t) function returns true if expr  or any of its subexpressions is of type t.
 • A subexpression of an expression is any of the expressions returned by the op command.
 • Using the exclude_container option causes hastype to only look at subexpressions, and not the parent container object. • The hastype command is thread-safe as of Maple 15. Examples

 > $f≔{x}^{\frac{1}{2}}y$
 ${f}{≔}\sqrt{{x}}{}{y}$ (1)
 > $\mathrm{hastype}\left(f,\mathrm{*}\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{hastype}\left(f,\mathrm{+}\right)$
 ${\mathrm{false}}$ (3)
 > $\mathrm{hastype}\left(f,{\mathrm{name}}^{\mathrm{fraction}}\right)$
 ${\mathrm{true}}$ (4)
 > $\mathrm{hastype}\left(f,\mathrm{radical}\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{hastype}\left(f,\mathrm{function}\right)$
 ${\mathrm{false}}$ (6)
 > $A≔\mathrm{Matrix}\left(\left[\left[1,2\right],\left[3,4\right]\right]\right)$
 ${A}{≔}\left[\begin{array}{cc}{1}& {2}\\ {3}& {4}\end{array}\right]$ (7)
 > $\mathrm{hastype}\left(A,\mathrm{rational}\right)$
 ${\mathrm{true}}$ (8)
 > $\mathrm{hastype}\left(A,\mathrm{Matrix}\right)$
 ${\mathrm{true}}$ (9)
 > $\mathrm{hastype}\left(A,\mathrm{Matrix},'\mathrm{exclude_container}'\right)$
 ${\mathrm{false}}$ (10)
 > $\mathrm{hastype}\left(A,'\mathrm{Not}\left(\mathrm{numeric}\right)'\right)$
 ${\mathrm{true}}$ (11)
 > $\mathrm{hastype}\left(A,'\mathrm{Not}\left(\mathrm{numeric}\right)','\mathrm{exclude_container}'\right)$
 ${\mathrm{false}}$ (12)
 > $\mathrm{hastype}\left(F\left(3\right),\mathrm{identical}\left(F\right)\right)$
 ${\mathrm{false}}$ (13)
 > $\mathrm{op}\left(F\left(3\right)\right)$
 ${3}$ (14)