MathGroup Archive 2005

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

Search the Archive

Re: Manipulating a matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59241] Re: [mg59212] Manipulating a matrix
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 3 Aug 2005 01:19:46 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

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

{{a[1, 1], a[1, 2], a[1, 3], a[1, 4]}, {a[2, 1], a[2, 2], a[2, 3], a[2, 4]}, 
  {a[3, 1], a[3, 2], a[3, 3], a[3, 4]}, {a[4, 1], a[4, 2], a[4, 3], a[4, 4]}}

To drop the first row and first column:

mat2=Rest[Rest/@mat]

{{a[2, 2], a[2, 3], a[2, 4]}, {a[3, 2], a[3, 3], a[3, 4]}, 
  {a[4, 2], a[4, 3], a[4, 4]}}

To drop the third row and second column:

Drop[Drop[#,{2}]&/@mat,{3}]

{{a[1, 1], a[1, 3], a[1, 4]}, {a[2, 1], a[2, 3], a[2, 4]}, 
  {a[4, 1], a[4, 3], a[4, 4]}}

Also look at the standard add-on package 
LinearAlgebra`MatrixManipulation`

Needs["LinearAlgebra`MatrixManipulation`"];

TakeMatrix[mat,{2,2},{4,4}]==
  SubMatrix[mat,{2,2},{3,3}]==
  mat2

True


Bob Hanlon

> 
> From: "Ramier" <wissam2 at online.fr>
To: mathgroup at smc.vnet.net
> Date: 2005/08/02 Tue AM 12:42:32 EDT
> Subject: [mg59241] [mg59212] Manipulating a matrix
> 
> Hello everyone,
> 
> I think that my question is rather simple and maybe I ought to go
> deeper into Mathematica book:
> I have a n x n matrix and I'd like to remove the first line and the
> first column in order to get the (n-1)x(n-1) matrix with the entries
> remaining. Is there a simple way to do that ?
> 
> Perhaps my question is really simple or idiot but I've never used
> Mathematica before.
> 
> Thanks a lot,
> 
> Wissam
> 
> 


  • Prev by Date: Re: Set default options for a function
  • Next by Date: Re: NullSpace[m], why different result for symbolic vs numerical matrix?
  • Previous by thread: Re: Manipulating a matrix
  • Next by thread: Re: Manipulating a matrix