Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'zero_height' into height_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
guojing0 committed Jul 13, 2022
2 parents 2aff55c + b8a2b44 commit 1ceb3d6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/sage/rings/polynomial/multi_polynomial_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from sage.rings.fraction_field import FractionField
from sage.rings.number_field.order import is_NumberFieldOrder
from sage.categories.number_fields import NumberFields

from sage.rings.real_mpfr import RealField

def is_MPolynomial(x):
return isinstance(x, MPolynomial)
Expand Down Expand Up @@ -1023,14 +1023,14 @@ def global_height(self, prec=None):
sage: R.<x,y> = PolynomialRing(QQ, implementation='generic')
sage: f = 0*x*y
sage: f.global_height()
0
0.000000000000000
"""
if self.is_zero():
return 0

if prec is None:
prec = 53

if self.is_zero():
return RealField(prec).zero()

from sage.rings.qqbar import QQbar, number_field_elements_from_algebraics

K = self.base_ring()
Expand Down
9 changes: 5 additions & 4 deletions src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ from sage.structure.factorization import Factorization
from sage.structure.sequence import Sequence

from sage.rings.fraction_field import FractionField
from sage.rings.all import RealField

from sage.interfaces.singular import singular as singular_default, is_SingularElement, SingularElement
from sage.interfaces.macaulay2 import macaulay2 as macaulay2_default, is_Macaulay2Element
Expand Down Expand Up @@ -5553,14 +5554,14 @@ cdef class MPolynomial_libsingular(MPolynomial):
sage: R.<x,y> = QQ[]
sage: f = 0*x*y
sage: f.global_height()
0
0.000000000000000
"""
if self.is_zero():
return 0

if prec is None:
prec = 53

if self.is_zero():
return RealField(prec).zero()

K = self.base_ring()
if K in NumberFields() or is_NumberFieldOrder(K):
f = self
Expand Down
8 changes: 4 additions & 4 deletions src/sage/rings/polynomial/polynomial_element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5807,14 +5807,14 @@ cdef class Polynomial(CommutativeAlgebraElement):
sage: R.<x> = QQ[]
sage: f = 0*x
sage: f.global_height()
0
0.000000000000000
"""
if self.is_zero():
return 0

if prec is None:
prec = 53

if self.is_zero():
return RealField(prec).zero()

from sage.rings.qqbar import QQbar, number_field_elements_from_algebraics

K = self.base_ring()
Expand Down

0 comments on commit 1ceb3d6

Please sign in to comment.