MathGroup Archive 2004

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

Search the Archive

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

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


  • Prev by Date: Pattern Matching Exercises, Anyone?
  • Next by Date: Re: question: How to get Mathematica to show more than one value of a complex valued function?
  • Previous by thread: Pattern Matching Exercises, Anyone?
  • Next by thread: Re: matrix operations