1

How to get non-trivial solution for such equation with Numpy?

r1 = r1 * 0.03  + r2 * 0.88 + r3 * 0.2425 + r4 * 0.03 + r5 * 0.03
r2 = r1 * 0.455 + r2 * 0.03 + r3 * 0.2425 + r4 * 0.03 + r5 * 0.88
r3 = r1 * 0.455 + r2 * 0.03 + r3 * 0.03   + r4 * 0.03 + r5 * 0.03
r4 = r1 * 0.03  + r2 * 0.03 + r3 * 0.2425 + r4 * 0.03 + r5 * 0.03
r5 = r1 * 0.03  + r2 * 0.03 + r3 * 0.2425 + r4 * 0.88 + r5 * 0.03
mirt
  • 1,453
  • 1
  • 17
  • 35
  • You wrote down the equation `Ax=x`... what solution do you hope to get? Are all eigenvalues equal to 1? – ely Nov 08 '12 at 22:31
  • 1
    There are answers to this question around here. The idea is to search for the null-space of the `A*x=0` system probably. IE: http://stackoverflow.com/questions/5889142/python-numpy-scipy-finding-the-null-space-of-a-matrix – seberg Nov 08 '12 at 22:34
  • I think you mean the null space of `A-I`. "The null space" of an equation isn't a thing. – ely Nov 08 '12 at 22:44
  • Note that the nullspace of `A*x=0` would only sensibly mean the nullspace of A. And that's *not* correct here. As in standard linear algebra, you want vectors such that `(A-kI)x = 0` for the eigenvalues `k`. In this case you only want it for `k=1`. But then you're looking for the nullspace of `A-kI`, *not* of `A`. The distinction matters, which is why the question linked in the comment above isn't relevant here. This is elementary linear algebra, so when someone asks about finding eigenvalues, you should not being with "find the nullspace...". That's silly... it's the *definition*. – ely Nov 09 '12 at 19:23

1 Answers1

2

If you're just looking for a library function that does this, just use numpy.linalg.eig and look for the eigenvector with eigenvalue equal to 1. If you need to implement an iterative solver, probably the power method is the best idea for this. It should simply work because the vector with eigenvalue of 1 is also the one with largest eigenvalue. Krylov subspace method (Rayleigh iteration) should work well on this too.

ely
  • 74,674
  • 34
  • 147
  • 228