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: [mg40738] Re: Adding elements of a matrix
  • From: "Dana DeLouis" <delouis at bellsouth.net>
  • Date: Tue, 15 Apr 2003 04:00:27 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Just another option...

w = Array[v, {3, 5}]; MatrixForm[w]

Dimensions[w]
{3, 5}

With[
{d = Dimensions[w]}, 
  Plus @@ Flatten[Table[w[[i,j]], {i, d[[1]]}, {j, i + 1, d[[2]]}]]
]


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

-- 
Dana DeLouis 
Windows XP
$VersionNumber -> 4.2
= = = = = = = = = = = = = = = = = 


"Rebeca Choy" <rchoy at ula.ve> wrote in message
news:b738oh$o7l$1 at smc.vnet.net...
> 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: Export Complex Matrices
  • Next by Date: Re: solving a PDE
  • Previous by thread: Re: Adding elements of a matrix
  • Next by thread: Info: Inversion of real-valued Laplace transforms