# Examples of Elliptic Curves, with Graphical Representations## plot([],figsize=(4,4),title='Here is a Graph',frame=True,axes_labels=['$x$-axis, units','$y$-axis, units'])## The examples are from Ash and Gros book Fearless symmetry#E=EllipticCurve([-1,0]);E# y2=x^3-x (implicitely) over the rational fieldE.plot(figsize=(4,4),thickness=4,rgbcolor=(0.1,0.7,0.1),title="Elliptic Curve",frame=True,axes_labels=['$x$-axis, units','$y$-axis, units'])
Elliptic Curve defined by y^2 = x^3 - x over Rational Field
# Addition on Elliptic Curves## The Group LawR=E([-1,0]);P=E([0,0]);Q=E([1,0])# defining the obvious points on the EC <-> roots of f(x)printP,Q,R# notice the use of homogeneous coordinates
(0 : 0 : 1) (1 : 0 : 1) (-1 : 0 : 1)
# Addition LawprintP+P,Q+Q,R+R# The point at infinity is (0:1:0)
(0 : 1 : 0) (0 : 1 : 0) (0 : 1 : 0)
O=E([0,1,0]);printO# ... Let's label it O
(0 : 1 : 0)
2*P==O# simple way of comparing ... ("if ... then ..." not needed)