has - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.
Our website is currently undergoing maintenance, which may result in occasional errors while browsing. We apologize for any inconvenience this may cause and are working swiftly to restore full functionality. Thank you for your patience.

Online Help

All Products    Maple    MapleSim


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

fb3+a+c43

(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)

fIntgt,t=a..b

fabgtⅆt

(9)

hasf,a

true

(10)

hasf,g

true

(11)

hasf,t

true

(12)

difff,t

0

(13)

has1,2,1,2

true

(14)

has1,2,1,2

true

(15)

has1,2,1,2,3

true

(16)

has1,4,2,3,4

true

(17)

has1,4,2,3,3,4

false

(18)

See Also

depends

hasfun

hastype

member

numboccur

op