has - Maple Help

has

test for a specified subexpression

 Calling Sequence has(f, x)

Parameters

 f - expression x - expression, list or set of expressions

Description

 • The has(f, x) function returns true if f contains the expression x;  otherwise false is returned.
 The expression f contains x if and only if a subexpression of f (as defined by Maple's op function) is equal to x.
 Note:  If f contains x, it does not necessarily mean that f functionally depends on x.
 • If x is a list or set, then f contains x if and only if f contains at least one item in x.  That is, has(f,{x,y}) is equivalent to has(f,x) or has(f,y).
 • If the item that you want has to search for is itself a list or set, you must enclose it in a list or set. Otherwise, has will search for items in the list or set as described above.
 • Since has must traverse the entire expression tree for f, it can be an expensive operation. Do not use has, when member will serve just as well.

 • The has command is thread-safe as of Maple 15.

Examples

 > $f≔{\left(a+{b}^{3}+c\right)}^{\frac{4}{3}}$
 ${f}{≔}{\left({{b}}^{{3}}{+}{a}{+}{c}\right)}^{{4}}{{3}}}$ (1)
 > $\mathrm{has}\left(f,a\right)$
 ${\mathrm{true}}$ (2)
 > $\mathrm{has}\left(f,{b}^{3}\right)$
 ${\mathrm{true}}$ (3)
 > $\mathrm{has}\left(f,{b}^{2}\right)$
 ${\mathrm{false}}$ (4)
 > $\mathrm{has}\left(f,a+{b}^{3}+c\right)$
 ${\mathrm{true}}$ (5)
 > $\mathrm{has}\left(f,a+c\right)$
 ${\mathrm{false}}$ (6)
 > $\mathrm{has}\left(f,\left\{c,d\right\}\right)$
 ${\mathrm{true}}$ (7)
 > $\mathrm{has}\left(f,\left\{d,e\right\}\right)$
 ${\mathrm{false}}$ (8)
 > $f≔\mathrm{Int}\left(g\left(t\right),t=a..b\right)$
 ${f}{≔}{{\int }}_{{a}}^{{b}}{g}{}\left({t}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{ⅆ}{t}$ (9)
 > $\mathrm{has}\left(f,a\right)$
 ${\mathrm{true}}$ (10)
 > $\mathrm{has}\left(f,g\right)$
 ${\mathrm{true}}$ (11)
 > $\mathrm{has}\left(f,t\right)$
 ${\mathrm{true}}$ (12)
 > $\mathrm{diff}\left(f,t\right)$
 ${0}$ (13)
 > $\mathrm{has}\left(\left\{\left[1,2\right]\right\},\left[1,2\right]\right)$
 ${\mathrm{true}}$ (14)
 > $\mathrm{has}\left(\left\{\left[1,2\right]\right\},\left\{1,2\right\}\right)$
 ${\mathrm{true}}$ (15)
 > $\mathrm{has}\left(\left\{\left[1,2\right]\right\},\left[1,2,3\right]\right)$
 ${\mathrm{true}}$ (16)
 > $\mathrm{has}\left(\left\{\left[1\right],\left[4\right],\left[2,3\right]\right\},\left\{\left[4\right]\right\}\right)$
 ${\mathrm{true}}$ (17)
 > $\mathrm{has}\left(\left\{\left[1\right],\left[4\right],\left[2,3\right]\right\},\left\{\left[3,4\right]\right\}\right)$
 ${\mathrm{false}}$ (18)