Menu

[r2807]: / trunk / course / examples / scipy / example10.3.1  Maximize  Restore  History

Download this file

19 lines (16 with data), 424 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
>>> A = mat('[1 5 2; 2 4 1; 3 6 2]')
>>> la,v = linalg.eig(A)
>>> l1,l2,l3 = la
>>> print l1, l2, l3
(7.95791620491+0j) (-1.25766470568+0j) (0.299748500767+0j)
>>> print v[:,0]
array([-0.5297, -0.4494, -0.7193])
>>> print v[:,1]
[-0.9073 0.2866 0.3076]
>>> print v[:,2]
[ 0.2838 -0.3901 0.8759]
>>> print sum(abs(v**2),axis=0)
[ 1. 1. 1.]
>>> v1 = mat(v[:,0]).T
>>> print max(ravel(abs(A*v1-l1*v1)))
4.4408920985e-16
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.