-
-
Notifications
You must be signed in to change notification settings - Fork 465
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
base: develop
Are you sure you want to change the base?
Conversation
Documentation preview for this PR (built with commit 204a525; changes) is ready! 🎉 |
There was a problem hiding this 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): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def Newton_polytope(self): | |
def newton_polytope(self): |
We follow Python's naming conventions, even when the words are proper nouns.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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()) |
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 |
There was a problem hiding this comment.
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?
OUTPUT: a list of tropical numbers | ||
OUTPUT: A list of tropical numbers |
There was a problem hiding this comment.
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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newton polytope in three dimension:: | |
A Newton polytope in three dimension:: |
|
||
EXAMPLES: | ||
|
||
Newton polytope for a two-variable tropical polynomial:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Newton polytope for a two-variable tropical polynomial:: | |
A Newton polytope for a two-variable tropical polynomial:: |
sage: tv.weight_vectors() | ||
({0: ((u1, u3 - 7/3, u3 - 10/3, u3), {u1 <= u3 - 22/3}), |
There was a problem hiding this comment.
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.)
This PR introduces some new methods in
TropicalVariety
related to dual subdivision and weight vectors.Summary of changes:
Add
dual_subdivision
inTropicalVariety
: return the dual subdivision for any tropical variety as a Graph objectAdd
_components_of_vertices
inTropicalCurve
: intermediate method the help calculate weight vectorsAdd
weight_vectors
inTropicalCurve
: return the weight vectors of each vertexAdd
weight_vectors
inTropicalSurface
: return the weight vectors of each unique line of intersectionAdd a few methods related to dual subdivision of tropical curve such as:
is_smooth
is_simple
genus
contribution
CC: @tscrim
📝 Checklist
⌛ Dependencies
#37962: issues related to this PR
#38291: continuation of this PR