How can I compute the row differences of an m x n matrix to obtain an m-1 x n matrix; that is, given

enter image description here

how do I obtain

enter image description here


Maybe this ?

m = {{a, b, c}, {d, e, f}, {g, h, i}};
(* {{-a + d, -b + e, -c + f}, {-d + g, -e + h, -f + i}} *)
  • $\begingroup$ Thanks @b.gatesucks I didn't know this function existed! $\endgroup$ – sebastian c. Jan 11 '13 at 13:06
  • 6
    $\begingroup$ @sebastian if you are grateful for answers you should be Accepting some of them too. You haven't done this for a very long time. Why not? $\endgroup$ – Mr.Wizard Jan 11 '13 at 13:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.