Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement dual subdivision and weight vectors for tropical variety #38536

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from

Conversation

verreld7
Copy link
Contributor

@verreld7 verreld7 commented Aug 20, 2024

This PR introduces some new methods in TropicalVariety related to dual subdivision and weight vectors.

Summary of changes:

  1. Add dual_subdivision in TropicalVariety: return the dual subdivision for any tropical variety as a Graph object

  2. Add _components_of_vertices in TropicalCurve: intermediate method the help calculate weight vectors

  3. Add weight_vectors in TropicalCurve: return the weight vectors of each vertex

  4. Add weight_vectors in TropicalSurface: return the weight vectors of each unique line of intersection

  5. Add a few methods related to dual subdivision of tropical curve such as:

    • is_smooth
    • is_simple
    • genus
    • contribution

CC: @tscrim

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

#37962: issues related to this PR
#38291: continuation of this PR

Copy link

github-actions bot commented Aug 22, 2024

Documentation preview for this PR (built with commit 204a525; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@tscrim tscrim self-requested a review August 27, 2024 05:41
@verreld7 verreld7 marked this pull request as ready for review September 25, 2024 12:34
Copy link
Collaborator

@tscrim tscrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for taking so long to get to this. Here are my comments.

@@ -390,6 +405,180 @@ def tropical_variety(self):
return TropicalSurface(self)
return TropicalVariety(self)

def Newton_polytope(self):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def Newton_polytope(self):
def newton_polytope(self):

We follow Python's naming conventions, even when the words are proper nouns.

Comment on lines +509 to +511
sage: p3 = R(8) + R(4)*x + R(2)*y + R(1)*x^2 + x*y + R(1)*y^2 \
....: + R(2)*x^3 + x^2*y + x*y^2 + R(4)*y^3 + R(8)*x^4 \
....: + R(4)*x^3*y + x^2*y^2 + R(2)*x*y^3 + y^4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sage: p3 = R(8) + R(4)*x + R(2)*y + R(1)*x^2 + x*y + R(1)*y^2 \
....: + R(2)*x^3 + x^2*y + x*y^2 + R(4)*y^3 + R(8)*x^4 \
....: + R(4)*x^3*y + x^2*y^2 + R(2)*x*y^3 + y^4
sage: p3 = (R(8) + R(4)*x + R(2)*y + R(1)*x^2 + x*y + R(1)*y^2
....: + R(2)*x^3 + x^2*y + x*y^2 + R(4)*y^3 + R(8)*x^4
....: + R(4)*x^3*y + x^2*y^2 + R(2)*x*y^3 + y^4)

You can see in the built html doc the output is strange. Plus this is considered to be better practice.

Comment on lines +521 to +524
p3 = R(8) + R(4)*x + R(2)*y + R(1)*x**2 + x*y + R(1)*y**2 \
+ R(2)*x**3 + x**2*y + x*y**2 + R(4)*y**3 + R(8)*x**4 \
+ R(4)*x**3*y + x**2*y**2 + R(2)*x*y**3 + y**4
sphinx_plot(p3.dual_subdivision().plot())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p3 = R(8) + R(4)*x + R(2)*y + R(1)*x**2 + x*y + R(1)*y**2 \
+ R(2)*x**3 + x**2*y + x*y**2 + R(4)*y**3 + R(8)*x**4 \
+ R(4)*x**3*y + x**2*y**2 + R(2)*x*y**3 + y**4
sphinx_plot(p3.dual_subdivision().plot())
p3 = (R(8) + R(4)*x + R(2)*y + R(1)*x**2 + x*y + R(1)*y**2
+ R(2)*x**3 + x**2*y + x*y**2 + R(4)*y**3 + R(8)*x**4
+ R(4)*x**3*y + x**2*y**2 + R(2)*x*y**3 + y**4)
sphinx_plot(p3.dual_subdivision().plot())

Comment on lines -14 to +15
sage: (x + R(3)*x) * (x^2 + x)
3*x^3 + 3*x^2
sage: (x^2 + R(1)*x + R(-1))^2
0*x^4 + 1*x^3 + 2*x^2 + 0*x + (-2)
sage: (x^2 + x + R(0))^2
0*x^4 + 0*x^3 + 0*x^2 + 0*x + 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change these tests? Why not just add the extra one?

Comment on lines -171 to +169
OUTPUT: a list of tropical numbers
OUTPUT: A list of tropical numbers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this as our style is (usually) starting with a lower case in this instance.

corresponding to the exponents of the monomials of tropical
polynomial.

OUTPUT: :class:`sage.geometry.polyhedron.constructor.Polyhedron`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OUTPUT: :class:`sage.geometry.polyhedron.constructor.Polyhedron`
OUTPUT: :class:`~sage.geometry.polyhedron.constructor.Polyhedron`

the intersection of multiple components. Edges of the dual
subdivision correspond to the individual components.

OUTPUT: :class:`sage.geometry.polyhedral_complex.PolyhedralComplex`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
OUTPUT: :class:`sage.geometry.polyhedral_complex.PolyhedralComplex`
OUTPUT: :class:`~sage.geometry.polyhedral_complex.PolyhedralComplex`

p1 = x + y
sphinx_plot(p1.Newton_polytope().plot())

Newton polytope in three dimension::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Newton polytope in three dimension::
A Newton polytope in three dimension::


EXAMPLES:

Newton polytope for a two-variable tropical polynomial::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Newton polytope for a two-variable tropical polynomial::
A Newton polytope for a two-variable tropical polynomial::

Comment on lines +589 to +590
sage: tv.weight_vectors()
({0: ((u1, u3 - 7/3, u3 - 10/3, u3), {u1 <= u3 - 22/3}),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Conda test is reporting finding a slightly different solution. So it might be better to test the properties (that the balancing condition is satisfied) rather than the explicit output. (Although it is better to demonstrate the balancing condition does hold anyways.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants