has - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Logic : Boolean : has

has

test for a specified subexpression

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

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.

Thread Safety

• 

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

• 

For more information on thread safety, see index/threadsafe.

Examples

fa+b3+c43

f:=b3+a+c4/3

(1)

hasf,a

true

(2)

hasf,b3

true

(3)

hasf,b2

false

(4)

hasf,a+b3+c

true

(5)

hasf,a+c

false

(6)

hasf,c,d

true

(7)

hasf,d,e

false

(8)

f∫abgtⅆt

f:=∫abgtⅆt

(9)

hasf,a

true

(10)

hasf,g

true

(11)

hasf,t

true

(12)

tf

0

(13)

has1,2,1,2

true

(14)

has1,2,1,2

true

(15)

has1,2,1,2,3

true

(16)

has1,2,3,4,4

true

(17)

has1,2,3,4,3,4

false

(18)

See Also

depends

hasfun

hastype

member

numboccur

op

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam