I modified the code and tried to trace computation. I think you stepped over the weakness of Sagemath.
The modified code is quoted below. The line with many minus signs is meant to separate the program in different cells of jupyter notebook. My impression is that the program computes R, P + Q, LHS = (P + Q) + R and then Q + R for RHS. After that the data for the outer call of P + (Q + R) becomes too big so that Sagemath cannot pass the parameters to add_EC. I introduced local variable myA. This should represent A instead of the coordinate a of P. Please verify the output. ``` def add_EC(vE, P, Q): print("add_EC is called with"); print("P = ", P); print("Q = ", Q); if P == 0: print("P == 0, returning Q"); return Q print("P != 0"); if Q == 0: print("Q == 0, returning P"); return P print("Q != 0"); # avoid confusion of a of elliptic curve with a of P. myA = vE[0] # I gues we are not using b of the equation. # myB = vE[1] x1 = P[0] y1 = P[1] x2 = Q[0] y2 = Q[1] print("Copied actual parameters in local variables"); if P == Q: print("P==Q"); if y1 == 0: print("y1 == 0, returning 0"); return 0 else: print("y1 != 0, comuting m"); m = (3*x1^2 + myA)/(2*y1) print("P==Q && y1 != 0"); else: print("P != Q"); if x1 == x2: print("x1 == x2, returning 0"); return 0 else: print("x1 != x2, computing m"); m = (y2 - y1)/(x2 - x1) print("P!=Q && x1!=x2"); print("Main case: intermediate variable m already computed"); print("m = ", m); c = y1 - m*x1 print("c = ", c); x3 = m^2 - x1 - x2 print("x3 = ", x3); y3 = m*x3 + c print("y3= ", y3); return [x3, -y3] #---------------------------------------------------------------------------------- R.<A, B, a, b, c, d> = PolynomialRing(QQ) eq1 = b^2 - a^3 - A*a - B eq2 = d^2 - c^3 - A*c - B S = R.quo([eq1, eq2]) F = FractionField(S) vE = [F(A), F(B)] P = [F(a), F(b)] Q = [F(c), F(d)] #---------------------------------------------------------------------------------- R = add_EC(vE, P, Q) #---------------------------------------------------------------------------------- R #---------------------------------------------------------------------------------- LHS = add_EC(vE, add_EC(vE, P, Q), R) #---------------------------------------------------------------------------------- LHS #---------------------------------------------------------------------------------- # Sagemath cannot handle the next step. # Make sure you are ready to terminate Sagemath, # before uncommenting the next line. # RHS = add_EC(vE, P, add_EC(vE, Q, R)) #---------------------------------------------------------------------------------- # RHS #---------------------------------------------------------------------------------- # LHS==RHS ``` -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/0fd653c1-3e95-43f6-975e-243dc977a95e%40googlegroups.com.