[GAP Forum] Finding roots of a polynomial
joyner.david at comcast.net
joyner.david at comcast.net
Fri Jan 7 11:35:48 GMT 2005
Dear GAP Forum:
Frank Luebeck gave one answer to Dursun's question.
Here is an answer to a related, more general question.
++++++++++++++++++++++++++++++++++++++++++++++++++
Here's an example
p:=3; n:=4; F:=GF(p^n); c:=Random(F); r:=2;
x:=X(F,1); f:=x^r-c*x+c-1;
F_f:=FieldExtension( F, f );
alpha:=RootOfDefiningPolynomial(F_f);
#alpha is the desired root.
########## Another solution:
RootOfPolynomial:=function(f,R)
local F0,Ff,a;
F0:=CoefficientsRing(R);
Ff:=FieldExtension(F0,f);
a:=RootOfDefiningPolynomial(Ff);
return a;
end;
# example:
p:=3; n:=4; F:=GF(p^n); c:=Random(F); r:=2;
x:=X(F,1); f:=x^r-c*x+c-1;
R:=PolynomialRing( F, [ x ]);
a:=RootOfPolynomial(f,R);
# check:
Value(f,[x],[a]);
# example where F is not finite:
F:=Rationals;
x:=X(F,1); f:=x^2+x+1;
R:=PolynomialRing( F, [ x ]);
a:=RootOfPolynomial(f,R);
# check:
Value(f,[x],[a]);
Hope this helps.
+++++++++++++++++++++++++++++++++++++++++++++++++++
Bulutoglu Dursun A Civ AFIT/ENC wrote:
> Dear Gap Forum,
> I would like to first thank you for your help before.
> Now I am trying to solve the following problem:
> Solve an equation of the form x^r-c*x+c-1=0 in GF(p^n) for any non-zero
constant c.
>
> Dursun.
> Dear Gap Forum;
> I was wondering whether there is a function in GAP that does the
> following:
>
> Input: a list of numbers
> Output: the numbers in the list sorted from small to large and
> the frequencies at which they appear in the list.
> Dursun.
> _______________________________________________
> Forum mailing list
> Forum at mail.gap-system.org
> http://mail.gap-system.org/mailman/listinfo/forum
More information about the Forum
mailing list