# Drawing a line not segment

I want to draw a line passing through a point P and Q on an elliptic curve.

E = EllipticCurve([0,0,0,4,20])
print(E)
E.plot(xmin=-20, xmax=20, ymin=-20, ymax=20)
plotE = E.plot()
P=E(1,5)
R = - (P + P)
plotE += line([P.xy(),R.xy()],color='red')


Using this only draw a line segment from P to Q. How can I draw a line? I've looked on the doc but did not see an option for this. Any solution?

edit retag close merge delete

Please provide complete code that can be copied and pasted in a fresh Sage session.

Currently we are missing the definitions of E, P and R.

( 2021-01-15 14:16:29 +0100 )edit

@slelievre Thought that was not necessary, here it is.

( 2021-01-15 14:37:59 +0100 )edit

Sort by ยป oldest newest most voted

You can easily plot a segment between two suitable points on the line passing by P and R. For example, you can replace plotE += line([P.xy(),R.xy()],color='red') by:

vP, vR = vector(P.xy()), vector(R.xy())
PR = (vR - vP).normalized()
plotE += line([vP-5*PR, vP+4*PR], color="red")

more

PR = (lift(vR - vP)).normalized() is needed and after that TypeError: unsupported operand parent(s) for -: 'Vector space of dimension 2 over Finite Field of size 29' and 'Vector space of dimension 2 over Symbolic Ring' on the last line

( 2021-01-15 23:58:51 +0100 )edit

I don't understand why you need lift and have and error. See the full code correctly running in this SageMath Cell.

( 2021-01-16 04:53:52 +0100 )edit

Sorry, cells mixed! I have put it into a curve defined over GF. Yes, it is working. Thanks.

( 2021-01-16 15:50:02 +0100 )edit