Re: Transpose matrix does not work when MatrixForm is used, why?
- To: mathgroup at smc.vnet.net
- Subject: [mg45599] Re: Transpose matrix does not work when MatrixForm is used, why?
- From: drbob at bigfoot.com (Bobby R. Treat)
- Date: Fri, 16 Jan 2004 06:05:16 -0500 (EST)
- References: <bu0cdt$agi$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I doubt that most of us want ALL rectangular lists displayed as matrices.
I certainly don't.
Bobby
Paul Abbott <paul at physics.uwa.edu.au> wrote in message news:<bu0cdt$agi$1 at smc.vnet.net>...
> In article <bsoe80$en3$1 at smc.vnet.net>, Dr Bob <drbob at bigfoot.com>
> wrote:
>
> > No, Andrzej's solution works much better. That way I get to see m in
> > MatrixForm every time it is displayed... and still do math with it.
> >
> > Unprotect[MatrixForm];
> > MatrixForm /:
> > (f_)[MatrixForm[expr_,
> > opts___]] := MatrixForm[
> > f[expr], opts]
> > Protect[MatrixForm];
> > m = MatrixForm[{{1, 2, 3},
> > {4, 6, 5}, {9, 8, 7}}]
> > m
> > Transpose[m]
> > Inverse[m]
> >
> > His solution isn't complete, as this doesn't work yet:
> >
> > m.Inverse[m]
> >
> > This takes care of that:
> >
> > Unprotect[MatrixForm];
> > MatrixForm /: f_[MatrixForm[a_], MatrixForm[b_]] := MatrixForm[f[a, b]]
> > Protect[MatrixForm];
> >
> > But then this still doesn't work:
> >
> > m.m.m
> >
> > But this does:
> >
> > (m.m).m
> >
> > The behavior I want is nothing more than what Help says is already there
> > -- MatrixForm shouldn't affect evaluation.
>
> If you set your set your Default Output FormType to TraditionalForm then
> matrices are automatically displayed as such and everything works as you
> require. If you don't want to do this, you can just set things up so
> matrices are displayed in TraditionalForm as follows.
>
> $PrePrint := If[MatrixQ[#] == True, TraditionalForm[#], #] &
>
> Earlier you wrote that
>
> > > I don't want to see EVERY matrix in MatrixForm -- it takes up too much
> > > space on my screen, especially for a large matrix, where the screen isn't
> > > even wide enough to see a row in that format.
>
> You may find MatrixPlot in LinearAlgebra` useful here.
>
> Cheers,
> Paul