Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

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')


  • Prev by Date: Re: Using "/@" Effectively
  • Next by Date: Re: Factor
  • Previous by thread: Re: Summing all the elements along a dimension in a matrix
  • Next by thread: Re: Summing all the elements along a dimension in a matrix