# Newton Polygons¶

This module implements finite Newton polygons and infinite Newton polygons having a finite number of slopes (and hence a last infinite slope).

sage.geometry.newton_polygon.NewtonPolygon = Parent for Newton polygons
class sage.geometry.newton_polygon.NewtonPolygon_element(polyhedron, parent)

Class for infinite Newton polygons with last slope.

last_slope()

Returns the last (infinite) slope of this Newton polygon if it is infinite and +Infinity otherwise.

EXAMPLES:

sage: from sage.geometry.newton_polygon import NewtonPolygon
sage: NP1 = NewtonPolygon([ (0,0), (1,1), (2,8), (3,5) ], last_slope=3)
sage: NP1.last_slope()
3

sage: NP2 = NewtonPolygon([ (0,0), (1,1), (2,5) ])
sage: NP2.last_slope()
+Infinity


We check that the last slope of a sum (resp. a product) is the minimum of the last slopes of the summands (resp. the factors):

sage: (NP1 + NP2).last_slope()
3
sage: (NP1 * NP2).last_slope()
3

plot(**kwargs)

Plot this Newton polygon.

Note

All usual rendering options (color, thickness, etc.) are available.

EXAMPLES:

sage: from sage.geometry.newton_polygon import NewtonPolygon
sage: NP = NewtonPolygon([ (0,0), (1,1), (2,6) ])
sage: polygon = NP.plot()

reverse(degree=None)

Returns the symmetric of self

INPUT:

• degree – an integer (default: the top right abscissa of this Newton polygon)

OUTPUT:

The image this Newton polygon under the symmetry ‘(x,y) mapsto (degree-x, y)

EXAMPLES:

sage: from sage.geometry.newton_polygon import NewtonPolygon
sage: NP = NewtonPolygon([ (0,0), (1,1), (2,5) ])
sage: NP2 = NP.reverse(); NP2
Finite Newton polygon with 3 vertices: (0, 5), (1, 1), (2, 0)


We check that the slopes of the symmetric Newton polygon are the opposites of the slopes of the original Newton polygon:

sage: NP.slopes()
[1, 4]
sage: NP2.slopes()
[-4, -1]

slopes(repetition=True)

Returns the slopes of this Newton polygon

INPUT:

• repetition – a boolean (default: True)

OUTPUT:

The consecutive slopes (not including the last slope if the polygon is infinity) of this Newton polygon.

If repetition is True, each slope is repeated a number of times equal to its length. Otherwise, it appears only one time.

EXAMPLES:

sage: from sage.geometry.newton_polygon import NewtonPolygon
sage: NP = NewtonPolygon([ (0,0), (1,1), (3,6) ]); NP
Finite Newton polygon with 3 vertices: (0, 0), (1, 1), (3, 6)

sage: NP.slopes()
[1, 5/2, 5/2]

sage: NP.slopes(repetition=False)
[1, 5/2]

vertices(copy=True)

Returns the list of vertices of this Newton polygon

INPUT:

• copy – a boolean (default: True)

OUTPUT:

The list of vertices of this Newton polygon (or a copy of it if copy is set to True)

EXAMPLES:

sage: from sage.geometry.newton_polygon import NewtonPolygon
sage: NP = NewtonPolygon([ (0,0), (1,1), (2,5) ]); NP
Finite Newton polygon with 3 vertices: (0, 0), (1, 1), (2, 5)

sage: v = NP.vertices(); v
[(0, 0), (1, 1), (2, 5)]

class sage.geometry.newton_polygon.ParentNewtonPolygon

Construct a Newton polygon.

INPUT:

• arg – a list/tuple/iterable of vertices or of slopes. Currently, slopes must be rational numbers.
• sort_slopes – boolean (default: True). Specifying whether slopes must be first sorted
• last_slope – rational or infinity (default: Infinity). The last slope of the Newton polygon

OUTPUT:

The corresponding Newton polygon.

Note

By convention, a Newton polygon always contains the point at infinity $$(0, \infty)$$. These polygons are attached to polynomials or series over discrete valuation rings (e.g. padics).

EXAMPLES:

We specify here a Newton polygon by its vertices:

sage: from sage.geometry.newton_polygon import NewtonPolygon
sage: NewtonPolygon([ (0,0), (1,1), (3,5) ])
Finite Newton polygon with 3 vertices: (0, 0), (1, 1), (3, 5)


We note that the convex hull of the vertices is automatically computed:

sage: NewtonPolygon([ (0,0), (1,1), (2,8), (3,5) ])
Finite Newton polygon with 3 vertices: (0, 0), (1, 1), (3, 5)


Note that the value +Infinity is allowed as the second coordinate of a vertex:

sage: NewtonPolygon([ (0,0), (1,Infinity), (2,8), (3,5) ])
Finite Newton polygon with 2 vertices: (0, 0), (3, 5)


If last_slope is set, the returned Newton polygon is infinite and ends with an infinite line having the specified slope:

sage: NewtonPolygon([ (0,0), (1,1), (2,8), (3,5) ], last_slope=3)
Infinite Newton polygon with 3 vertices: (0, 0), (1, 1), (3, 5) ending by an infinite line of slope 3


Specifying a last slope may discard some vertices:

sage: NewtonPolygon([ (0,0), (1,1), (2,8), (3,5) ], last_slope=3/2)
Infinite Newton polygon with 2 vertices: (0, 0), (1, 1) ending by an infinite line of slope 3/2


Next, we define a Newton polygon by its slopes:

sage: NP = NewtonPolygon([0, 1/2, 1/2, 2/3, 2/3, 2/3, 1, 1])
sage: NP
Finite Newton polygon with 5 vertices: (0, 0), (1, 0), (3, 1), (6, 3), (8, 5)
sage: NP.slopes()
[0, 1/2, 1/2, 2/3, 2/3, 2/3, 1, 1]


By default, slopes are automatically sorted:

sage: NP2 = NewtonPolygon([0, 1, 1/2, 2/3, 1/2, 2/3, 1, 2/3])
sage: NP2
Finite Newton polygon with 5 vertices: (0, 0), (1, 0), (3, 1), (6, 3), (8, 5)
sage: NP == NP2
True


except if the contrary is explicitly mentioned:

sage: NewtonPolygon([0, 1, 1/2, 2/3, 1/2, 2/3, 1, 2/3], sort_slopes=False)
Finite Newton polygon with 4 vertices: (0, 0), (1, 0), (6, 10/3), (8, 5)


Slopes greater that or equal last_slope (if specified) are discarded:

sage: NP = NewtonPolygon([0, 1/2, 1/2, 2/3, 2/3, 2/3, 1, 1], last_slope=2/3)
sage: NP
Infinite Newton polygon with 3 vertices: (0, 0), (1, 0), (3, 1) ending by an infinite line of slope 2/3
sage: NP.slopes()
[0, 1/2, 1/2]


Be careful, do not confuse Newton polygons provided by this class with Newton polytopes. Compare:

sage: NP = NewtonPolygon([ (0,0), (1,45), (3,6) ]); NP
Finite Newton polygon with 2 vertices: (0, 0), (3, 6)

sage: x, y = polygen(QQ,'x, y')
sage: p = 1 + x*y**45 + x**3*y**6
sage: p.newton_polytope()
A 2-dimensional polyhedron in ZZ^2 defined as the convex hull of 3 vertices
sage: p.newton_polytope().vertices()
(A vertex at (0, 0), A vertex at (1, 45), A vertex at (3, 6))

Element

alias of NewtonPolygon_element`