Why calculations of eigenvectors of a 2 by 2 matrix with numpy crashes my Python session?

StackOverflow https://stackoverflow.com/questions/19206990

  •  30-06-2022
  •  | 
  •  

Вопрос

I try to do the following:

import numpy as np
from numpy import linalg as la
w, v = la.eig(np.array([[1, -1], [1, 1]]))

As a result I have a crash of the python session with the following message:

Illegal instruction (core dumped)

I tried to use scipy instead of numpy. The result is the same.

Это было полезно?

Решение

I suspect that there is a problem with your installation of python/numpy/scipy as when I try it I have no problems.

Python 2.7.4 (default, Sep 26 2013, 03:20:26) 
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> from numpy import linalg as la
>>> w, v = la.eig(np.array([[1, -1], [1, 1]]))
>>> w
array([ 1.+1.j,  1.-1.j])
>>> v
array([[ 0.70710678+0.j        ,  0.70710678+0.j        ],
       [ 0.00000000-0.70710678j,  0.00000000+0.70710678j]])
>>> 

I would suggest that you try a fresh installation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top