Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ src/sage/schemes/hyperelliptic_curves/__init__.py
src/sage/schemes/berkovich/__init__.py
src/sage/schemes/generic/__init__.py
src/sage/schemes/projective/__init__.py
src/sage/schemes/weighted_projective/__init__.py
src/sage/schemes/__init__.py
src/sage/schemes/affine/__init__.py
src/sage/modular/hecke/__init__.py
Expand Down
1 change: 1 addition & 0 deletions src/doc/en/reference/curves/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Curves
sage/schemes/curves/affine_curve
sage/schemes/curves/plane_curve_arrangement
sage/schemes/curves/projective_curve
sage/schemes/curves/weighted_projective_curve
sage/schemes/curves/point
sage/schemes/curves/closed_point
sage/schemes/curves/zariski_vankampen
Expand Down
10 changes: 10 additions & 0 deletions src/doc/en/reference/schemes/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ Projective Schemes
sage/schemes/projective/projective_homset
sage/schemes/projective/proj_bdd_height

Weighted Projective Schemes
---------------------------

.. toctree::
:maxdepth: 1

sage/schemes/weighted_projective/weighted_projective_space
sage/schemes/weighted_projective/weighted_projective_point
sage/schemes/weighted_projective/weighted_projective_homset

Products of Projective Spaces
-----------------------------

Expand Down
2 changes: 2 additions & 0 deletions src/sage/schemes/all.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@

from sage.schemes.product_projective.all import *

from sage.schemes.weighted_projective.all import *

from sage.schemes.cyclic_covers.all import *

from sage.schemes.berkovich.all import *
16 changes: 16 additions & 0 deletions src/sage/schemes/curves/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
Projective Plane Curve over Finite Field of size 5
defined by -x^9 + y^2*z^7 - x*z^8

Here, we construct a hyperelliptic curve manually::

sage: WP.<x,y,z> = WeightedProjectiveSpace([1, 3, 1], GF(103))
sage: Curve(y^2 - (x^5*z + 17*x^2*z^4 + 92*z^6), WP)
Weighted Projective Curve over Finite Field of size 103 defined by y^2 - x^5*z - 17*x^2*z^4 + 11*z^6

AUTHORS:

- William Stein (2005-11-13)
Expand Down Expand Up @@ -49,6 +55,7 @@
from sage.schemes.generic.algebraic_scheme import AlgebraicScheme
from sage.schemes.affine.affine_space import AffineSpace, AffineSpace_generic
from sage.schemes.projective.projective_space import ProjectiveSpace, ProjectiveSpace_ring
from sage.schemes.weighted_projective.weighted_projective_space import WeightedProjectiveSpace_ring
from sage.schemes.plane_conics.constructor import Conic

from .projective_curve import (ProjectiveCurve,
Expand All @@ -71,6 +78,8 @@
IntegralAffinePlaneCurve,
IntegralAffinePlaneCurve_finite_field)

from .weighted_projective_curve import WeightedProjectiveCurve


def _is_irreducible_and_reduced(F) -> bool:
"""
Expand Down Expand Up @@ -376,5 +385,12 @@ def Curve(F, A=None):
return ProjectivePlaneCurve_field(A, F)
return ProjectivePlaneCurve(A, F)

elif isinstance(A, WeightedProjectiveSpace_ring):
# currently, we only support curves in a weighted projective plane
if n != 2:
raise NotImplementedError("ambient space has to be a weighted projective plane")
# currently, we do not perform checks on weighted projective curves
return WeightedProjectiveCurve(A, F)

else:
raise TypeError('ambient space neither affine nor projective')
105 changes: 105 additions & 0 deletions src/sage/schemes/curves/weighted_projective_curve.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# sage.doctest: needs sage.libs.singular
r"""
Weighted projective curves

Weighted projective curves in Sage are curves in a weighted projective space or
a weighted projective plane.

EXAMPLES:

For now, only curves in weighted projective plane is supported::

sage: WP.<x, y, z> = WeightedProjectiveSpace([1, 3, 1], QQ)
sage: C1 = WP.curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6); C1
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
sage: C2 = Curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6, WP); C2
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
sage: C1 == C2
True

AUTHORS:

- Gareth Ma (2025)
"""

# ****************************************************************************
# Copyright (C) 2005 William Stein <[email protected]>
# Copyright (C) 2025 Gareth Ma <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.schemes.curves.curve import Curve_generic
from sage.schemes.weighted_projective.weighted_projective_space import WeightedProjectiveSpace_ring


class WeightedProjectiveCurve(Curve_generic):
"""
Curves in weighted projective spaces.

