Ask Your Question

One-dimension subspace

asked 2013-02-04 20:33:19 -0600

Babgen gravatar image

updated 2013-02-05 00:36:17 -0600

I am looking for one-dimension subspace $x$ such that for every $v\in$$\langle x\rangle$ we have $v.v=0$.

I try this:

V = VectorSpace(GF(5),2)

for i in V.subspaces(1):

    for x in i:
       if (x*x==0):

but I have trouble with it:

sage gives me subspace "Vector space of degree 2 and dimension 1 over Finite Field of size 5 Basis matrix: [1 0]" this subspace is not satisfied my condition

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-02-04 22:27:55 -0600

ppurka gravatar image

You need to take care of the zero element of the subspace. for x in i will iterate over all the vectors including the zero vector.

edit flag offensive delete link more


how can I take care of the zero element?

Babgen gravatar imageBabgen ( 2013-02-05 00:34:43 -0600 )edit

If the subspaces are not too big, you can do for x in i[1:]: # rest of your code If the subspaces are big, then doing `i[1:]` will take time and memory. In this case, change your if condition if x != i.zero_vector() and x*x == 0: # rest of your code.

ppurka gravatar imageppurka ( 2013-02-05 02:54:17 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-02-04 20:33:19 -0600

Seen: 123 times

Last updated: Feb 05 '13