ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 15 Mar 2019 18:52:50 -0500elliptic curve arithmetic without inversionhttp://ask.sagemath.org/question/45784/elliptic-curve-arithmetic-without-inversion/ It seems when you add points on an elliptic curve in sage, it immediately divides by the z coordinate if it is not zero. Since I plan on working in a finite field of a large prime, I would rather it not calculate this inverse, but I'm not sure how to stop it from automatically doing so. How do I get it to leave the z coordinate alone so as to avoid inverting elements of my field?Fri, 15 Mar 2019 02:49:09 -0500http://ask.sagemath.org/question/45784/elliptic-curve-arithmetic-without-inversion/Comment by dan_fulea for <p>It seems when you add points on an elliptic curve in sage, it immediately divides by the z coordinate if it is not zero. Since I plan on working in a finite field of a large prime, I would rather it not calculate this inverse, but I'm not sure how to stop it from automatically doing so. How do I get it to leave the z coordinate alone so as to avoid inverting elements of my field?</p>
http://ask.sagemath.org/question/45784/elliptic-curve-arithmetic-without-inversion/?comment=45788#post-id-45788In this case it may be simplest to implement the own addition of points on the curve. An own class witn an `__add__` method and a `__mul__` method would do the job. Which formulas should be implemented for which curve explicitly?
Here are some examples for the usage of `__add__` and `__mul__`:
sage: 12+45
57
sage: 12.__add__(45)
57
sage: E = EllipticCurve( GF(7), [2,3] )
sage: P, Q = E.random_point(), E.random_point()
sage: P, Q
((2 : 1 : 1), (3 : 1 : 1))
sage: P.__add__(Q)
(2 : 6 : 1)
sage: P+Q
(2 : 6 : 1)
sage: P.__mul__(2)
(3 : 6 : 1)
sage: 2*P
(3 : 6 : 1)
sage: P.__mul__(12345)
(6 : 0 : 1)
sage: 12345*P
(6 : 0 : 1)Fri, 15 Mar 2019 18:52:50 -0500http://ask.sagemath.org/question/45784/elliptic-curve-arithmetic-without-inversion/?comment=45788#post-id-45788