newbie working (again) in polynomial quotient rings

14 views
Skip to first unread message

eggartmumie

unread,
Dec 7, 2010, 4:14:06 PM12/7/10
to sage-support
Hi, (sorry I was interrupted)
I am a SAGE newbie working in polynomial quotient rings:
I want to implement the Patterson algorithm to decode Goppa Codes.
Therefore, I need to split a polynomial p in a quotient ring in its
even part p0 and its odd part p1
such that p(z) = p0^2(z)+z*p1^2(z) = (p0(z))^2+z*(p1(z))^2.
To do so in SAGE, I run into several problems:
First, I define

F.<x> = GF(4); Phi.<y> = PolynomialRing(F);

second, some irreducible polynomial over F

G = Phi(y^3+(x+1)*y^2+(x+1)*y+x+1);

third, a quotient ring in variable z (of course, the ring is a field)

z = var('z'); PhimodG = Phi.quotient(G,z);

As a test PhimodG.an_element() returns z whereas on PhimodG(z)
SAGE complains that z is _not_ a variable of Univariate Polynomial
Ring
in y over Finite Field in x of size 2^2.
Everything works if I use y instead of z. What am I missing?

For example, I define say p = PhimodG(y^3); which then prints as
(x + 1)*z^2 + (x + 1)*z + x + 1
'p.<tab>' lists no degree, no coefficients but e.g.
-- order which is deprecated and
-- additive_order and multiplicative_order which are not implemented.
What do I get wrong?

So in order to program my split I take p.list().
I define some function sqrt_in(F,a) which computes the square root of
a in field F.
Then, by hand I compute the polynomials p0 and p1 and test the result

lst = p.list();
lst0 = [sqrt_in(F,lst[0]), sqrt_in(F,lst[2]), F(0)];
lst1 = [sqrt_in(F,lst[1]), F(0)];
p0 = Phi(lst0); p1 = Phi(lst1);
sum = p0^2+y*p1^2; print sum==p

everything works fine, so that I programme a function split_in

def split_in(Phi,F,p):
# split the polynomial p in Phi, i.e. a polynomial over F
# into even part p0 and odd part p1 such that p(z)=p0^2(z)
+z*p1^2(z)
lst = p.list(); lst0 = []; lst1 = [];
for i in range(len(lst)):
if i%2==0:
lst0.append(sqrt_in(F,lst[i]));
else:
lst1.append(sqrt_in(F,lst[i]));
return (Phi(lst0),Phi(lst1));

But then

pair = split_in(Phi,F,p);
p0=pair[0]; p1=pair[1]; sum = p0^2+y*p1^2;
print 'sum =',sum; print sum==p^2

produces polynomials in y whereas p is a polynomial in z or prints as
a polynomial in z,
so that the comparison returns false. Again, what am I missing?
And if I'd use z instead, i.e. sum = p0^2+z*p1^2; then I get in my
humble opinion
somewhat strange error message

TypeError: __call__() takes exactly 1 positional argument (0 given)

The call sequence does not help. Again, I do not see any light.
Please enlight me, Thomas
Reply all
Reply to author
Forward
0 new messages