Re: Extracting Matrix

*To*: mathgroup at smc.vnet.net*Subject*: [mg45408] Re: Extracting Matrix*From*: Bill Rowe <readnewsciv at earthlink.net>*Date*: Tue, 6 Jan 2004 04:17:15 -0500 (EST)*Sender*: owner-wri-mathgroup at wolfram.com

On 1/5/04 at 3:50 AM, bcolletti at compuserve.com (Bruce W. Colletti) wrote: > 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? The key is to keep in mind all expressions in Mathematica can be treated as lists. So, to strip the head MatrixForm you could do X = First@CovarianceMatrix/.z; Alternatively, you could access the desired element without stripping the head MatrixForm using: X[[1,k,k]] -- To reply via email subtract one hundred and four