hasfun - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


hasfun

test for a specified function

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

hasfun(e, f)

hasfun(e, f, x)

Parameters

e

-

expression

f

-

function name(s)

x

-

(optional) expression

Description

• 

The hasfun command searches an expression e for the function f, or, if f is a list or set of names (of functions), then hasfun searches e for any one of these functions. It returns true if it finds one, false otherwise.

• 

If the third optional argument x is specified, the hasfun function tests if the expression e has function(s) f of x, in the sense that x occurs in one or more arguments of the call to f. A typical application is in integration where you might want to test if the integrand has a special function of a variable x.

  

For a positive match, x has to occur as an exact subexpression as defined by Maple's op function. See has for examples of what this means.

  

If the subexpression x that needs to occur in the arguments to f is a list or set, it needs to be enclosed in a list or set itself, otherwise hasfun will search for the members of x only.

Examples

> 

e≔sin⁡x+exp⁡3⁢y+1

e≔sin⁡x+ⅇ3⁢y+1

(1)
> 

hasfun⁡e,exp

true

(2)
> 

hasfun⁡e,cos

false

(3)
> 

hasfun⁡e,exp,y

true

(4)
> 

hasfun⁡e,exp,x

false

(5)
> 

hasfun⁡e,exp,x,y

true

(6)
> 

hasfun⁡e,cos,sin,x

true

(7)

The function name f can be any expression.

> 

e≔D⁡x⁡t−x⁡t

e≔D⁡x⁡t−x⁡t

(8)
> 

hasfun⁡e,D⁡x,t

true

(9)

The required subexpression x can also be any expression, but it needs to occur as a subexpression as defined by Maple's op function. Below, x+y is not a subexpression of x+y+z.

> 

e≔g⁡2⁢f⁡x+y+z−2

e≔g⁡2⁢f⁡x+y+z−2

(10)
> 

hasfun⁡e,f,x+y

false

(11)

If the subexpression you are looking for is a list or set, you need to enclose it in a list or set itself. The first calling sequence looks for the variables k or m occurring; the second for the list k,m; and the third for the list m,n:

> 

e≔1+Hypergeom⁡m,n,,z

e≔1+Hypergeom⁡m,n,,z

(12)
> 

hasfun⁡e,Hypergeom,k,m

true

(13)
> 

hasfun⁡e,Hypergeom,k,m

false

(14)
> 

hasfun⁡e,Hypergeom,m,n

true

(15)

See Also

has

hastype

op

selectfun

type/function