MathGroup Archive 2003

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

Search the Archive

Re: Adding elements of a matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg40608] Re: [mg40583] Adding elements of a matrix
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 11 Apr 2003 02:01:12 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Yes,

In[1]:=
mat=Array[m,{3,4}];

In[3]:=
Sum[Evaluate[If[i<j,mat[[i,j]],0]],{i,3},{j,4}]

Out[3]=
m[1,2]+m[1,3]+m[1,4]+m[2,3]+m[2,4]+m[3,4]

Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/


On Thursday, April 10, 2003, at 04:42  pm, Rebeca Choy wrote:

> Hi,
>
> How can I add in Mathematica every element of a matrix without adding
> twice the mixed terms?
>
> for example i have a matrix m[[i,j]] and i want to add every term where
> i<j (this is to avoiding adding twice the same number)
>
> Can I do it with Sum?
>
> Rebeca Choy
>
>
>
>



  • Prev by Date: Re: Adding elements of a matrix
  • Next by Date: Re: Assign values to characters gen by "FromCharacterCode"
  • Previous by thread: Re: Adding elements of a matrix
  • Next by thread: Re: Adding elements of a matrix