Ask Your Question
0

One-dimension subspace

asked 2013-02-05 03:33:19 +0100

Babgen gravatar image

updated 2013-02-05 07:36:17 +0100

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):
          print(i)

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
0

answered 2013-02-05 05:27:55 +0100

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

Comments

how can I take care of the zero element?

Babgen gravatar imageBabgen ( 2013-02-05 07:34:43 +0100 )edit
1

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 09:54:17 +0100 )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

Stats

Asked: 2013-02-05 03:33:19 +0100

Seen: 322 times

Last updated: Feb 05 '13