EXAMPLES:

We construct a hyperelliptic curve manually::

sage: WP.<x, y, z> = WeightedProjectiveSpace([1, 3, 1], QQ)
sage: C = Curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6, WP); C
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
"""
def __init__(self, A, X, *kwargs):
if not isinstance(A, WeightedProjectiveSpace_ring):
raise TypeError(f"A(={A}) is not a weighted projective space")
super().__init__(A, X, *kwargs)

def _repr_type(self) -> str:
r"""
Return a string representation of the type of this curve.

EXAMPLES::

sage: WP.<x,y,z> = WeightedProjectiveSpace([1, 3, 1], QQ)
sage: C = Curve(y^2 - x^5 * z - 3 * x^2 * z^4 - 2 * z^6, WP); C
Weighted Projective Curve over Rational Field defined by y^2 - x^5*z - 3*x^2*z^4 - 2*z^6
sage: C._repr_type()
'Weighted Projective'
"""
return "Weighted Projective"

def projective_curve(self):
r"""
Return this weighted projective curve as a projective curve.

A weighted homogeneous polynomial `f(x_1, \ldots, x_n)`, where `x_i` has
weight `w_i`, can be viewed as an unweighted homogeneous polynomial
`f(y_1^{w_1}, \ldots, y_n^{w_n})`. This correspondence extends to
varieties.

.. TODO:

Implement homsets for weighted projective spaces and implement this
as a ``projective_embedding`` method instead.

EXAMPLES::

sage: WP = WeightedProjectiveSpace([1, 3, 1], QQ, "x, y, z")
sage: x, y, z = WP.gens()
sage: C = WP.curve(y^2 - (x^5*z + 3*x^2*z^4 - 2*x*z^5 + 4*z^6)); C
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
sage: C.projective_curve()
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
"""
from sage.schemes.projective.projective_space import ProjectiveSpace

WP = self.ambient_space()
PP = ProjectiveSpace(WP.dimension_relative(), WP.base_ring(), WP.variable_names())
PP_ring = PP.coordinate_ring()
subs_dict = {name: var**weight for (name, var), weight in
zip(WP.gens_dict().items(), WP.weights())}

wp_polys = self.defining_polynomials()
pp_polys = [PP_ring(poly.subs(**subs_dict)) for poly in wp_polys]

return PP.curve(pp_polys)
1 change: 1 addition & 0 deletions src/sage/schemes/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ install_subdir('plane_quartics', install_dir: sage_install_dir / 'schemes')
install_subdir('product_projective', install_dir: sage_install_dir / 'schemes')
install_subdir('projective', install_dir: sage_install_dir / 'schemes')
install_subdir('riemann_surfaces', install_dir: sage_install_dir / 'schemes')
install_subdir('weighted_projective', install_dir: sage_install_dir / 'schemes')
subdir('toric')
16 changes: 16 additions & 0 deletions src/sage/schemes/weighted_projective/all.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""nodoctest
all.py -- export of projective schemes to Sage
"""

# ****************************************************************************
# Copyright (C) 2005 William Stein <[email protected]>
# Copyright (C) 2025 Gareth Ma <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.schemes.weighted_projective.weighted_projective_space import WeightedProjectiveSpace
38 changes: 38 additions & 0 deletions src/sage/schemes/weighted_projective/weighted_projective_homset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
"""
Hom-sets of weighted projective schemes

AUTHORS:

- Gareth Ma (2024): initial version, based on unweighted version.
"""

# *****************************************************************************
# Copyright (C) 2006 William Stein <[email protected]>
# Copyright (C) 2011 Volker Braun <[email protected]>
# Copyright (C) 2024 Gareth Ma <[email protected]>
#
# Distributed under the terms of the GNU General Public License (GPL)
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
# http://www.gnu.org/licenses/
# *****************************************************************************

from sage.schemes.generic.homset import SchemeHomset_points


class SchemeHomset_points_weighted_projective_ring(SchemeHomset_points):
"""
Set of rational points of a weighted projective variety over a ring.

INPUT:

See :class:`SchemeHomset_points`.

EXAMPLES::

sage: W = WeightedProjectiveSpace([3, 4, 5], QQ)
sage: W.point_homset()
Set of rational points of Weighted Projective Space of dimension 2 with weights (3, 4, 5) over Rational Field
sage: W.an_element().parent() is W.point_homset()
True
"""
Loading
Loading