Services & Resources / Wolfram Forums
MathGroup Archive
*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
  • Subject: [mg46343] RE: [mg46329] matrix operations
  • From: "David Park" <djmp at>
  • Date: Mon, 16 Feb 2004 08:59:46 -0500 (EST)
  • Sender: owner-wri-mathgroup at


The wonders of functional programming! Here's an example.

mat = Array[x, {4, 4}]

Partition[mat, 2, 1]
(answer = #2 - #1 & @@@ %) // MatrixForm

@@@ is the Apply function, mapped onto the first level of mat. #2 - #1& is a
pure function that subtracts the second argument from the first argument.

David Park
djmp at

-----Original Message-----
From: paolo tarpanelli [mailto:tarpanelli at]
To: mathgroup at
Subject: [mg46343] [mg46329] matrix operations

If I have a matrix


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]]}


I built this code but it does not work





  • Prev by Date: Re: how to explain this weird effect? Integrate
  • Next by Date: Re: matrix operations
  • Previous by thread: Re: matrix operations
  • Next by thread: Re: matrix operations