MathGroup Archive 2005

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

Search the Archive

Re: Manipulating a matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59243] Re: Manipulating a matrix
  • From: LBoogie <lwalker701 at earthlink.net>
  • Date: Wed, 3 Aug 2005 01:19:47 -0400 (EDT)
  • References: <dcmuig$glg$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Ramier wrote:
> 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 ?
> 

The Submatrix and TakeMatrix functions available in the 
LinearAlgebra`MatrixManipulation` package can be used.

Given the following matrix 4x4:

	mat = Array[m, {4, 4}]; MatrixForm[mat]

The 3x3 matrix is

	TakeMatrix[mat, {2, 2}, {4, 4}]

or you can use

	SubMatrix[mat, {2, 2}, {3, 3}]

However, the examples I cited only works when the desired elements of 
mat are contiguous.

For the noncontiguous case of removing the second row and column you can use

	Drop[Transpose[Drop[mat, {2}]], {2}]

I hope this helps.


LBoogie


  • Prev by Date: Re: Manipulating a matrix
  • Next by Date: Integral giving complex answer
  • Previous by thread: Re: Manipulating a matrix
  • Next by thread: Re: Manipulating a matrix