Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K.gen() where K = GF(p) returns 1, not a primitive element #3045

Closed
sagetrac-jxxcarlson mannequin opened this issue Apr 27, 2008 · 5 comments
Closed

K.gen() where K = GF(p) returns 1, not a primitive element #3045

sagetrac-jxxcarlson mannequin opened this issue Apr 27, 2008 · 5 comments

Comments

@sagetrac-jxxcarlson
Copy link
Mannequin

sagetrac-jxxcarlson mannequin commented Apr 27, 2008

sage: k = GF(7)
sage: k.gen()
1

Component: number theory

Keywords: galois field

Issue created by migration from https://trac.sagemath.org/ticket/3045

@aghitza
Copy link

aghitza commented Jan 23, 2009

comment:1

This is actually the correct behaviour. The function that returns a primitive element is K.multiplicative_generator(), not K.gen(). There was some inconsistency in the docstrings of the various types of finite fields, which is fixed by the attached patch.

@kedlaya
Copy link
Contributor

kedlaya commented Jan 23, 2009

comment:2

This otherwise deserves a positive review, except that I couldn't verify the claim in the doctest that the outputs of gen() and multiplicative_generator() can vary between runs. Is that really true?

@aghitza
Copy link

aghitza commented Jan 24, 2009

comment:3

Attachment: trac_3045.patch.gz

Kiran, I tried to find some examples and couldn't. I think the point of the warning in the docstring is that we are not guaranteeing that the finite fields code wouldn't change in the future in such a way that other generators would be returned; or, for that matter, that the same version of Sage running on wildly different architectures won't return different generators. I modified the docstrings a bit to (hopefully) make that more clear.

Note that multiplicative_generator() calls pari's znprimroot(), so whatever fuzziness there is in pari's finding a generator gets automatically inherited by Sage.

@roed314
Copy link
Contributor

roed314 commented Jan 24, 2009

comment:4

Looks good to me. I think the docstrings are clear enough.

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Jan 25, 2009

comment:5

Merged in Sage 3.3.alpha2.

Cheers,

Michael

@sagetrac-mabshoff sagetrac-mabshoff mannequin modified the milestones: sage-3.4.1, sage-3.3 Jan 25, 2009
@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Jan 25, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants