Re: Summing all the elements along a dimension in a matrix
- To: mathgroup at smc.vnet.net
- Subject: [mg104311] Re: Summing all the elements along a dimension in a matrix
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Tue, 27 Oct 2009 04:58:54 -0500 (EST)
- References: <hc38cr$i5b$1@smc.vnet.net>
Hi Patrick, Many ways to do this, but the easiest way will be using Total. The syntax variant you could use here is Total[A,{3}]. Perhaps you should check whether the ordering of the dimensions is the same in both systems. Cheers -- Sjoerd On Oct 26, 6:26 am, CuppoJava <patrickli_2... at hotmail.com> 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. > > I'm having a hard time finding it in the documentation. > > Thanks a lot for your help > -Patrick