Hi, I replied to Dima's comment in https://github.com/sagemath/sage/commit/977ace651af9b99689f7b6507f91f8b4e2588ae9#r131138149.
Note that the "divisor" method of a curve had existed long before I added function field machinery and attached function fields to curves. Hence actually there are two systems of "divisors" of curves in Sage. The old system was implemented by William Stein, David Kohel, and Volker Braun. In the old system, a divisor is a formal sum of rational points with multiplicities. It is mainly implemented in `src/sage/schemes/generic/divisor.py`. Overall it is very rudimentary. Dima and John is attempting to use this system. The new system was implemented by me. Here a divisor is a formal sum of places of a function field with multiplicities. This system is available via the function field attached to a curve. This is much more powerful than the old system. You can compute the Riemann-Roch space of a divisor. Nils is using this system. I never attempted to combine the two systems, being afraid of breaking the old system (or just being lazy :-) There are similarly two systems in Magma too. But in Magma, the two systems are integrated tightly and seamlessly. I did some integration in Sage too but far from complete compared with Magma. I looked the Magma code in ask.sagemath. There's no problem in computing a canonical divisor for the curve (through the attached function field). Computing a basis of the Riemann-Roch space is no problem as well. Actually the hard part is to construct the morphism from C to P2 from the basis. Magma does this seamlessly. But Sage lacks this functionality (perhaps because I did not implement it). I think, the gist of the matter is to convert an element of the function field to a rational function of the coordinate ring of P2. I have no idea how to do this now... Once you construct the morphism, Sage can also compute the image of the morphism (perhaps I implemented this). Hence unfortunately the Magma code cannot be line by line converted to Sage code at present. On Saturday, October 28, 2023 at 8:27:07 AM UTC+9 Dima Pasechnik wrote: > On Sat, Oct 28, 2023 at 1:02 AM John H Palmieri <jhpalm...@gmail.com> > wrote: > > > Yes, I noticed that, too. It also fails to provide any information about > what ``v`` should be (beyond saying that it should be a "valid object"): > there is no INPUT block. > > I've left a comment here: > > https://github.com/sagemath/sage/commit/977ace651af9b99689f7b6507f91f8b4e2588ae9#r131117132 > > fortunately, the author, @kwankyu is active > > I can't locate the ticket, but it was merged in 9.0.beta9 > > > > > > > > On Friday, October 27, 2023 at 3:51:10 PM UTC-7 Dima Pasechnik wrote: > >> > >> By the way, the docstring of divisor() misses an example, it's > >> > >> def divisor(self, v, base_ring=None, check=True, reduce=True): > >> r""" > >> Return the divisor specified by ``v``. > >> > >> .. WARNING:: > >> > >> The coefficients of the divisor must be in the base ring > >> and the terms must be reduced. If you set ``check=False`` > >> and/or ``reduce=False`` it is your responsibility to pass > >> a valid object ``v``. > >> > >> EXAMPLES:: > >> > >> sage: x,y,z = PolynomialRing(QQ, 3, names='x,y,z').gens() > >> sage: C = Curve(y^2*z - x^3 - 17*x*z^2 + y*z^2) > >> > >> """ > >> > >> Is there an issue for this? > >> > >> On Sat, Oct 28, 2023 at 12:42 AM Nils Bruin <nbr...@sfu.ca> wrote: > >> > > >> > A canonical divisor is the divisor of any differential on C so the > following does the trick: > >> > > >> > sage: kC=C.function_field() > >> > sage: kC(kC.base_field().gen(0)).differential().divisor() > >> > > >> > It doesn't look like we quite have computation of Riemann-Roch spaces > natively in sage yet, so finding effective representatives requires a > little more work. In the RiemannSurface code this is done using singular's > adjoint ideal code (or by Baker's theorem in cases where it applies). For > this curve the canonical class is of degree -2, so there are no effective > representatives in this case. > >> > > >> > On Friday, 27 October 2023 at 15:14:00 UTC-7 John H Palmieri wrote: > >> >> > >> >> If anyone here knows anything about canonical divisors and their > implementation in Sage, please see > https://ask.sagemath.org/question/74034/converting-algebraic-geometry-magmas-code-to-sage/. > > The setup: > >> >> > >> >> sage: P2.<x,y,z> = ProjectiveSpace(QQ, 2) > >> >> sage: 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 > >> >> sage: C = P2.curve(f) > >> >> > >> >> How do you get the canonical divisor for C? > >> >> > >> >> (I encourage you to post answers directly to ask.sagemath.org, if > you're willing.) > >> >> > >> >> -- > >> >> John > >> >> > >> > -- > >> > 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...@googlegroups.com. > >> > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-support/91b14570-b83e-4dbf-8bca-0a2eff538a50n%40googlegroups.com > . > > > > -- > > 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...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-support/391d8ee7-0329-4a15-bc88-4b84973389abn%40googlegroups.com > . > -- 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/43198908-3a6f-42ab-ac50-23baa1b2be48n%40googlegroups.com.