-
-
Notifications
You must be signed in to change notification settings - Fork 701
Basic functionalities for weighted projective {curves, points, spaces} #40070
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| # 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 | ||
| """ | ||
|
|
||
| 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): | ||
| 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 @@ | ||
| # Here so that cython creates the correct module name | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this file isn't supposed to be committed into git, add it to |
||
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,23 @@ | ||
| """nodoctest | ||
| all.py -- export of projective schemes to Sage | ||
| """ | ||
|
|
||
| # ***************************************************************************** | ||
| # | ||
| # Sage: Open Source Mathematical Software | ||
| # | ||
| # Copyright (C) 2005 William Stein <[email protected]> | ||
| # | ||
| # Distributed under the terms of the GNU General Public License (GPL) | ||
| # | ||
| # This code is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| # General Public License for more details. | ||
| # | ||
| # The full text of the GPL is available at: | ||
| # | ||
| # 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) 2024 Gareth Ma <[email protected]> | ||
| # Copyright (C) 2011 Volker Braun <[email protected]> | ||
| # Copyright (C) 2006 William Stein <[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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any checks that a user would reasonably expect should be performed? If so, document that these checks aren't done (and ideally why they aren't) in the docstring.