Skip to content

Commit e23886d

Browse files
author
Release Manager
committed
gh-41170: Basic functionalities for weighted projective {curves, points, spaces} Picking up #40070 as far as I can tell the fedora:42 failure is irrelevant. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [ ] The title is concise and informative. - [ ] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #41170 Reported by: user202729 Reviewer(s): user202729, Vincent Macri
2 parents b2d7ae3 + 2306b38 commit e23886d

File tree

11 files changed

+913
-0
lines changed

11 files changed

+913
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ src/sage/schemes/hyperelliptic_curves/__init__.py
243243
src/sage/schemes/berkovich/__init__.py
244244
src/sage/schemes/generic/__init__.py
245245
src/sage/schemes/projective/__init__.py
246+
src/sage/schemes/weighted_projective/__init__.py
246247
src/sage/schemes/__init__.py
247248
src/sage/schemes/affine/__init__.py
248249
src/sage/modular/hecke/__init__.py

src/doc/en/reference/curves/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Curves
1515
sage/schemes/curves/affine_curve
1616
sage/schemes/curves/plane_curve_arrangement
1717
sage/schemes/curves/projective_curve
18+
sage/schemes/curves/weighted_projective_curve
1819
sage/schemes/curves/point
1920
sage/schemes/curves/closed_point
2021
sage/schemes/curves/zariski_vankampen

src/doc/en/reference/schemes/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ Projective Schemes
4747
sage/schemes/projective/projective_homset
4848
sage/schemes/projective/proj_bdd_height
4949

50+
Weighted Projective Schemes
51+
---------------------------
52+
53+
.. toctree::
54+
:maxdepth: 1
55+
56+
sage/schemes/weighted_projective/weighted_projective_space
57+
sage/schemes/weighted_projective/weighted_projective_point
58+
sage/schemes/weighted_projective/weighted_projective_homset
59+
5060
Products of Projective Spaces
5161
-----------------------------
5262

src/sage/schemes/all.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
from sage.schemes.product_projective.all import *
4444

45+
from sage.schemes.weighted_projective.all import *
46+
4547
from sage.schemes.cyclic_covers.all import *
4648

4749
from sage.schemes.berkovich.all import *

src/sage/schemes/curves/constructor.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
Projective Plane Curve over Finite Field of size 5
1919
defined by -x^9 + y^2*z^7 - x*z^8
2020
21+
Here, we construct a hyperelliptic curve manually::
22+
23+
sage: WP.<x,y,z> = WeightedProjectiveSpace([1, 3, 1], GF(103))
24+
sage: Curve(y^2 - (x^5*z + 17*x^2*z^4 + 92*z^6), WP)
25+
Weighted Projective Curve over Finite Field of size 103 defined by y^2 - x^5*z - 17*x^2*z^4 + 11*z^6
26+
2127
AUTHORS:
2228
2329
- William Stein (2005-11-13)
@@ -49,6 +55,7 @@
4955
from sage.schemes.generic.algebraic_scheme import AlgebraicScheme
5056
from sage.schemes.affine.affine_space import AffineSpace, AffineSpace_generic
5157
from sage.schemes.projective.projective_space import ProjectiveSpace, ProjectiveSpace_ring
58+
from sage.schemes.weighted_projective.weighted_projective_space import WeightedProjectiveSpace_ring
5259
from sage.schemes.plane_conics.constructor import Conic
5360

5461
from .projective_curve import (ProjectiveCurve,
@@ -71,6 +78,8 @@
7178
IntegralAffinePlaneCurve,
7279
IntegralAffinePlaneCurve_finite_field)
7380

81+
from .weighted_projective_curve import WeightedProjectiveCurve
82+
7483

