Suppose I have the unit vector, u.
from numpy import mat
u = mat([[0.9**0.5], [-(0.1)**0.5]])
# [ 0.9486833 -0.31622777]
The unit vector is an eigenvector of a matrix with integer entries. I also know that the eigenvalues are integers. So, the unit vector will contain irrational decimals that, when squared, are decimal approximations of rational numbers.
Is there any good way to find the smallest value k such that all entries of ku are integers? In general, k will be the square root of an integer.
A naive approach would be to square each entry in the vector and find the smallest ki that produces an integer. Then, k will be the square root the of LCM of all ki. I'm hoping there is a better approach than this.
Note that this is not a duplicate of this question.