Re: Transpose matrix does not work when MatrixForm is used, why?
- To: mathgroup at smc.vnet.net
- Subject: [mg45532] Re: Transpose matrix does not work when MatrixForm is used, why?
- From: Paul Abbott <paul at physics.uwa.edu.au>
- Date: Tue, 13 Jan 2004 04:03:49 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
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 -- Paul Abbott Phone: +61 8 9380 2734 School of Physics, M013 Fax: +61 8 9380 1014 The University of Western Australia (CRICOS Provider No 00126G) 35 Stirling Highway Crawley WA 6009 mailto:paul at physics.uwa.edu.au AUSTRALIA http://physics.uwa.edu.au/~paul