7584
def _is_irreducible_and_reduced(F) -> bool:
7685
"""
@@ -376,5 +385,12 @@ def Curve(F, A=None):
376385
return ProjectivePlaneCurve_field(A, F)
377386
return ProjectivePlaneCurve(A, F)
378387

388+
elif isinstance(A, WeightedProjectiveSpace_ring):
389+
# currently, we only support curves in a weighted projective plane
390+
if n != 2:
391+
raise NotImplementedError("ambient space has to be a weighted projective plane")
392+
# currently, we do not perform checks on weighted projective curves
393+
return WeightedProjectiveCurve(A, F)
394+
379395
else:
380396
raise TypeError('ambient space neither affine nor projective')
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# sage.doctest: needs sage.libs.singular
2+
r"""
3+
Weighted projective curves
4+
5+
Weighted projective curves in Sage are curves in a weighted projective space or
6+
a weighted projective plane.
7+
8+
EXAMPLES:
9+
10+
For now, only curves in weighted projective plane is supported::
11+
12+
sage: WP.<x, y, z> = WeightedProjectiveSpace([1, 3, 1], QQ)
13+
sage: C1 = WP.curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6); C1
14+
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
15+
sage: C2 = Curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6, WP); C2
16+
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
17+
sage: C1 == C2
18+
True
19+
20+
AUTHORS:
21+
22+
- Gareth Ma (2025)
23+
"""
24+
25+
# ****************************************************************************
26+
# Copyright (C) 2005 William Stein <wstein@gmail.com>
27+
# Copyright (C) 2025 Gareth Ma <grhkm21@gmail.com>
28+
#
29+
# This program is free software: you can redistribute it and/or modify
30+
# it under the terms of the GNU General Public License as published by
31+
# the Free Software Foundation, either version 2 of the License, or
32+
# (at your option) any later version.
33+
# https://www.gnu.org/licenses/
34+
# ****************************************************************************
35+
36+
from sage.schemes.curves.curve import Curve_generic
37+
from sage.schemes.weighted_projective.weighted_projective_space import WeightedProjectiveSpace_ring
38+
39+
40+
class WeightedProjectiveCurve(Curve_generic):
41+
"""
42+
Curves in weighted projective spaces.
43+
44+
EXAMPLES:
45+
46+
We construct a hyperelliptic curve manually::
47+
48+
sage: WP.<x, y, z> = WeightedProjectiveSpace([1, 3, 1], QQ)
49+
sage: C = Curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6, WP); C
50+
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
51+
"""
52+
def __init__(self, A, X, *kwargs):
53+
if not isinstance(A, WeightedProjectiveSpace_ring):
54+
raise TypeError(f"A(={A}) is not a weighted projective space")
55+
super().__init__(A, X, *kwargs)
56+
57+
def _repr_type(self) -> str:
58+
r"""
59+
Return a string representation of the type of this curve.
60+
61+
EXAMPLES::
62+
63+
sage: WP.<x,y,z> = WeightedProjectiveSpace([1, 3, 1], QQ)
64+
sage: C = Curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6, WP); C
65+
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
66+
sage: C._repr_type()
67+
'Weighted Projective'
68+
"""
69+
return "Weighted Projective"
70+
71+
def projective_curve(self):
72+
r"""
73+
Return this weighted projective curve as a projective curve.
74+
75+
A weighted homogeneous polynomial `f(x_1, \ldots, x_n)`, where `x_i` has
76+
weight `w_i`, can be viewed as an unweighted homogeneous polynomial
77+
`f(y_1^{w_1}, \ldots, y_n^{w_n})`. This correspondence extends to
78+
varieties.
79+
80+
.. TODO:
81+
82+
Implement homsets for weighted projective spaces and implement this
83+
as a ``projective_embedding`` method instead.
84+
85+
EXAMPLES::
86+
87+
sage: WP = WeightedProjectiveSpace([1, 3, 1], QQ, "x, y, z")
88+
sage: x, y, z = WP.gens()
89+
sage: C = WP.curve(y^2 - (x^5*z + 3*x^2*z^4 - 2*x*z^5 + 4*z^6)); C
90+
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 + 2*x*z^5 - 4*z^6
91+
sage: C.projective_curve()
92+
Projective Plane Curve over Rational Field defined by y^6 - x^5*z - 3*x^2*z^4 + 2*x*z^5 - 4*z^6
93+
"""
94+
from sage.schemes.projective.projective_space import ProjectiveSpace
95+
96+
WP = self.ambient_space()
97+
PP = ProjectiveSpace(WP.dimension_relative(), WP.base_ring(), WP.variable_names())
98+
PP_ring = PP.coordinate_ring()
99+
subs_dict = {name: var**weight for (name, var), weight in
100+
zip(WP.gens_dict().items(), WP.weights())}
101+
102+
wp_polys = self.defining_polynomials()
103+
pp_polys = [PP_ring(poly.subs(**subs_dict)) for poly in wp_polys]
104+
105+
return PP.curve(pp_polys)

src/sage/schemes/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ install_subdir('plane_quartics', install_dir: sage_install_dir / 'schemes')
1818
install_subdir('product_projective', install_dir: sage_install_dir / 'schemes')
1919
install_subdir('projective', install_dir: sage_install_dir / 'schemes')
2020
install_subdir('riemann_surfaces', install_dir: sage_install_dir / 'schemes')
21+
install_subdir('weighted_projective', install_dir: sage_install_dir / 'schemes')
2122
subdir('toric')
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
"""nodoctest
2+
all.py -- export of projective schemes to Sage
3+
"""
4+
5+
# ****************************************************************************
6+
# Copyright (C) 2005 William Stein <wstein@gmail.com>
7+
# Copyright (C) 2025 Gareth Ma <grhkm21@gmail.com>
8+
#
9+
# This program is free software: you can redistribute it and/or modify
10+
# it under the terms of the GNU General Public License as published by
11+
# the Free Software Foundation, either version 2 of the License, or
12+
# (at your option) any later version.
13+
# https://www.gnu.org/licenses/
14+
# ****************************************************************************
15+
16+
from sage.schemes.weighted_projective.weighted_projective_space import WeightedProjectiveSpace
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
"""
2+
Hom-sets of weighted projective schemes
3+
4+
AUTHORS:
5+
6+
- Gareth Ma (2024): initial version, based on unweighted version.
7+
"""
8+
9+
# *****************************************************************************
10+
# Copyright (C) 2006 William Stein <wstein@gmail.com>
11+
# Copyright (C) 2011 Volker Braun <vbraun.name@gmail.com>
12+
# Copyright (C) 2024 Gareth Ma <grhkm21@gmail.com>
13+
#
14+
# Distributed under the terms of the GNU General Public License (GPL)
15+
# as published by the Free Software Foundation; either version 2 of
16+
# the License, or (at your option) any later version.
17+
# http://www.gnu.org/licenses/
18+
# *****************************************************************************
19+
20+
from sage.schemes.generic.homset import SchemeHomset_points
21+
22+
23+
class SchemeHomset_points_weighted_projective_ring(SchemeHomset_points):
24+
"""
25+
Set of rational points of a weighted projective variety over a ring.
26+
27+
INPUT:
28+
29+
See :class:`SchemeHomset_points`.
30+
31+
EXAMPLES::
32+
33+
sage: W = WeightedProjectiveSpace([3, 4, 5], QQ)
34+
sage: W.point_homset()
35+
Set of rational points of Weighted Projective Space of dimension 2 with weights (3, 4, 5) over Rational Field
36+
sage: W.an_element().parent() is W.point_homset()
37+
True
38+
"""

0 commit comments

Comments
 (0)