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

• To: mathgroup at smc.vnet.net
• Subject: [mg45397] Re: Transpose matrix does not work when MatrixForm is used, why?
• From: "Ersek, Ted CIV NASPATUXENTRIVERMD 4.5.1.2" <ted.ersek at navy.mil>
• Date: Tue, 6 Jan 2004 04:16:56 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Recall the recent thread on how do ensure we can do math on matrices
wrapped in MatrixForm.
Apparently other solutions didn't quite do the trick.  I think the code
below is better.
(*------------------------------------------*)

Unprotect[MatrixForm];

=
{If,List,Set,SetDelayed,UpSet,UpSetDelayed,TagSet,TagSetDelayed,Format,
=
MakeBoxes,MakeExpression,ToBoxes,Shallow,Short,Hold,HoldForm,HoldComplete=
,
=
HoldPattern,Verbatim,Blank,BlankSequence,BlankNullSequence,Alternatives,

Pattern,Optional,Repeated,RepeatedNull,Condition,PatternTest,Rule,
RuleDelayed,FullForm,InputForm
}]==={}

Module[{result},
result = Replace[ {a1,a2,a3}, MatrixForm->Identity, 2, Heads->True
];
result = f@@result;
If[ MatrixQ@result, MatrixForm[result], result ]
]

(*---------------------------------------------------------*)
Now we can do the following and get the output in MatrixForm.

m1=MatrixForm[{{2,3,4},{1,5,2},{6,3,1}}]

Inverse[m1]

MatrixPower[m1,4]

m2={{2,0,4},{0,5,2},{0,3,1}};
m1.m1.m1.m2

Det[m1]

Part[m1,1,3]

----------------
Regards,
Ted Ersek