Re: matrix operations

• To: mathgroup at smc.vnet.net
• Subject: [mg46345] Re: matrix operations
• From: drbob at bigfoot.com (Bobby R. Treat)
• Date: Mon, 16 Feb 2004 08:59:47 -0500 (EST)
• References: <c0mohe\$65t\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```m = 4; n = 3;
a = Array[x, {m, n}]
Most[RotateLeft@a - a]
Drop[RotateLeft@a - a, -1]

Most is new in version 5, but Drop is venerable.

Bobby

"paolo tarpanelli" <tarpanelli at libero.it> wrote in message news:<c0mohe\$65t\$1 at smc.vnet.net>...
> 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: Solve or LinearSolve or ...?
• Next by Date: Re: how to explain this weird effect? Integrate
• Previous by thread: Re: matrix operations
• Next by thread: RE: matrix operations