The dim( Command

Command Summary

Returns the size of a list or matrix. Can also be used to change the size.

Command Syntax





Menu Location


  1. 2nd LIST to access the list menu
  2. RIGHT to access the OPS submenu
  3. 3 to choose dim(, or use arrows

Alternatively, press:

  1. MATRIX (83) or 2nd MATRIX (83+ or higher) to access the matrix menu
  2. RIGHT to access the MATH submenu
  3. 3 to choose dim(, or use arrows

Calculator Compatibility


Token Size

1 byte

The dim( command is used to find the size of an existing list or matrix. It takes only one argument - the list or matrix you want the size of. For a list, it returns the number of elements; for a matrix, it returns a two-element list of the number of rows and the number of columns.


The dim( command can also be used to change the size of a list or matrix; this is perhaps its most important use. To do this, just store the desired size to the list or matrix (the dim( command is the only one you can store in as though it were a variable).


For a list, if this increases the size, zero elements will be added to the end of the list; if this decreases the size, elements will be removed starting from the end.

For a matrix, if this increases the number of rows or columns, new rows or columns filled with zeros will be added to the bottom and right respectively. If this decreases the number of rows and columns, those rows and columns will be removed starting from the bottom (for rows) and right (for columns).

If a list or matrix doesn't exist before its size is changed, the dim( command will actually create it with the correct size. All the elements, in this case, will be set to 0.

Advanced Uses

In the case of lists, the dim( command is used in adding an element to the end of a list. Although augment( can be used for the same task, dim( is faster - but takes more memory. For example, to add the element 5 to the end of L1:


It's also possible, using the dim( command, to set the size of a list to 0. In this case, the list exists, but doesn't take up any memory, and cannot be used in expressions (similar to the output of ClrList). This is not really useful.


When creating a list or matrix using dim(, all the elements are preset to 0; this can be used in place of the Fill( command to set a list or matrix to a bunch of zeros in a program. Since we don't usually know for sure that the list or matrix doesn't exist, we must first delete it with DelVar.

can be
:DelVar [A]{5,5→dim([A]

Error Conditions

  • ERR:INVALID DIM is thrown if you try to make a list or matrix bigger than 999 or 99x99 elements respectively, or if you try to create a matrix that isn't 2-dimensional.

Related Commands


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial 2.5 License.