MathGroup Archive 2004

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

Search the Archive

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

This is related to an ongoing thread on computing Transpose (and other 
functions) of MatrixForm objects. There should be a better answer, but 
here's one in the meantime:

data = Array[{# + Random[], # - Random[]} &, {100}];
z = Regress[data, {1, x, x^2}, x, RegressionReport -> CovarianceMatrix]
X = CovarianceMatrix /. (z /. MatrixForm -> Identity)
X[[2, 2]]

This also works, but NOT when Ted Ersek's suggested fix for MatrixForm is 

X = CovarianceMatrix /. z /. MatrixForm -> Identity


"Bruce W. Colletti" <bcolletti at> wrote in message 
news:<btb8oi$jp4$1 at>...
> Re Mathematica 5.0 running under WinXP Home.
> Am using...
>     z = Regress[...RegressionReport->CovarianceMatrix];
>     X = CovarianceMatrix /. z;
> extract the given matrix. However, when I use X[[k,k]] to access 
> the k'th diagonal element, I get a row instead!  The culprit is that 
> MatrixForm is the X-head (as FullForm reveals).
> How can I strip away this head and make X a list of lists?
> Thankx.
> Bruce

  • Prev by Date: Re: Extracting Matrix
  • Next by Date: Re: Mathematica exports curves in pieces to Illustrator
  • Previous by thread: Re: On MS-Windows -- Calling MS-DOS Applications from Mathematica
  • Next by thread: Re: Transpose matrix does not work when MatrixForm is used, why?