Re: Summing all the elements along a dimension in a matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg104307] Re: Summing all the elements along a dimension in a matrix
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Tue, 27 Oct 2009 04:58:10 -0500 (EST)
- References: <hc38cr$i5b$1@smc.vnet.net>
On 2009.10.26. 5:26, CuppoJava wrote:
> Hi,
> I just started using Mathematica after a year of experience with
> another system, and I have a question regarding how to handle matrices.
>
> What is the equivalent code for doing
> sum(A,3) in mathematica?
> This sums all the elements A along the third dimension.
>
This is controlled by the second argument of Total. Total[a, {3}]
(depending on what you mean by 'third dimension')