Ticket #12812 (closed defect: fixed)

Opened 14 months ago

Last modified 13 months ago

Bug in summation of toric divisors

Reported by: novoselt Owned by: AlexGhitza
Priority: major Milestone: sage-5.0
Component: algebraic geometry Keywords: toric
Cc: vbraun Work issues:
Report Upstream: N/A Reviewers: Volker Braun
Authors: Andrey Novoseltsev Merged in: sage-5.0.rc0
Dependencies: Stopgaps:

Description

Here is the problem:

sage: P1 = toric_varieties.P1()
sage: print sum([P1.divisor(1)])
V(s) + V(t)

Which I think comes from

sage: print P1.divisor(1).parent()(0)
V(s)

Perhaps, we can allow creation of divisors by indices of rays/variables, but only in the form P1.divisor(0)? Since zero in the group of divisors should be just zero and other integers don't really make sense.

Attachments

trac_12812_toric_divisor_summation_bug.patch Download (5.9 KB) - added by novoselt 14 months ago.

Change History

comment:1 Changed 14 months ago by novoselt

Hi Volker,

I looked through the code and a possible solution is to catch integers in _element_constructor_ of ToricDivisorGroup instead of passing them down to ToricDivisor. "Catch" means replace 0 with None to construct the trivial divisor and raise an exception for anything else.

It is not very elegant, but keeps current functionality and X.divisor(i) returning the divisor of the i-th ray still seems quite reasonable to me, while X.divisor_group()(i) is questionable.

If you agree, I'll make the change and try to make it clear in the documentation of all the methods involved.

comment:2 Changed 14 months ago by vbraun

The whole ToricDivisor(X, int) construction is a bit wonky. Thinking about it, the fact that ToricDivisor(X,0) is not the trivial element in this Abelian group is just confusing. I'd prefer to get rid of integer arguments in it altogether, there are already enough ways to construct a toric divisor. And you can always replace it with ToricDivisorGroup(X).gen(int), so its not like its a big loss. I'd like to keep the convenience method X.divisor(i), mind you. What do you think?

comment:3 Changed 14 months ago by novoselt

Sounds good! Will post a patch over the weekend.

Changed 14 months ago by novoselt

comment:4 Changed 14 months ago by novoselt

  • Keywords toric added
  • Status changed from new to needs_review
  • Authors set to Andrey Novoseltsev

comment:5 Changed 13 months ago by vbraun

  • Status changed from needs_review to positive_review
  • Reviewers set to Volker Braun

Looks good!

comment:6 Changed 13 months ago by jdemeyer

  • Milestone changed from sage-5.0 to sage-5.1

comment:7 Changed 13 months ago by novoselt

Why can't this go into 5.0? It is a bugfix, not an enhancement, and it is small and non-invasive.

comment:8 Changed 13 months ago by jdemeyer

  • Milestone changed from sage-5.1 to sage-5.0

comment:9 Changed 13 months ago by jdemeyer

  • Status changed from positive_review to closed
  • Resolution set to fixed
  • Merged in set to sage-5.0.beta15

comment:10 Changed 13 months ago by jdemeyer

  • Merged in changed from sage-5.0.beta15 to sage-5.0.rc0

sage-5.0.beta15 == sage-5.0.rc0

Note: See TracTickets for help on using tickets.