Question

I have a matrix T:

[ 0.2  0.4  0.4]
[ 0.8  0.2  0. ]
[ 0.8  0.   0.2]

I want to multiply it by a lhs row vector (s1,s2,s3) and set the product expression equal to the elements of the corresponding rhs column vector so it would be

vl * T = s( ..., ..., ...)

This will be equivalent to solving three linear equations from which you can solve for the eigenvector elements up to a scaling factor. Setting the sum of the elements equal to 1 then gives you the unit eigenvector.

For example, to get started, multiplying the lhs row vector times the first column of the matrix and setting the product equal to s1 gives you the equation 0.2 x s1 + 0.8 x s2 + 0.8 x s3 = s1.

The other two equations are obtained by multiplying the lhs row vector times the second and third columns of the matrix, and setting the products equal to s2 and s3, respectively. Solving these three equations will give you the relative values among s1, s2, and s3. Setting the sum of these equal to 1 will then give you the unit eigenvector elements.

I want to do this using python, here is my attempt:

    >>> import numpy as np
    >>> from scipy.linalg import eig
    >>> np.set_printoptions(precision=4)
    >>> T = np.mat("0.2 0.4 0.4;0.8 0.2 0.0;0.8 0.0 0.2")
    >>> np.set_printoptions(precision=4)
    >>> w, vl, vr = eig(T, left=True)
    >>> vlUnit = vl[:,1]/sum(vl[:,1])
    >>> s = vlUnit 
    >>> s
    array([  7.3543e+15,  -3.6772e+15,  -3.6772e+15])

So I know both vl and VlUnit are type numpy.array and T is matrix

I also cant read the results of s.

I converted and its 7354300000000000, -3677200000000000, 3677200000000000 which don't look right to me. What am I doing wrong??

Thanks,

Chris

No correct solution

OTHER TIPS

This should give you the v1 unit vector:

v1Unit = np.linalg.norm(v1[:, 1])
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top