From ed2490b39b283aecbae26caa7fb7afd90c9d0f39 Mon Sep 17 00:00:00 2001 From: Dang Date: Wed, 16 Aug 2023 11:52:13 -0700 Subject: [PATCH 1/4] copy/pasted code from 34559 and added missing white space around --- .../projective/projective_subscheme.py | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index e6caf19ba74..6fbe0ce4a2b 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1404,3 +1404,81 @@ def Chow_form(self): rel2 = rel + [CF] assert all(f in rel2 for f in CH.gens()), "did not find a principal generator" return alp(CF) + + def global_height(self, prec=None): + """ + Return the (projective) global height of the subscheme. + INPUT: + - ``prec`` -- desired floating point precision (default: + default RealField precision). + OUTPUT: + - a real number. + EXAMPLES:: + sage: R. = QQ[] + sage: NF. = NumberField(x^2 - 5) + sage: P. = ProjectiveSpace(NF, 2) + sage: X = P.subscheme([x^2 + y*z, 2*y*z, 3*x*y]) + sage: X.global_height() + 0.000000000000000 + + :: + + sage: P. = ProjectiveSpace(QQ, 2) + sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) + sage: X.global_height() # long time + 4.61512051684126 + """ + return self.Chow_form().global_height(prec) + + def local_height(self, v, prec=None): + """ + Return the (projective) local height of the subscheme. + INPUT: + - ``v`` -- a prime or prime ideal of the base ring. + - ``prec`` -- desired floating point precision (default: + default RealField precision). + OUTPUT: + - a real number. + EXAMPLES:: + sage: R. = QQ[] + sage: NF. = NumberField(x^2 - 5) + sage: I = NF.ideal(3) + sage: P. = ProjectiveSpace(NF, 2) + sage: X = P.subscheme([3*x*y - 5*x*z, y^2]) + sage: X.local_height(I) + 0.000000000000000 + + :: + + sage: P. = ProjectiveSpace(QQ, 2) + sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) + sage: X.local_height(2) + 0.000000000000000 + """ + return self.Chow_form().local_height(v, prec) + + def local_height_arch(self, i, prec=None): + """ + Return the local height at the ``i``-th infinite place of the subscheme. + INPUT: + - ``i`` -- an integer. + - ``prec`` -- desired floating point precision (default: + default RealField precision). + OUTPUT: + - a real number. + EXAMPLES:: + sage: R. = QQ[] + sage: NF. = NumberField(x^2 - 5) + sage: P. = ProjectiveSpace(NF, 2) + sage: X = P.subscheme([x^2 + y*z, 3*x*y]) + sage: X.local_height_arch(1) + 0.0000000000000000000000000000000 + + :: + + sage: P. = ProjectiveSpace(QQ, 2) + sage: X = P.subscheme([z^2 - 101*y^2 - 3*x*z]) + sage: X.local_height_arch(1) + 4.61512051684126 + """ + return self.Chow_form().local_height_arch(i, prec) \ No newline at end of file From 43c616c435e3778a9096186b2dd78cdd470c7f4c Mon Sep 17 00:00:00 2001 From: Dang Date: Sun, 20 Aug 2023 13:35:21 -0700 Subject: [PATCH 2/4] blank lines added in docs --- src/sage/schemes/projective/projective_subscheme.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 6fbe0ce4a2b..ac44aa61094 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1408,12 +1408,16 @@ def Chow_form(self): def global_height(self, prec=None): """ Return the (projective) global height of the subscheme. + INPUT: - ``prec`` -- desired floating point precision (default: default RealField precision). + OUTPUT: - a real number. + EXAMPLES:: + sage: R. = QQ[] sage: NF. = NumberField(x^2 - 5) sage: P. = ProjectiveSpace(NF, 2) @@ -1433,13 +1437,17 @@ def global_height(self, prec=None): def local_height(self, v, prec=None): """ Return the (projective) local height of the subscheme. + INPUT: - ``v`` -- a prime or prime ideal of the base ring. - ``prec`` -- desired floating point precision (default: default RealField precision). + OUTPUT: - a real number. + EXAMPLES:: + sage: R. = QQ[] sage: NF. = NumberField(x^2 - 5) sage: I = NF.ideal(3) @@ -1460,13 +1468,17 @@ def local_height(self, v, prec=None): def local_height_arch(self, i, prec=None): """ Return the local height at the ``i``-th infinite place of the subscheme. + INPUT: - ``i`` -- an integer. - ``prec`` -- desired floating point precision (default: default RealField precision). + OUTPUT: - a real number. + EXAMPLES:: + sage: R. = QQ[] sage: NF. = NumberField(x^2 - 5) sage: P. = ProjectiveSpace(NF, 2) From 6d8098147ecbcd91a9d01176a49127248c567f4f Mon Sep 17 00:00:00 2001 From: Dang Date: Tue, 22 Aug 2023 11:39:21 -0700 Subject: [PATCH 3/4] added blank lines for inputs and outputs in documentation --- src/sage/schemes/projective/projective_subscheme.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index ac44aa61094..5e651f1999d 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1410,10 +1410,12 @@ def global_height(self, prec=None): Return the (projective) global height of the subscheme. INPUT: + - ``prec`` -- desired floating point precision (default: default RealField precision). OUTPUT: + - a real number. EXAMPLES:: @@ -1439,11 +1441,14 @@ def local_height(self, v, prec=None): Return the (projective) local height of the subscheme. INPUT: + - ``v`` -- a prime or prime ideal of the base ring. + - ``prec`` -- desired floating point precision (default: default RealField precision). OUTPUT: + - a real number. EXAMPLES:: @@ -1470,11 +1475,14 @@ def local_height_arch(self, i, prec=None): Return the local height at the ``i``-th infinite place of the subscheme. INPUT: + - ``i`` -- an integer. + - ``prec`` -- desired floating point precision (default: default RealField precision). OUTPUT: + - a real number. EXAMPLES:: From bf3b9a1db8aa3d22eefafcbd4abd3b57759aa973 Mon Sep 17 00:00:00 2001 From: Dang Date: Wed, 23 Aug 2023 11:51:26 -0700 Subject: [PATCH 4/4] changed formatting of RealField --- src/sage/schemes/projective/projective_subscheme.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/schemes/projective/projective_subscheme.py b/src/sage/schemes/projective/projective_subscheme.py index 5e651f1999d..ee6063ba952 100644 --- a/src/sage/schemes/projective/projective_subscheme.py +++ b/src/sage/schemes/projective/projective_subscheme.py @@ -1412,7 +1412,7 @@ def global_height(self, prec=None): INPUT: - ``prec`` -- desired floating point precision (default: - default RealField precision). + default ``RealField`` precision). OUTPUT: @@ -1445,7 +1445,7 @@ def local_height(self, v, prec=None): - ``v`` -- a prime or prime ideal of the base ring. - ``prec`` -- desired floating point precision (default: - default RealField precision). + default ``RealField`` precision). OUTPUT: @@ -1479,7 +1479,7 @@ def local_height_arch(self, i, prec=None): - ``i`` -- an integer. - ``prec`` -- desired floating point precision (default: - default RealField precision). + default ``RealField`` precision). OUTPUT: