Ask Your Question

How to implement Hensel's Lemma recursion?

asked 2020-09-13 20:46:36 -0500

masseygirl 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 02:33:33 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2020-09-14 04:50:56 -0500

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-13 20:46:36 -0500

Seen: 44 times

Last updated: Sep 14