On Thursday, June 4, 2015 at 3:11:59 PM UTC-7, Michael Orlitzky wrote:
>
> > Given a vector $v$ and a matrix $A$ of dimension $n$, one would say that 
> > $v$ is a cyclic vector of $A$ if the following set is linearly 
> independent 
> > $\{ v,Av,A^2v,..,A^{n-1}v \}$. 
> > 
> > Is there a way to test this property on SAGE given a $v$ and a $A$?   
> > 
>
> Sure, using list comprehensions again. First we construct the list of 
> A(v), A^2(v), etc. Then we stick those vectors in a big matrix, and ask 
> for its rank. If the matrix has full rank, it's columns/rows are 
> independent. 
>
>
>   def f(A,v): 
>       M = matrix([ (A^j)*v for j in range(0,len(v)) ]) 
>       return M.rank() == len(v) 
>
> Note that you will need to pass that function a vector (that you get 
> from calling vector() on a list), not a list. For example, 
>
>   sage: A = matrix([[1,2],[3,4]]) 
>   sage: v = vector([1,2]) 
>   sage: f(A,v) 
>   True 
>

In some cases, Sage's built-in linear algebra functions might be more 
efficient:

sage: A = matrix( [[1,2],[3,4]] )
sage: v = vector([1,2])
sage: def is_cyclic_vector( v, A ):
        return not A.iterates( v, A.ncols() ).is_singular()
....: 
sage: is_cyclic_vector( v, A )
True

 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to