You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ZZp = Zp(p=2,prec=10, type = 'fixed-mod')
PRZZp.<x> = ZZp[]
R.<pi> = ZZp.extension(x^2+x+1)
Fp = R.residue_field()
a = Fp(pi)
b = R(a); b
I get pi. Without 'fixed-mod', I get pi+O(2).
But when I do
PRZZ.<x> = ZZ[]
R.<pi> = ZZ.extension(x^2+x+1)
Fp = ResidueField(R.ideal(2))
a = Fp(pi)
b = R(a)
I get an error.
This can be solved with lift_map, but I feel like that should be in the conversion.
Furthermore, it would be nice to be able to lift polynomials with coefficients in the residue field. I made my own implementation of that as follows:
def polynomiallift(g,PR,PFp): #PFp is the ring of polynomials over the residue field, PR is the ring of polynomials over the integer ring, L is the lift map, and g is an element of PFp
if g.parent() != PFp:
raise Exception('first argument must be an element of the last argument')
Fp = PFp.base_ring()
L = Fp.lift_map()
if L.codomain() != PR.base_ring():
raise Exception('codomain of lift map must be base ring of PR')
f = PR(0)
var_str = PR.variable_name()
exec('vari = ' + var_str)
coeffs = g.coefficients(sparse=False)
for i in range(g.degree()+1):
f += L(coeffs[i])*vari^i
return f
When I do
I get pi. Without 'fixed-mod', I get pi+O(2).
But when I do
I get an error.
This can be solved with lift_map, but I feel like that should be in the conversion.
Furthermore, it would be nice to be able to lift polynomials with coefficients in the residue field. I made my own implementation of that as follows:
Component: number fields
Keywords: residue_field, lift_map
Issue created by migration from https://trac.sagemath.org/ticket/30100
The text was updated successfully, but these errors were encountered: