Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
0

One-dimension subspace

asked 12 years ago

Babgen gravatar image

updated 12 years ago

I am looking for one-dimension subspace x such that for every vx 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

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 12 years ago

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.

Preview: (hide)
link

Comments

how can I take care of the zero element?

Babgen gravatar imageBabgen ( 12 years ago )
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 ( 12 years ago )

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: 12 years ago

Seen: 340 times

Last updated: Feb 05 '13