Re: basic operations in matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg34572] Re: basic operations in matrices
- From: Mark Westwood <MarkCWestwood at compuserve.com>
- Date: Wed, 29 May 2002 02:44:13 -0400 (EDT)
- References: <acsgc6$kbr$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Christian
M[[{1,2}]]=M[[{2,1}]] will swap rows 1 and 2 of the matrix M, be careful
with the brackets. Transposing columns is a bit more difficult - first
transpose M, then transpose the columns (which are now rows), then
transpose M again.
Regards
Mark
Edinburgh
Christian Junk wrote:
>
> Hi!
>
> I'm new to Mathematica and I'm searching for an operation, that simply
> transpose two rows or columns of a matrix M.
>
> e.g:
>
> Operation[M,{1,3}]
>
> 1 1 1 1 3 3 3 3
> 2 2 2 2 ---> 2 2 2 2
> 3 3 3 3 1 1 1 1
> 4 4 4 4 4 4 4 4
>
> Much thanks in advance,
>
> Christian