@Lee Worden Your code is deciding the linear independence of the set {v,v*A,v*A^2,...,v*A^{dim(A)}}
But I want to decide the linear independence of the set {v, A*v,..,,A^{dim(A)-1}*v} On Fri, Jun 5, 2015 at 1:20 PM, Lee Worden <worden....@gmail.com> wrote: > > > 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 a topic in the > Google Groups "sage-support" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sage-support/HjjmEeJAPgs/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. > -- 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 sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.