Thanks to John Palmieri bringing this question to the attention of sage-support group, the following answer was given by Nils Bruin and Kwankyu:
P2.<x,y,z> = ProjectiveSpace(QQ, 2)
f = 2*x^5 - 4*x^3*y*z + x^2*y*z^2 + 2*x*y^3*z + 2*x*y^2*z^2+ y^5
C = Curve(f)
kC = C.function_field()
D = kC(kC.base_field().gen(0)).differential().divisor()
L,m,s = (-D).function_space()
#the routine below is a bit of a shortcut based on how the affine patch for kC
#is chosen. In more general code this would need to be a little more sophisticated
def liftkC(u):
return sum([(m.numerator()(y/x))/(m.denominator()(y/x))*(z/x)^i for i,m in enumerate(u.list())])
liftedbasis = [liftkC(m(b)) for b in L.basis()]
den = lcm([b.denominator() for b in liftedbasis])
liftedbasis = [parent(x)(b*den) for b in liftedbasis]
phi = C.hom(liftedbasis, P2)
phi.image()
As pointed out by Kwankyu, when the issue # 36592 is fixed, the code can be simplified to:
P2.<x,y,z> = ProjectiveSpace(QQ, 2)
f = 2*x^5 - 4*x^3*y*z + x^2*y*z^2 + 2*x*y^3*z + 2*x*y^2*z^2+ y^5
C = Curve(f)
kC = C.function_field()
K = kC.gen().differential().divisor() # canonical divisor
basis = (-K).basis_function_space()
Basis = [C._pull_from_function_field(f) for f in basis]
phi = C.hom(Basis, P2)
phi.image() # conic
I think that if there was someone with such abilities that he/she would have already answered it in my original question. But I upvote your question, maybe it gets more attention.
I would not bet on that. Converting a code may just a technical thing, it's just beyond my skills in that particular area.
I don't see an equivalent to
CanonicalDivisor(C)
, but I am not an expert in algebraic geometry. Parts of Sage were written with Magma as a model (in order to provide a free replacement for Magma), so the functionality might be there. The translation of the first few lines:P2.<x,y,z> = ProjectiveSpace(QQ, 2)
andf = 2*x^5 - 4*x^3*y*z + x^2*y*z^2 + 2*x*y^3*z + 2*x*y^2*z^2+ y^5
andC = P2.curve(f)
.See https://groups.google.com/g/sage-supp... for some discussion and at least one suggestion.
@John Palmieri: The second half of the magma code does not use
CanonicalDivisor
but explicit rational point so no need to useCanonicalDivisor
if a point is known.