Re: [sage-support] Re: Canonical divisor help
On Sat, Oct 28, 2023 at 1:02 AM John H Palmieri 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 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. = 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+unsubscr...@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/CAAWYfq3o5nCfF5b4Lr1NHV4c_uN9G4SPtxBttt5tPmtqjT1FAw%40mail.gmail.com.
[sage-support] Re: Canonical divisor help
On Friday, 27 October 2023 at 15:42:24 UTC-7 Nils Bruin wrote: It doesn't look like we quite have computation of Riemann-Roch spaces natively in sage yet Correction, that DOES seem to be implemented as well: sage: kC=C.function_field() sage: D=kC(kC.base_field().gen(0)).differential().divisor() sage: (-D).function_space() That's actually a great gain in functionality! That code really deserves to be exercised and, inevitably, debugged from bugs that would be uncovered by extensive testing. -- 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/03d96b5c-63c8-4944-bf9c-81a0370cf229n%40googlegroups.com.
Re: [sage-support] Re: Canonical divisor help
Hi Dima, 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. 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 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. = 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+unsubscr...@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.
Re: [sage-support] Re: Canonical divisor help
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 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. = 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+unsubscr...@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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAAWYfq0wr3ZFzM2BFUOqC3fvCkKy5OkArtU1MC0JOUidBAp34Q%40mail.gmail.com.
[sage-support] Re: Canonical divisor help
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. = 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+unsubscr...@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.
[sage-support] Canonical divisor help
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. = 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/47f02ff1-8125-4328-a2db-0db270e8eed8n%40googlegroups.com.
[sage-support] Re: help debugging latex() printing with trace()
On Thursday, 26 October 2023 at 16:03:27 UTC-7 Eric Majzoub wrote: I would like to debug the latex printing of an expression that ambiguous. To reproduce it: t = var('t') x = function('x')(t) latex( diff(x,t)^2 ) This produces ambiguous output, essentially: partial_t x^2 instead of (partial_t x)^2 I have tried: from sage.misc.trace import trace trace("latex( diff(x,t)^2 )") but I can't understand in which .py file the translation of "diff" occurs. As I understand the source code, there should be a _latex_(self) for every object or method to display latex code, but I can't seem to find it here. It happens here: https://github.com/sagemath/sage/blob/07a2afd65fb4b0a1c9cbc43ede7d4a18c921a000/src/sage/symbolic/pynac_impl.pxi#L691 However, the code deciding whether the base of an exponential expression needs parentheses is elsewhere. -- 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/92e62d2d-4b88-49c3-981d-dab6f01925e8n%40googlegroups.com.
Re: [sage-support] help debugging latex() printing with trace()
On Fri, Oct 27, 2023 at 1:03 AM Eric Majzoub wrote: > > I would like to debug the latex printing of an expression that ambiguous. > > To reproduce it: > t = var('t') > x = function('x')(t) > latex( diff(x,t)^2 ) > > This produces ambiguous output, essentially: > > partial_t x^2 > > instead of > > (partial_t x)^2 > > I have tried: > from sage.misc.trace import trace > trace("latex( diff(x,t)^2 )") > > but I can't understand in which .py file the translation of "diff" occurs. As > I understand the source code, there should be a _latex_(self) for every > object or method to display latex code, but I can't seem to find it here. This is done in pynac, a Sagemath package written in C++ (a fork of GiNaC) src/sage/symbolic/pynac.pxi contains the interface to it. HTH > > Any help is greatly appreciated. > > > -- > 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/a530254d-9fec-452f-80cd-153d3769d34fn%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/CAAWYfq1jyR8u9ScnHP2syVBdPE2EoaoUeM6nUs8PGhiH6y5nyQ%40mail.gmail.com.
[sage-support] How do I compute the Green function of a differential operator?
In Mathematica, you write: GreenFunction[{-u''[x], u[0] == 0, u[1] == 0}, u[x], {x, 0, 1}, y] and it gives you the Green function of the operator *L=-d^2/dx^2* (the first argument, -u''[x]). I want a corresponding function in SageMath. Thanks in advance! -- 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/efb44731-094f-4f4e-b7d2-b5e80d5f19f4n%40googlegroups.com.