numelems
number of indexable elements
Calling Sequence
Parameters
Description
Examples
Compatibility
numelems(expr)
expr
-
expression
The numelems(expr) command returns the number of elements in expr.
This command works on all expressions of type indexable.
If expr is an array, matrix or vector, the number of elements as represented by the bounds of the array is returned. A 2x3 matrix will have 6 elements as reported by numelems, even if some of those elements are not assigned. The same result will be returned if the matrix is sparse, or has another special storage as compared to a dense rectangular matrix.
If expr is a string, the number of characters in expr is returned.
If expr is a table, the number of assigned entries is returned.
If expr is a list or set, the number of first-level indexable elements is returned. That is, a list containing two 5-element sublists will still have two elements as reported by numelems. This is the same result given by nops.
If expr is an object that implements the numelems method, then the meaning of the expression numelems( expr ) depends on, and is defined by, the object.
The following objects have a numelems method:
"DataFrame" objects
"DataSeries" objects
numcolors
numelems⁡1|2,3|4
4
numelems⁡1,2,3,4
2
numelems⁡table⁡1=1,2=2,3=3
3
numelems⁡abc
The numelems command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
ArrayTools[NumElems]
cardinality
entries
indices
length
nops
rtable_num_elems
upperbound
lowerbound
Download Help Document