MathGroup Archive 2004

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

Search the Archive

Re: Extracting Matrix

  • To: mathgroup at
  • Subject: [mg45408] Re: Extracting Matrix
  • From: Bill Rowe <readnewsciv at>
  • Date: Tue, 6 Jan 2004 04:17:15 -0500 (EST)
  • Sender: owner-wri-mathgroup at

On 1/5/04 at 3:50 AM, bcolletti at (Bruce W. Colletti) wrote:

> 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?

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:

To reply via email subtract one hundred and four

  • Prev by Date: Re: On MS-Windows -- Calling MS-DOS Applications from Mathematica
  • Next by Date: Re: Windows ME fonts
  • Previous by thread: Re: Extracting Matrix
  • Next by thread: Re: Extracting Matrix