Re: Extracting Matrix

*To*: mathgroup at smc.vnet.net*Subject*: [mg45410] Re: Extracting Matrix*From*: drbob at bigfoot.com (Bobby R. Treat)*Date*: Tue, 6 Jan 2004 04:17:24 -0500 (EST)*References*: <btb8oi$jp4$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

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]] It's strange that THIS doesn't work: X = CovarianceMatrix /. z /. MatrixForm -> Identity Bobby "Bruce W. Colletti" <bcolletti at compuserve.com> wrote in message news:<btb8oi$jp4$1 at smc.vnet.net>... > Re Mathematica 5.0 running under WinXP Home. > > Am using... > > z = Regress[...RegressionReport->CovarianceMatrix]; > X = CovarianceMatrix /. z; > > ...to 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