ArrayTools
AddAlongDimension
add the elements of an Array
Calling Sequence
Parameters
Description
Examples
AddAlongDimension(A,dim)
A
-
Array
dim
(optional) dimension to add along
The AddAlongDimension(A) command adds up the elements in dimension dim of a N-dimensional Array to produce an Array with (N-1) dimensions.
When dim is not specified, the first non-singleton dimension is used for adding. If the dimension specified is a higher dimension than the number of dimensions in the input, the input itself is returned.
If AddAlongDimension is applied to a Vector, a constant is returned.
This function is part of the ArrayTools package, so it can be used in the short form AddAlongDimension(..) only after executing the command with(ArrayTools. However, it can always be accessed through the long form of the command by using ArrayTools[AddAlongDimension](..).
with⁡ArrayTools:
M≔Matrix⁡a,b,c,d,e,f
M≔abcdef
AddAlongDimension⁡M,1
a+db+ec+f
AddAlongDimension⁡M,2
a+b+cd+e+f
v≔Vector⁡1,2,3,4
v≔1234
AddAlongDimension⁡v
10
See Also
ArrayTools[MultiplyAlongDimension]
Download Help Document