Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: matrix operations

  • To: mathgroup at smc.vnet.net
  • Subject: [mg46352] RE: [mg46329] matrix operations
  • From: "tgarza01 at prodigy.net.mx" <tgarza01 at prodigy.net.mx>
  • Date: Mon, 16 Feb 2004 08:59:53 -0500 (EST)
  • Reply-to: tgarza01 at prodigy.net.mx
  • Sender: owner-wri-mathgroup at wolfram.com

Probably the best way (or at least a good one) would be

In[1]:=
aMat = {{1, 3, 2, 4}, {4, 6, 1, 0}, {3, 6, 9, 2}}; 

In[2]:=
Drop[RotateLeft[aMat] - aMat, -1]
Out[2]=
{{3, 3, -1, -4}, {-1, 0, 8, 2}}

Tomas Garza
Mexico City
Original Message:
-----------------
From: paolo tarpanelli tarpanelli at libero.it
To: mathgroup at smc.vnet.net
Subject: [mg46352] [mg46329] matrix operations


If I have a matrix

a={x[[1,1]],x[[1,2]],...,x[[1,n]]}
    {x[[2,1]],x[[2,2]],...,x[[2,n]]}
            .
            .
            .
    {x[[m,1]],x[[m,2]],...,x[[m,n]]}

how can I compute the difference between any element and the previous for
each column :

aa={x[[2,1]]-x[[1,1]], x[[2,2]]-x[[1,2]],...,x[[2,n]]-x[[1,n]]}
      {x[[3,1]]-x[[2,1]], x[[3,2]]-x[[2,2]],...,x[[3,n]]-x[[2,n]]}
            .
            .
            .
      {x[[m,1]]-x[[m-1,1]],x[[m,2]]-x[[m-1,2]],...,x[[m,n]]-x[[m-1,n]]}

----------------------------------------------------------------------------
--------------------------

I built this code but it does not work

r=Array[0,{m,n}]
For[j=1,j=n,j++
       r[[i,j]]=Table[a[[i+1,j]]-a[[i,j]],{i,1,m-1,1}]]

thanks

Paolo

----------------


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .



  • Prev by Date: Re: matrix operations
  • Next by Date: AW: matrix operations
  • Previous by thread: Re: matrix operations
  • Next by thread: Re: matrix operations