Ask Your Question

How to implement Hensel's Lemma recursion?

asked 2020-09-14 03:46:36 +0200

tzeentch gravatar image

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.

edit retag flag offensive close merge delete


use a dictionary

FrédéricC gravatar imageFrédéricC ( 2020-09-14 09:33:33 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-09-14 11:50:56 +0200

FrédéricC gravatar image

To expand on my comment:

S.u> = PolynomialRing(GF(5))
L.<x> = PolynomialRing(S)
f = x^5 + u*x^2 - u*x
a = {}
a[0] = 2
k = 50
for n in range(k):
    a[n+1] = f(a[n]).truncate(n+1)
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-09-14 03:46:36 +0200

Seen: 548 times

Last updated: Sep 14 '20