MathGroup Archive 2005

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

Search the Archive

Re: Manipulating a matrix

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59266] Re: Manipulating a matrix
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Thu, 4 Aug 2005 02:07:51 -0400 (EDT)
  • References: <dcmuig$glg$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Wissam,
to begin with let's do it step by step in an example of a 3x3 matrix

In[17]:=
m = Table[i, {i, 1, 3}, {j, 1, 3}];
TableForm[m]

Out[18]//TableForm=
TableForm[{{1, 1, 1}, {2, 2, 2}, {3, 3, 3}}]

Drop the first row

In[19]:=
m1 = Drop[m, 1];
TableForm[m1]

Out[20]//TableForm=
TableForm[{{2, 2, 2}, {3, 3, 3}}]

Now drop the first column of the result sandwiching with Transpose

In[44]:=
m2 = Transpose[Drop[Transpose[m1], 1]];
TableForm[m2]

Out[45]//TableForm=
TableForm[{{2, 2}, {3, 3}}]

Ok. Now let's put the things together and define a function doing the 
job in general ...

In[23]:=
mDrop[m_] := Transpose[Drop[Transpose[Drop[m, 1]], 1]]

... and test it

md = mDrop[m];
TableForm[md]

Out[26]//TableForm=
TableForm[{{2, 3}, {2, 3}}]

Regards,
Wolfgang

Ramier wrote:

> 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: NDSolve::mconly error
  • Next by Date: Default defaults?
  • Previous by thread: Re: Manipulating a matrix
  • Next by thread: Re: Manipulating a matrix