### I wrote this code to find the value of u, but when I substitute the result back in, it doesn't satisfy the polynomial

F = GF(p)
R = PolynomialRing(F, "u")
u = R.gen()
equation = (3 * xG ^ 2 + a * u ^ 4) ^ 2 - (4 * xQ) * (
xG ^ 3 + a * u ^ 4 * xG + b * u ^ 6
) - (8 * xG) * (xG ^ 3 + a * u ^ 4 * xG + b * u ^ 6)

roots = equation.roots(multiplicities=False)

for root in roots:
print(hex(root))
print(hex(F((root ^ 4) * a)))
print(hex(F((root ^ 6) * b)))
I wrote this code to find the value of u, but when I substitute the result back in, it doesn't satisfy the polynomial