-
-
Notifications
You must be signed in to change notification settings - Fork 702
Basic functionalities for weighted projective {curves, points, spaces} #41170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
user202729
wants to merge
17
commits into
sagemath:develop
Choose a base branch
from
user202729:weighted-projective
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bb4b129
add basic weighted projective space functionality
grhkm21 8aae3d4
remove finished TODO
grhkm21 ebe3a94
clean up implementation of weighted (plane) curves and other docs
grhkm21 00dce0a
remove useless .curve method
grhkm21 6330043
implement converting wp curve to proj curve
grhkm21 2db7a8d
Merge remote-tracking branch 'upstream/develop' into HEAD
user202729 657d42f
Delete a __init__.py file
user202729 8c4f225
Fix lint
user202729 b44aef4
Update .rst files
user202729 04585f0
Add some type annotations
user202729 4da03f1
Use super() to avoid confusion
user202729 33bbb09
Fix a minor typo
user202729 0b2d4b6
Apply suggestions from code review
user202729 428671f
Apply suggestions
user202729 f22d08d
Apply suggested change
user202729 803a2fe
Apply suggestions
user202729 2306b38
Apply suggested changes
user202729 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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
38
src/sage/schemes/weighted_projective/weighted_projective_homset.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| """ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.