MathGroup Archive 2003

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

Search the Archive

Re: Transpose matrix does not work when MatrixForm is used, why?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg45288] Re: Transpose matrix does not work when MatrixForm is used, why?
  • From: drbob at bigfoot.com (Bobby R. Treat)
  • Date: Sun, 28 Dec 2003 05:10:48 -0500 (EST)
  • References: <bsjlej$24e$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

THANKS for emphasizing that MatrixForm and List are two different
heads. That's very, very true -- but rather obvious and not
particularly helpful.

The issue is that the MatrixForm "wrapper" affects evaluation,
contrary to the description in Help. The question is what to do about
it.

Thanks to Andrzej Kozlowski, we have a short answer that seems to
work.

Bobby

Klamser at t-online.de wrote in message news:<bsjlej$24e$1 at smc.vnet.net>...
> Hi,
> 
> why has Santa Claus a red cape on?
> 
> A deer is not a dog is not a dog.
> 
> A MatrixForm Object is not a Matrix.
> 
> m = { {1, 2, 3}, {4, 5, 6} } // MatrixForm;
> ??m -> m = MatrixForm[{{1, 2, 3}, {4, 5, 6}}]
> 
> Therefore m[[0]] -> MatrixForm
> 
> But
> 
> (m = { {1, 2, 3}, {4, 5, 6} }) // MatrixForm;
> ??m -> m = {{1, 2, 3}, {4, 5, 6}}
> 
> Therefore m[[0]] -> List
> 
> Therefore again:
> 
> A MatrixForm Object is not a Matrix.
> 
> Regards
> 
> Peter Klamser
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: steve_H [mailto:nma124 at hotmail.com]
> Gesendet: Mittwoch, 24. Dezember 2003 23:42
> An: mathgroup at smc.vnet.net
> Betreff:  Re: Transpose matrix does not work when MatrixForm is
> used, why?
> 
> 
> Dr Bob <drbob at bigfoot.com> wrote in message
> news:<bsbmsb$lr1$1 at smc.vnet.net>...
> 
> > That may be easier... if we are willing to constantly pay attention to
> > whether the target of Transpose is "wrapped" in MatrixForm or not.
> > (Transpose/@m if it's wrapped, Transpose@m if not.)
> >
> > But if we want Help's claim that evaluation is not affected to be true (it
> > currently is NOT), then we have to redefine Transpose, Inverse, etc. as in
> > my example.
> >
> > Only then would MatrixForm act properly as a wrapper, as intended.
> >
> > Bobby
> >
> 
> 
> > On Tue, 23 Dec 2003 18:38:10 +0900, Andrzej Kozlowski <akoz at mimuw.edu.pl>
> > wrote:
> >
> > > This of course works, but presumably he would want do this for other
> > > functions, (e.g. Inverse etc), not just transpose. So it seems to me it
> > > is easier simply to use Map:
> > >
> > > m = { {1, 2, 3}, {4, 5, 6} } // MatrixForm
> > > Transpose/@m
> > >
> > > etc.
> > >
> > > Andrzej Kozlowski
> > >
> 
> 
> Correct Dr Bob,
> 
> But why do we have to resort to all these tricks? Why can't Mathematica just
> accept a MatrixForm (or any other representation form) of the object
> in its functions (Transpose in this example) just as well as the
> list representation?
> 
> Each Mathematica function, where needed, could start by checking if this
> 'Wrapper' as you call it exists, and converts it to a list
> representation (remove the wrapper), and do its thing on the list,
> and at the end put the 'wrapper' around the result as needed and
> return the result to the user?
> 
> This way one does not have to worry which form of an object one uses,
> the representation form or the list form.
> 
> i.e. representation form will be transparent to all Mathematica functions.


  • Prev by Date: Re: Re: Compile
  • Next by Date: On MS-Windows -- Calling MS-DOS Applications from Mathematica
  • Previous by thread: Re: Transpose matrix does not work when MatrixForm is used, why?
  • Next by thread: I don't know where else to post such questions as