 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: Problem computing eigenvalues, STATA vs. MATA

 From Herberto Gomez To statalist@hsphsun2.harvard.edu Subject Re: st: Problem computing eigenvalues, STATA vs. MATA Date Sun, 9 Jan 2011 11:17:33 -0500

```FYI

the eigenvlaues are -sqrt(3), sqrt(3), -1, 1, 0.

On Sun, Jan 9, 2011 at 8:08 AM, Zachary Neal <zpneal@gmail.com> wrote:
> I am trying to obtain the eigenvalues of a symmetric matrix.  However,
> I get different results depending on whether I use STATA or MATA.  For
> example:
>
> matrix define A = 0,1,1,0,0 \ 1,0,0,1,0 \ 1,0,0,0,1 \ 0,1,0,0,0 \ 0,0,1,0,0
> matrix symeigen eigenvalues1 eigenvectors1 = A
> matrix list eigenvalues1
>
> mata: A = 0,1,1,0,0 \ 1,0,0,1,0 \ 1,0,0,0,1 \ 0,1,0,0,0 \ 0,0,1,0,0
> mata: eigenvalues2 = 0
> mata: eigenvectors2 = 0
> mata: symeigensystem(A,eigenvalues2,eigenvectors2)
> mata: eigenvalues2
>
> In this case, eigenvalues1 does not equal eigenvalues2.  I believe the
> results yielded by STATA (i.e. eigenvalues1) are what I'm looking for.
>
> Why do these two sets of commands yield different results?  What
> commands are necessary in MATA to yield the same eigenvalues that are
> given by STATA?
>
> Thank you
> Zachary Neal
>
> --
> Zachary Neal, PhD
> Department of Sociology
> Michigan State University
> zpneal@msu.edu
> http://www.msu.edu/~zpneal
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```