I am trying to automate a Hensellian lift calculation.
S.u> = PolynomialRing(GF(5))
L.<x> = PolynomialRing(S)
f = x^5 + u*x^2 - u*x
a0 = 2
k = 50
for n in range (0, k):
**a(n+1) = f(an).truncate(n+1)**
Name = "a" + str(k)
print eval(Name)
In particular, I am stuck on implementing the ** step in a for-loop, or plugging a function into itself, as eval doesn't work to type change from string to integer when you are using it to define a variable. Does anyone know how to get around this or have a suggestion?
I tried to instead use a seperate function, but the same issue arises.
def henselstep(step, input):
return (step+1, f(input).truncate(n+1))
for n in range (0, 2):
astr = "a" + str(n)
avar = eval(astr)
henselstep(n, avar)
henselstep(henselstep(n, avar)) ???
But again, it isn't quite right, ack! I don't know how to handle the recursion and I'm banging my head on the wall, it must be simple but I keep getting it slightly wrong. Thank you very much for your time.