|
| 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) |
0 commit comments