number of indexable elements
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:
The numelems command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
Download Help Document