from scipy import *
from pylab import plot, show, xlabel, ylabel, legend, xlim, ylim
import os, sys
os.system("uname -a")
print show_config()
#
# Tomohiro Suzuki and Toshio Suzuki
# An eigenvalue problem for derogatory matrices
# Journal of Computational and Applied Mathematics
# Vol. 199 (2007) pp. 245-250
#

A = array((
[740,115,-305,-170,-45,415,-310,-80],
[10,410,130,220,430,-70,-60,-310],
[-130,-430,410,-60,290,70,220,110],
[-380,45,185,390,-115,-215,-170,-220],
[60,10,430,270,550,350,-150,100],
[380,210,-210,170,210,410,30,-220],
[-170,255,115,-240,375,275,600,-150],
[-10,-345,-205,60,-145,-45,-360,390.]))
n = shape(A)[0]


w_e = linalg.eigvals(A)
wr,wi,vl,vr,info=linalg.flapack.dgeev(A,compute_vl=1,compute_vr=1,lwork=4*n,overwrite_a=0)

plot(w_e.real,w_e.imag,'b+')
legend(('$\lambda_i$',),shadow=True)
xlim(699,701)
xlabel(r'$\Re\lambda$')
ylabel(r'$\Im\lambda$')
show()

