Ask Your Question

applying the script to running over variables-(write to file/read from file?)

asked 2014-09-24 02:53:59 -0500

algebraicallyclosed gravatar image

As I am new in programming with SAGE, I wonder whether anyone can help me in this topic which I think is a matter of writing results to a file first, and then taking them from there.

In particular, I have a command like this;

n = 11
K = GF(4,'a')
R = PolynomialRing(GF(4,'a'),"x")
x = R.gen()
a = K.gen()

v = [1,0,0,0,1,1,1,0,0,0,1]
f = x^n-R(v)
S = R.quotient(f, 'y')
y = S.gen()

In the later steps I am using this v as a list of coefficients of a polynomial. And I do some algebra on them. But I want this v to run over all possible 11-length vectors over the finite field K as I defined. And I want to get the results for each v separately.

How can I write a program that will do this for me?

Thanks in advance.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2014-09-24 14:27:32 -0500

The corresponding vector space is K^n. Then you can just

for v in K^n:
    # whatever...
edit flag offensive delete link more


Now, ok to get v's from there but then below there is an algebraic process, for example, it will take each v and apply some procedure and get a result for this v. I want the results listed for each v at the end of the process.:(.

algebraicallyclosed gravatar imagealgebraicallyclosed ( 2014-09-30 04:58:17 -0500 )edit

[your_procedure(v) for v in K^n]

Dima gravatar imageDima ( 2014-09-30 17:13:23 -0500 )edit

answered 2014-09-24 08:36:33 -0500

ndomes gravatar image
Do you want an iteration through all variations of [0,1] of length 10?

    V = Tuples([0,1],10)
    for v in V:
        print v
edit flag offensive delete link more


Actually, since I am working on GF(4) the elements are 0,1,a,a+1

algebraicallyclosed gravatar imagealgebraicallyclosed ( 2014-09-30 04:56:03 -0500 )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

1 follower


Asked: 2014-09-24 02:53:59 -0500

Seen: 99 times

Last updated: Sep 24 '14