Re: [sage-support] Change the field where a polynomial is considered
On 17 April 2014 01:55, Irene irene.alv...@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Change the field where a polynomial is considered
Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com javascript: wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com javascript:. To post to this group, send email to sage-s...@googlegroups.comjavascript:. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Change the field where a polynomial is considered
OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene.alv...@gmail.com wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Change the field where a polynomial is considered
I think that this is exactly what I need. Nevertheless I cannot use neither i.section() nor i.inverse_image(). The second one because of the same reason as you, and the first one when I try it is says TypeError: 'NoneType' object is not callable. On Thursday, April 17, 2014 12:07:18 PM UTC+2, John Cremona wrote: OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene@gmail.com javascript: wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com javascript:. To post to this group, send email to sage-s...@googlegroups.comjavascript:. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Change the field where a polynomial is considered
On 17 April 2014 08:43, Irene irene.alv...@gmail.com wrote: I think that this is exactly what I need. Nevertheless I cannot use neither i.section() nor i.inverse_image(). The second one because of the same reason as you, and the first one when I try it is says TypeError: 'NoneType' object is not callable. You'll have to post your actual code (and say which Sage version) for us to help debug that! John On Thursday, April 17, 2014 12:07:18 PM UTC+2, John Cremona wrote: OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene@gmail.com wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Change the field where a polynomial is considered
p=371 Fp=GF(p) E=EllipticCurve([Fp(3),Fp(5)]) j=E.j_invariant() l=13#Atkin prime n=((l-1)/2).round() r=2# Phi_13 factorize in factors of degree 2 s=12#Psi_13 factorize in factors of degree 12 #repsq(a,n) computes a^n def repsq(a,n): B = Integer(n).binary() C=list(B) k=len(B)-1 bk=a i=1 while i = k: if C[i]==1: bk=(bk^2)*a else: bk=bk^2 i=i+1 return bk d=E.division_polynomial(13) Fps=GF(repsq(p,s),'a') a=Fps.gen() Fpr=GF(repsq(p,r),'b') b=Fpr.gen() FFps=PolynomialRing(Fps) Fl=GF(l) c=GF(2) rts=d.roots(Fps,multiplicities=False) Px=rts[0] Py2=Px^3+3*Px+5 c=Fl.multiplicative_generator() def produx(n,Qx): if is_odd(n): pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1)* (Qx^3+3*Qx+5))/((E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2)) else: pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1))/((Qx^3+3*Qx+5)*E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2) return pro Ep=(X-produx(2,Px))*(X-produx(4,Px))*(X-produx(8,Px))*(X-produx(3,Px))*(X-produx(6,Px))*(X-produx(12,Px)) bb=b.minpoly().roots(Fps)[0][0] i=Fpr.hom([bb],Fps) j=i.section() PolynomialRing(Fpr,'x')([j(c) for c in Ep.coeffs()]) That was the code, and the version is 5.11. Maybe the problem is because the version is too old, but I was using another version and I got many problems and right now I don't have another option. On Thursday, April 17, 2014 5:47:32 PM UTC+2, John Cremona wrote: On 17 April 2014 08:43, Irene irene@gmail.com javascript: wrote: I think that this is exactly what I need. Nevertheless I cannot use neither i.section() nor i.inverse_image(). The second one because of the same reason as you, and the first one when I try it is says TypeError: 'NoneType' object is not callable. You'll have to post your actual code (and say which Sage version) for us to help debug that! John On Thursday, April 17, 2014 12:07:18 PM UTC+2, John Cremona wrote: OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene@gmail.com wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this
Re: [sage-support] Change the field where a polynomial is considered
This works for me in Sage 5.13 (I don't have an older version installed), after replacing the definition of FFps by FFps.X=PolynomialRing(Fps) # the .X was missing However, without the .X the error I got was different from yours (TypeError: You must specify the names of the variables.) Op donderdag 17 april 2014 17:05:20 UTC+1 schreef Irene: p=371 Fp=GF(p) E=EllipticCurve([Fp(3),Fp(5)]) j=E.j_invariant() l=13#Atkin prime n=((l-1)/2).round() r=2# Phi_13 factorize in factors of degree 2 s=12#Psi_13 factorize in factors of degree 12 #repsq(a,n) computes a^n def repsq(a,n): B = Integer(n).binary() C=list(B) k=len(B)-1 bk=a i=1 while i = k: if C[i]==1: bk=(bk^2)*a else: bk=bk^2 i=i+1 return bk d=E.division_polynomial(13) Fps=GF(repsq(p,s),'a') a=Fps.gen() Fpr=GF(repsq(p,r),'b') b=Fpr.gen() FFps=PolynomialRing(Fps) Fl=GF(l) c=GF(2) rts=d.roots(Fps,multiplicities=False) Px=rts[0] Py2=Px^3+3*Px+5 c=Fl.multiplicative_generator() def produx(n,Qx): if is_odd(n): pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1)* (Qx^3+3*Qx+5))/((E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2)) else: pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1))/((Qx^3+3*Qx+5)*E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2) return pro Ep=(X-produx(2,Px))*(X-produx(4,Px))*(X-produx(8,Px))*(X-produx(3,Px))*(X-produx(6,Px))*(X-produx(12,Px)) bb=b.minpoly().roots(Fps)[0][0] i=Fpr.hom([bb],Fps) j=i.section() PolynomialRing(Fpr,'x')([j(c) for c in Ep.coeffs()]) That was the code, and the version is 5.11. Maybe the problem is because the version is too old, but I was using another version and I got many problems and right now I don't have another option. On Thursday, April 17, 2014 5:47:32 PM UTC+2, John Cremona wrote: On 17 April 2014 08:43, Irene irene@gmail.com wrote: I think that this is exactly what I need. Nevertheless I cannot use neither i.section() nor i.inverse_image(). The second one because of the same reason as you, and the first one when I try it is says TypeError: 'NoneType' object is not callable. You'll have to post your actual code (and say which Sage version) for us to help debug that! John On Thursday, April 17, 2014 12:07:18 PM UTC+2, John Cremona wrote: OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene@gmail.com wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support.
Re: [sage-support] Change the field where a polynomial is considered
Your code works ok with Sage 6.1.1 (apart from a small slip in the code you posted: the line FFps=PolynomialRing(Fps) should say FFpsX=PolynomialRing(Fps) and the result is x^6 + (973912*b + 2535329)*x^5 + (416282*b + 3608920)*x^4 + (686636*b + 908282)*x^3 + (2100014*b + 2063451)*x^2 + (2563113*b + 751714)*x + 2687623*b + 1658379 On 17 April 2014 09:05, Irene irene.alv...@gmail.com wrote: p=371 Fp=GF(p) E=EllipticCurve([Fp(3),Fp(5)]) j=E.j_invariant() l=13#Atkin prime n=((l-1)/2).round() r=2# Phi_13 factorize in factors of degree 2 s=12#Psi_13 factorize in factors of degree 12 #repsq(a,n) computes a^n def repsq(a,n): B = Integer(n).binary() C=list(B) k=len(B)-1 bk=a i=1 while i = k: if C[i]==1: bk=(bk^2)*a else: bk=bk^2 i=i+1 return bk d=E.division_polynomial(13) Fps=GF(repsq(p,s),'a') a=Fps.gen() Fpr=GF(repsq(p,r),'b') b=Fpr.gen() FFps=PolynomialRing(Fps) Fl=GF(l) c=GF(2) rts=d.roots(Fps,multiplicities=False) Px=rts[0] Py2=Px^3+3*Px+5 c=Fl.multiplicative_generator() def produx(n,Qx): if is_odd(n): pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1)* (Qx^3+3*Qx+5))/((E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2)) else: pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1))/((Qx^3+3*Qx+5)*E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2) return pro Ep=(X-produx(2,Px))*(X-produx(4,Px))*(X-produx(8,Px))*(X-produx(3,Px))*(X-produx(6,Px))*(X-produx(12,Px)) bb=b.minpoly().roots(Fps)[0][0] i=Fpr.hom([bb],Fps) j=i.section() PolynomialRing(Fpr,'x')([j(c) for c in Ep.coeffs()]) That was the code, and the version is 5.11. Maybe the problem is because the version is too old, but I was using another version and I got many problems and right now I don't have another option. On Thursday, April 17, 2014 5:47:32 PM UTC+2, John Cremona wrote: On 17 April 2014 08:43, Irene irene@gmail.com wrote: I think that this is exactly what I need. Nevertheless I cannot use neither i.section() nor i.inverse_image(). The second one because of the same reason as you, and the first one when I try it is says TypeError: 'NoneType' object is not callable. You'll have to post your actual code (and say which Sage version) for us to help debug that! John On Thursday, April 17, 2014 12:07:18 PM UTC+2, John Cremona wrote: OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene@gmail.com wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x]. John Cremona -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com. To post to this group, send email to sage-s...@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit
Re: [sage-support] Change the field where a polynomial is considered
I got it in another version! Thank you very much! On Thursday, April 17, 2014 6:18:56 PM UTC+2, John Cremona wrote: Your code works ok with Sage 6.1.1 (apart from a small slip in the code you posted: the line FFps=PolynomialRing(Fps) should say FFpsX=PolynomialRing(Fps) and the result is x^6 + (973912*b + 2535329)*x^5 + (416282*b + 3608920)*x^4 + (686636*b + 908282)*x^3 + (2100014*b + 2063451)*x^2 + (2563113*b + 751714)*x + 2687623*b + 1658379 On 17 April 2014 09:05, Irene irene@gmail.com javascript: wrote: p=371 Fp=GF(p) E=EllipticCurve([Fp(3),Fp(5)]) j=E.j_invariant() l=13#Atkin prime n=((l-1)/2).round() r=2# Phi_13 factorize in factors of degree 2 s=12#Psi_13 factorize in factors of degree 12 #repsq(a,n) computes a^n def repsq(a,n): B = Integer(n).binary() C=list(B) k=len(B)-1 bk=a i=1 while i = k: if C[i]==1: bk=(bk^2)*a else: bk=bk^2 i=i+1 return bk d=E.division_polynomial(13) Fps=GF(repsq(p,s),'a') a=Fps.gen() Fpr=GF(repsq(p,r),'b') b=Fpr.gen() FFps=PolynomialRing(Fps) Fl=GF(l) c=GF(2) rts=d.roots(Fps,multiplicities=False) Px=rts[0] Py2=Px^3+3*Px+5 c=Fl.multiplicative_generator() def produx(n,Qx): if is_odd(n): pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1)* (Qx^3+3*Qx+5))/((E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2)) else: pro=Qx-(E.division_polynomial(n-1,(Qx,1),two_torsion_multiplicity=1)*E.division_polynomial(n+1,(Qx,1),two_torsion_multiplicity=1))/((Qx^3+3*Qx+5)*E.division_polynomial(n,(Qx,1),two_torsion_multiplicity=1)^2) return pro Ep=(X-produx(2,Px))*(X-produx(4,Px))*(X-produx(8,Px))*(X-produx(3,Px))*(X-produx(6,Px))*(X-produx(12,Px)) bb=b.minpoly().roots(Fps)[0][0] i=Fpr.hom([bb],Fps) j=i.section() PolynomialRing(Fpr,'x')([j(c) for c in Ep.coeffs()]) That was the code, and the version is 5.11. Maybe the problem is because the version is too old, but I was using another version and I got many problems and right now I don't have another option. On Thursday, April 17, 2014 5:47:32 PM UTC+2, John Cremona wrote: On 17 April 2014 08:43, Irene irene@gmail.com wrote: I think that this is exactly what I need. Nevertheless I cannot use neither i.section() nor i.inverse_image(). The second one because of the same reason as you, and the first one when I try it is says TypeError: 'NoneType' object is not callable. You'll have to post your actual code (and say which Sage version) for us to help debug that! John On Thursday, April 17, 2014 12:07:18 PM UTC+2, John Cremona wrote: OK, that makes sense now. It boils down to this: given an element of F12=GF(p^12) which happens to lie in F2 = GF(p^2), how to express it in terms of a generator of F2. This is not quite as easy as it should be but this works (assuming that you have defined F12 with generator a and F2 with generator b): sage: bb = b.minpoly().roots(F12)[0][0] sage: i = F2.hom([bb],F12) sage: j = i.section() Here we have defined an embedding i of F2 into F12 by find a place to map b (called bb) and set j to be an inverse to i. (I think we should be use i.inverse_image() but that gave me a NotImplementedError, which is a pity since I have used sort of construction easily in extensions of number fields). Now if f is your polynomial in F12[x] whose coefficients lie in F2 you can say sage: PolynomialRing(F2,'X')([j(c) for c in f.coeffs()]) to get what you want, I hope! John On 17 April 2014 02:52, Irene irene@gmail.com wrote: Sorry, I didn't write it correctly. I meant GF(p^12,'a') instead of GF(p^13,'a'). As 2 divides 12, GF(p^12,'a') is an extension of GF(p^2,'b'). My question is the same now with the correct data. On Thursday, April 17, 2014 11:04:40 AM UTC+2, John Cremona wrote: On 17 April 2014 01:55, Irene irene@gmail.com wrote: Hello! I want to define a polynomial that I know lies in GF(p^2,'b')[x], p=371. The problem is that I have to define it as a product E=(X-a_1)*(X-a_2)*(X-a_3)*(X-a_4)*(X-a_5)*(X-a_6), where every a_j is in GF(p^13,'a')[X]. I tried to do GF(p^2,'b')[x](E), but then Sage just changes the generator 'a' and writes the same expression with the generator 'b'. Any idea about how to do this? Thank you!! Did you write that correctly? GF(p^13) is not an extension of GF(p^2). If a1 is in GF(p^13) then a1.minpoly() will give its min poly, in GF(p)[x].