How does one solve equations over finite fields in SAGE?

1.2k Views Asked by At

Sage has the method solve (or function, I'm not sure what's the correct terminology) that finds solutions to 'symbolic expressions'. In particular, if one wants to find solutions for a given set of equations using solve, one has to define all variables beforehand using "var('x,y,z,...')".

My problem is that I'd like to solve equations in specific polynomial rings. In particular, I want to solve an equation over fields of characteristic 2, so I'm using $GF(2)$ as a prototype. However, I can neither apply solve nor even "collect" to the object $f$ that I generated in these few lines (and I believe it is because I didn't use var):

B.<x,y,x_0,y_0,a_1,a_2,a_3,a_4,a_6> = GF(2)[]

##the Weierstrass eq of an elliptic curve
eqn = y^2 + a_1*x*y + a_3*y - (x^3 + a_2*x^2 + a_4*x + a_6)

D_x_0 = eqn.derivative(x).substitute(x=x_0,y=y_0)

D_y_0 = eqn.derivative(y).substitute(x=x_0,y=y_0)

la  = -D_x_0/D_y_0

nu = (D_y_0*y_0 + D_x_0*x_0)/D_y_0

f=eqn.substitute(y=la*x+nu))