File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
src/sage/rings/polynomial Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -913,6 +913,30 @@ cdef class LaurentPolynomial_univariate(LaurentPolynomial):
913
913
"""
914
914
return [i + self .__n for i in self .__u.exponents()]
915
915
916
+ def newton_polytope (self ):
917
+ r """
918
+ Return the Newton polytope of this Laurent polynomial.
919
+
920
+ EXAMPLES::
921
+
922
+ sage: R. <x> = LaurentPolynomialRing( QQ)
923
+ sage: f = 1 + x + 33 * x^ -3
924
+ sage: P = f. newton_polytope( ) ; P # needs sage. geometry. polyhedron
925
+ A 1-dimensional polyhedron in ZZ^ 1 defined as the convex hull of 2 vertices
926
+
927
+ TESTS::
928
+
929
+ sage: R. <x> = LaurentPolynomialRing( QQ)
930
+ sage: R( 0) . newton_polytope( ) # needs sage. geometry. polyhedron
931
+ The empty polyhedron in ZZ^ 0
932
+ sage: R( 1) . newton_polytope( ) # needs sage. geometry. polyhedron
933
+ A 0-dimensional polyhedron in ZZ^ 1 defined as the convex hull of 1 vertex
934
+ """
935
+ from sage.geometry.polyhedron.constructor import Polyhedron
936
+ from sage.rings.integer_ring import ZZ
937
+ return Polyhedron(vertices = [(e,) for e in self .exponents()],
938
+ base_ring = ZZ)
939
+
916
940
def __setitem__ (self , n , value ):
917
941
"""
918
942
EXAMPLES::
Original file line number Diff line number Diff line change @@ -1325,6 +1325,29 @@ cdef class LaurentPolynomial_mpair(LaurentPolynomial):
1325
1325
# Find the minimal valuation of x by checking each term
1326
1326
return Integer(min (e[i] for e in self .exponents()))
1327
1327
1328
+ def newton_polytope (self ):
1329
+ r """
1330
+ Return the Newton polytope of this Laurent polynomial.
1331
+
1332
+ EXAMPLES::
1333
+
1334
+ sage: R. <x, y> = LaurentPolynomialRing( QQ)
1335
+ sage: f = 1 + x* y + y** 2 + 33 * x^ -3
1336
+ sage: P = f. newton_polytope( ) ; P # needs sage. geometry. polyhedron
1337
+ A 2-dimensional polyhedron in ZZ^ 2 defined as the convex hull of 4 vertices
1338
+
1339
+ TESTS::
1340
+
1341
+ sage: R. <x,y> = LaurentPolynomialRing( QQ)
1342
+ sage: R( 0) . newton_polytope( ) # needs sage. geometry. polyhedron
1343
+ The empty polyhedron in ZZ^ 0
1344
+ sage: R( 1) . newton_polytope( ) # needs sage. geometry. polyhedron
1345
+ A 0-dimensional polyhedron in ZZ^ 2 defined as the convex hull of 1 vertex
1346
+ """
1347
+ from sage.geometry.polyhedron.constructor import Polyhedron
1348
+ from sage.rings.integer_ring import ZZ
1349
+ return Polyhedron(vertices = self .exponents(), base_ring = ZZ)
1350
+
1328
1351
def has_inverse_of (self , i ):
1329
1352
"""
1330
1353
INPUT:
You can’t perform that action at this time.
0 commit comments