On 06/04/2015 05:53 PM, Phoenix wrote:
> 
> Thanks!
> 
> Is there otherwise any standard operation in SAGE to create such vectors?
> 

If the construction isn't too complicated, a "list comprehension"
usually suffices. This will do what you want, I think:

  def elem(i,n):
      return [ ZZ(i == j) for j in range(0,n) ]

A list comprehension is written much like the usual math notation for
set construction, so nothing to be afraid of.


> 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

-- 
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.

Reply via email to