numboccur
count occurrences of an expression
Calling Sequence
Parameters
Description
Thread Safety
Examples
numboccur(f, x)
f
-
expression
x
The numboccur(f, x) function returns the number of times that x is found in f.
If x is a sum or a product, the counted expressions are those where the sum or product appear with no extra terms or factors in f. If x is a list or a set, then every element in the list or set is counted.
If x is a list or set, numboccur counts and adds together the number of times each member of the list or set occurs in f. In other words, numboccur(f,{x,y}) is equivalent to numboccur(f,x) + numboccur(f,y). Note that if x is a list and contains a given element more than once, it is counted more than once each time it appears in f.
If the item that you want numboccur to count is itself a list or set, you must enclose it in a list or set. Otherwise, numboccur will count occurrences of the items in the list or set as described above.
The numboccur command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
See Also
has
ListTools:-Occurrences
Download Help Document