PRODUCTS
PURCHASE
FOR USERS
COMPANY
OUR SITES
DOCUMENTATION CENTER SEARCH
Mathematica
>
Math & Counting Operations on Lists
>
Built-in
Mathematica
Symbol
Testing and Searching List Elements
Finding Expressions That Match a Pattern
Tutorials »
|
BinCounts
Cases
FreeQ
MemberQ
Select
Position
StringCount
Tally
Total
LeafCount
See Also »
|
Discrete & Integer Data
Elements of Lists
Handling Arrays of Data
List Manipulation
Math & Counting Operations on Lists
Numerical Data
Pattern Matching Functions
Rules & Patterns
More About »
Count
Count
[
list
,
pattern
]
gives the number of elements in
list
that match
pattern
.
Count
[
expr
,
pattern
,
levelspec
]
gives the total number of subexpressions matching
pattern
that appear at the levels in
expr
specified by
levelspec
.
MORE INFORMATION
Count
uses standard level specifications:
n
levels
1
through
n
Infinity
levels
1
through
Infinity
{
n
}
level
n
only
{
n
1
,
n
2
}
levels
n
1
through
n
2
The default value for
levelspec
in
Count
is
{1}
.
A positive level
n
consists of all parts of
expr
specified by
n
indices.
A negative level
-
n
consists of all parts of
expr
with depth
n
.
Level
-1
consists of numbers, symbols and other objects that do not have subparts.
Level
0
corresponds to the whole expression.
With the option setting
Heads
->
True
,
Count
looks at heads of expressions and their parts.
EXAMPLES
CLOSE ALL
Basic Examples
(1)
Count how many times
b
occurs:
In[1]:=
Out[1]=
Scope
(3)
Generalizations & Extensions
(1)
Applications
(1)
SEE ALSO
BinCounts
Cases
FreeQ
MemberQ
Select
Position
StringCount
Tally
Total
LeafCount
TUTORIALS
Testing and Searching List Elements
Finding Expressions That Match a Pattern
MORE ABOUT
Discrete & Integer Data
Elements of Lists
Handling Arrays of Data
List Manipulation
Math & Counting Operations on Lists
Numerical Data
Pattern Matching Functions
Rules & Patterns
New in 1
© 2008 Wolfram Research, Inc.