This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Total

Total[list]
gives the total of the elements in list.
Total
totals all elements down to level n.
Total
totals elements at level n.
Total
totals elements at levels through .
  • For a 2D array or matrix: »
Total[list] or Total totals for each column
Total totals for each row
Total overall total of all elements
  • Total gives the sum of the for any head f. »
  • Total[list, Method->"CompensatedSummation"] uses compensated summation to reduce numerical error in the result. »
Total the values in a list:
Total the values in a list:
In[1]:=
Click for copyable input
Out[1]=
Use exact arithmetic to total the values:
Use machine arithmetic:
Use 47-digit precision arithmetic:
Total the columns of a matrix:
Total the rows:
Total all the elements:
Total by adding parts in the first dimension:
Total in the last dimension only:
Total in the last two dimensions:
Total all the elements:
Total the last dimension in a ragged array:
Total all the elements:
You cannot total in the first dimension because the lists have incompatible lengths:
Total the columns in a sparse matrix:
Total the rows:
Total several sparse vectors:
Total all the elements in all the vectors:
Total works with any head:
Find the total derivative order:
Use Method" to reduce accumulated errors in a sum:
Without compensated summation, small errors may accumulate with each term:
Form a polynomial from monomials:
Show that the trace of a matrix is equal to the total of its eigenvalues:
Search for equal to the sum of their divisors:
Total[list] is equivalent to Apply[Plus, list]:
Total is equivalent to Total[Flatten[list, k-1]]:
New in 5 | Last modified in 6