Total
Usage
Notes
Further Examples
Here is a list of numbers.
In[1]:=
|
This gives the sum.
In[2]:=
|
Out[2]=
|
This does the same thing.
In[3]:=
|
Out[3]=
|
The head need not be Plus.
In[4]:=
|
Out[4]=
|
Here is a nested list.
In[5]:=
|
This gives the sum of the elements of .
In[6]:=
|
Out[6]=
|
Total also gives the sum of symbolic lists.
In[7]:=
|
Out[7]=
|
In[8]:=
|
Out[8]=
|
In[9]:=
|
Out[9]=
|
In[10]:=
|
Out[10]=
|
Here is an expression.
In[11]:=
|
Here Total sums all expressions with head equal to .
In[12]:=
|
Out[12]=
|
In[13]:=
|
Out[13]=
|
Here is a list of two matrices.
In[14]:=
|
Out[14]=
|
This adds the matrices.
In[15]:=
|
Out[15]//MatrixForm=
|
This adds the rows of the sum of the matrices.
In[16]:=
|
Out[16]//MatrixForm=
|
This adds all the elements of the matrices.
In[17]:=
|
Out[17]=
|
This gives the precision of a machine number on any given computer, whether 16-bit, 32-bit, or 64-bit.
In[18]:=
|
Out[18]=
|
Here is a list of numbers.
In[19]:=
|
Out[19]=
|
Neither Plus nor Total register the sum of the small numbers in .
In[20]:=
|
Out[20]//FullForm=
|
In[21]:=
|
Out[21]//FullForm=
|
Using the option Total gives a result closer to the true sum.
In[22]:=
|
Out[22]//FullForm=
|
In[23]:=
|
Out[23]//FullForm=
|
|