# [Numpy-discussion] One question about the numpy.linalg.eig() routine

Val Kalatsky kalatsky@gmail....
Mon Apr 2 22:19:55 CDT 2012

```BTW this extra degree of freedom can be used to "rotate" the eigenvectors
along the unit circle (multiplication by exp(j*phi)). To those of physical
inclinations
it should remind of gauge fixing (vector potential in EM/QM).
These "rotations" can be used to make one (any) non-zero component of each
eigenvector be positive real number.
Finally to the point: it seems that numpy.linalg.eig uses these "rotations"
to turn the
diagonal elements in the eigenvector matrix to real positive numbers,
that's why the numpy solutions looks neat.
Val

PS Probably nobody cares to know, but the phase factor I gave in my 1st
email should be negated:
0.99887305445887753+0.047461785427773337j

On Mon, Apr 2, 2012 at 8:53 PM, Matthew Brett <matthew.brett@gmail.com>wrote:

> Hi,
>
> On Mon, Apr 2, 2012 at 5:38 PM, Val Kalatsky <kalatsky@gmail.com> wrote:
> > Both results are correct.
> > There are 2 factors that make the results look different:
> > 1) The order: the 2nd eigenvector of the numpy solution corresponds to
> the
> > 1st eigenvector of your solution,
> > note that the vectors are written in columns.
> > 2) The phase: an eigenvector can be multiplied by an arbitrary phase
> factor
> > with absolute value = 1.
> > As you can see this factor is -1 for the 2nd eigenvector
> > and -0.99887305445887753-0.047461785427773337j for the other one.
>
> Thanks for this answer; for my own benefit:
>
> Definition: A . v = L . v  where A is the input matrix, L is an
> eigenvalue of A and v is an eigenvector of A.
>
> http://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix
>
> In [63]: A = [[0.6+0.0j,
> -1.97537668-0.09386068j],[-1.97537668+0.09386068j, -0.6+0.0j]]
>
> In [64]: L, v = np.linalg.eig(A)
>
> In [66]: np.allclose(np.dot(A, v), L * v)
> Out[66]: True
>
> Best,
>
> Matthew
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120402/f1b7605f/attachment.html
```