Path: blob/master/src/sage/schemes/hyperelliptic_curves/invariants.py
8821 views
r"""1Compute invariants of quintics and sextics via ``Ueberschiebung''.23REFERENCES::45.. [M] Mestre, Jean-Francois. Construction de courbes de genre $2$ a6partir de leurs modules. (French) [Constructing genus-$2$ curves from7their moduli] Effective methods in algebraic geometry (Castiglioncello,81990), 313--334, Progr. Math., 94, Birkhauser Boston, Boston, MA, 1991.910.. [I] Igusa, Jun-ichi. Arithmetic variety of moduli for genus two.11Ann. of Math. (2) 72 1960 612--649.1213TODO::1415* Implement invariants in small positive characteristic.1617* Cardona-Quer and additional invariants for classifying automorphism groups.1819AUTHOR::2021* Nick Alexander22"""2324from sage.rings.all import ZZ25from sage.rings.all import PolynomialRing2627def diffxy(f, x, xtimes, y, ytimes):28r"""29Differentiate a polynomial ``f``, ``xtimes`` with respect to ``x``, and30```ytimes`` with respect to ``y``.3132EXAMPLES::33sage: R.<u, v> = QQ[]34sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3, u, 0, v, 0)35u^2*v^336sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3, u, 2, v, 1)376*v^238sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3, u, 2, v, 2)3912*v40sage: sage.schemes.hyperelliptic_curves.invariants.diffxy(u^2*v^3 + u^4*v^4, u, 2, v, 2)41144*u^2*v^2 + 12*v42"""43h = f44for i in range(xtimes): h = h.derivative(x)45for j in range(ytimes): h = h.derivative(y)46return h4748def differential_operator(f, g, k):49r"""50Return the differential operator `(f g)_k` symbolically in the polynomial ring in ``dfdx, dfdy, dgdx, dgdy``.5152This is defined by Mestre on p 315 [M]_:53`(f g)_k = \frac{(m - k)! (n - k)!}{m! n!} \left(54\frac{\del f}{\del x} \frac{\del g}{\del y} -55\frac{\del f}{\del y} \frac{\del g}{\del x} \right)^k ` .5657EXAMPLES::5859sage: from sage.schemes.hyperelliptic_curves.invariants import differential_operator60sage: R.<x, y> = QQ[]61sage: differential_operator(x, y, 0)62163sage: differential_operator(x, y, 1)64-dfdy*dgdx + dfdx*dgdy65sage: differential_operator(x*y, x*y, 2)661/4*dfdy^2*dgdx^2 - 1/2*dfdx*dfdy*dgdx*dgdy + 1/4*dfdx^2*dgdy^267sage: differential_operator(x^2*y, x*y^2, 2)681/36*dfdy^2*dgdx^2 - 1/18*dfdx*dfdy*dgdx*dgdy + 1/36*dfdx^2*dgdy^269sage: differential_operator(x^2*y, x*y^2, 4)701/576*dfdy^4*dgdx^4 - 1/144*dfdx*dfdy^3*dgdx^3*dgdy + 1/96*dfdx^2*dfdy^2*dgdx^2*dgdy^2 - 1/144*dfdx^3*dfdy*dgdx*dgdy^3 + 1/576*dfdx^4*dgdy^471"""72(x, y) = f.parent().gens()73n = max(ZZ(f.degree()), ZZ(k))74m = max(ZZ(g.degree()), ZZ(k))75R, (fx, fy, gx, gy) = PolynomialRing(f.base_ring(), 4, 'dfdx,dfdy,dgdx,dgdy').objgens()76const = (m - k).factorial() * (n - k).factorial() / (m.factorial() * n.factorial())77U = f.base_ring()(const) * (fx*gy - fy*gx)**k78return U7980def diffsymb(U, f, g):81r"""82Given a differential operator ``U`` in ``dfdx, dfdy, dgdx, dgdy``,83represented symbolically by ``U``, apply it to ``f, g``.8485EXAMPLES::8687sage: from sage.schemes.hyperelliptic_curves.invariants import diffsymb88sage: R.<x, y> = QQ[]89sage: S.<dfdx, dfdy, dgdx, dgdy> = QQ[]90sage: [ diffsymb(dd, x^2, y*0 + 1) for dd in S.gens() ]91[2*x, 0, 0, 0]92sage: [ diffsymb(dd, x*0 + 1, y^2) for dd in S.gens() ]93[0, 0, 0, 2*y]94sage: [ diffsymb(dd, x^2, y^2) for dd in S.gens() ]95[2*x*y^2, 0, 0, 2*x^2*y]9697sage: diffsymb(dfdx + dfdy*dgdy, y*x^2, y^3)982*x*y^4 + 3*x^2*y^299"""100(x, y) = f.parent().gens()101R, (fx, fy, gx, gy) = PolynomialRing(f.base_ring(), 4, 'dfdx,dfdy,dgdx,dgdy').objgens()102res = 0103for coeff, mon in list(U):104mon = R(mon)105a = diffxy(f, x, mon.degree(fx), y, mon.degree(fy))106b = diffxy(g, x, mon.degree(gx), y, mon.degree(gy))107temp = coeff * a * b108res = res + temp109return res110111def Ueberschiebung(f, g, k):112r"""113Return the differential operator `(f g)_k`.114115This is defined by Mestre on page 315:116`(f g)_k = \frac{(m - k)! (n - k)!}{m! n!} \left(117\frac{\del f}{\del x} \frac{\del g}{\del y} -118\frac{\del f}{\del y} \frac{\del g}{\del x} \right)^k ` .119120EXAMPLES::121122sage: from sage.schemes.hyperelliptic_curves.invariants import Ueberschiebung as ub123sage: R.<x, y> = QQ[]124sage: ub(x, y, 0)125x*y126sage: ub(x^5 + 1, x^5 + 1, 1)1270128sage: ub(x^5 + 5*x + 1, x^5 + 5*x + 1, 0)129x^10 + 10*x^6 + 2*x^5 + 25*x^2 + 10*x + 1130"""131U = differential_operator(f, g, k)132# U is the (f g)_k = ... of Mestre, p315, symbolically133return diffsymb(U, f, g)134135def ubs(f):136r"""137Given a sextic form `f`, return a dictionary of the invariants of Mestre, p 317 [M]_.138139`f` may be homogeneous in two variables or inhomogeneous in one.140141EXAMPLES::142143sage: from sage.schemes.hyperelliptic_curves.invariants import ubs144sage: x = QQ['x'].0145sage: ubs(x^6 + 1)146{'A': 2, 'C': -2/9, 'B': 2/3, 'D': 0, 'f': x^6 + h^6, 'i': 2*x^2*h^2, 'Delta': -2/3*x^2*h^2, 'y1': 0, 'y3': 0, 'y2': 0}147148sage: R.<u, v> = QQ[]149sage: ubs(u^6 + v^6)150{'A': 2, 'C': -2/9, 'B': 2/3, 'D': 0, 'f': u^6 + v^6, 'i': 2*u^2*v^2, 'Delta': -2/3*u^2*v^2, 'y1': 0, 'y3': 0, 'y2': 0}151152sage: R.<t> = GF(31)[]153sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1)154{'A': 0, 'C': -15, 'B': -12, 'D': -15, 'f': t^6 + 2*t^5*h + t^2*h^4 + 3*t*h^5 + h^6, 'i': -4*t^4 + 10*t^3*h + 2*t^2*h^2 - 9*t*h^3 - 7*h^4, 'Delta': -10*t^4 + 12*t^3*h + 7*t^2*h^2 - 5*t*h^3 + 2*h^4, 'y1': 4*t^2 - 10*t*h - 13*h^2, 'y3': 4*t^2 - 4*t*h - 9*h^2, 'y2': 6*t^2 - 4*t*h + 2*h^2}155"""156ub = Ueberschiebung157if f.parent().ngens() == 1:158f = PolynomialRing(f.parent().base_ring(), 1, f.parent().variable_name())(f)159x1, x2 = f.homogenize().parent().gens()160f = sum([ f[i]*x1**i*x2**(6-i) for i in range(7) ])161U = {}162U['f'] = f163U['i'] = ub(f, f, 4)164U['Delta'] = ub(U['i'], U['i'], 2)165U['y1'] = ub(f, U['i'], 4)166U['y2'] = ub(U['i'], U['y1'], 2)167U['y3'] = ub(U['i'], U['y2'], 2)168U['A'] = ub(f, f, 6)169U['B'] = ub(U['i'], U['i'], 4)170U['C'] = ub(U['i'], U['Delta'], 4)171U['D'] = ub(U['y3'], U['y1'], 2)172return U173174def clebsch_to_igusa(A, B, C, D):175r"""176Convert Clebsch invariants `A, B, C, D` to Igusa invariants `I_2, I_4, I_6, I_{10}`.177178EXAMPLES::179180sage: from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch181sage: clebsch_to_igusa(2, 3, 4, 5)182(-240, 17370, 231120, -103098906)183sage: igusa_to_clebsch(*clebsch_to_igusa(2, 3, 4, 5))184(2, 3, 4, 5)185186sage: Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs187(2, 3, 4, 5)188sage: clebsch_to_igusa(*Cs)189(8, 10, 15, 26)190sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs))191(2, 3, 4, 5)192"""193I2 = -120*A194I4 = -720*A**2 + 6750*B195I6 = 8640*A**3 - 108000*A*B + 202500*C196I10 = -62208*A**5 + 972000*A**3*B + 1620000*A**2*C - 3037500*A*B**2 - 6075000*B*C - 4556250*D197return (I2, I4, I6, I10)198199def igusa_to_clebsch(I2, I4, I6, I10):200r"""201Convert Igusa invariants `I_2, I_4, I_6, I_{10}` to Clebsch invariants `A, B, C, D`.202203EXAMPLES::204205sage: from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch206sage: igusa_to_clebsch(-2400, 173700, 23112000, -10309890600)207(20, 342/5, 2512/5, 43381012/1125)208sage: clebsch_to_igusa(*igusa_to_clebsch(-2400, 173700, 23112000, -10309890600))209(-2400, 173700, 23112000, -10309890600)210211sage: Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is212(18, 7, 12, 27)213sage: igusa_to_clebsch(*Is)214(20, 25, 25, 12)215sage: clebsch_to_igusa(*igusa_to_clebsch(*Is))216(18, 7, 12, 27)217"""218A = -(+ I2) / 120219B = -(- I2**2 - 20*I4)/135000220C = -(+ I2**3 + 80*I2*I4 - 600*I6)/121500000221D = -(+ 9*I2**5 + 700*I2**3*I4 - 3600*I2**2*I6 - 12400*I2*I4**2 + 48000*I4*I6 + 10800000*I10) / 49207500000000222return (A, B, C, D)223224225def clebsch_invariants(f):226r"""227Given a sextic form `f`, return the Clebsch invariants `(A, B, C, D)` of Mestre, p 317, [M]_.228229`f` may be homogeneous in two variables or inhomogeneous in one.230231EXAMPLES::232233sage: R.<x, y> = QQ[]234sage: clebsch_invariants(x^6 + y^6)235(2, 2/3, -2/9, 0)236sage: R.<x> = QQ[]237sage: clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2)238(62/15, 15434/5625, -236951/140625, 229930748/791015625)239240sage: magma(x^6 + 1).ClebschInvariants() # optional - magma241[ 2, 2/3, -2/9, 0 ]242sage: magma(x^6 + x^5 + x^4 + x^2 + 2).ClebschInvariants() # optional - magma243[ 62/15, 15434/5625, -236951/140625, 229930748/791015625 ]244"""245R = f.parent().base_ring()246if R.characteristic() in [2, 3, 5]:247raise NotImplementedError, "Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5"248249U = ubs(f)250L = U['A'], U['B'], U['C'], U['D']251assert all(t.is_constant() for t in L)252return tuple([ t.constant_coefficient() for t in L ])253254def igusa_clebsch_invariants(f):255r"""256Given a sextic form `f`, return the Igusa-Clebsch invariants `I_2, I_4, I_6, I_{10}` of Igusa and Clebsch [I]_.257258`f` may be homogeneous in two variables or inhomogeneous in one.259260EXAMPLES::261262sage: R.<x, y> = QQ[]263sage: igusa_clebsch_invariants(x^6 + y^6)264(-240, 1620, -119880, -46656)265sage: R.<x> = QQ[]266sage: igusa_clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2)267(-496, 6220, -955932, -1111784)268269sage: magma(x^6 + 1).IgusaClebschInvariants() # optional - magma270[ -240, 1620, -119880, -46656 ]271sage: magma(x^6 + x^5 + x^4 + x^2 + 2).IgusaClebschInvariants() # optional - magma272[ -496, 6220, -955932, -1111784 ]273274TESTS::275276Let's check a symbolic example::277278sage: R.<a, b, c, d, e> = QQ[]279sage: S.<x> = R[]280sage: igusa_clebsch_invariants(x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e)[0]2816*b^2 - 16*a*c + 40*d282283sage: absolute_igusa_invariants_wamelen(GF(5)['x'](x^6 - 2*x))284Traceback (most recent call last):285...286NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5287"""288return clebsch_to_igusa(*clebsch_invariants(f))289290def absolute_igusa_invariants_wamelen(f):291r"""292Given a sextic form `f`, return the three absolute Igusa invariants used by van Wamelen [W]_.293294`f` may be homogeneous in two variables or inhomogeneous in one.295296REFERENCES::297298.. [W] van Wamelen, Paul. Examples of genus two CM curves defined299over the rationals.300Math. Comp. 68 (1999), no. 225, 307--320.301302EXAMPLES::303304sage: R.<x> = QQ[]305sage: absolute_igusa_invariants_wamelen(x^5 - 1)306(0, 0, 0)307308The following example can be checked against van Wamelen's paper:309310sage: i1, i2, i3 = absolute_igusa_invariants_wamelen(-x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1)311sage: map(factor, (i1, i2, i3))312[2^7 * 3^15, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]313314TESTS::315316sage: absolute_igusa_invariants_wamelen(GF(3)['x'](x^5 - 2*x))317Traceback (most recent call last):318...319NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5320"""321I2, I4, I6, I10 = igusa_clebsch_invariants(f)322i1 = I2**5/I10323i2 = I2**3*I4/I10324i3 = I2**2*I6/I10325return (i1, i2, i3)326327def absolute_igusa_invariants_kohel(f):328r"""329Given a sextic form `f`, return the three absolute Igusa invariants used by Kohel [K]_.330331`f` may be homogeneous in two variables or inhomogeneous in one.332333REFERENCES::334335.. [K] Kohel, David. ECHIDNA: Databases for Elliptic Curves and Higher Dimensional Analogues.336Available at http://echidna.maths.usyd.edu.au/~kohel/dbs/337338EXAMPLES::339340sage: R.<x> = QQ[]341sage: absolute_igusa_invariants_kohel(x^5 - 1)342(0, 0, 0)343sage: absolute_igusa_invariants_kohel(x^5 - x)344(100, -20000, -2000)345346The following example can be checked against Kohel's database [K]_:347348sage: i1, i2, i3 = absolute_igusa_invariants_kohel(-x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1)349sage: map(factor, (i1, i2, i3))350[2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]351sage: map(factor, (150660, 28343520, 9762768))352[2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]353354TESTS::355356sage: absolute_igusa_invariants_kohel(GF(2)['x'](x^5 - x))357Traceback (most recent call last):358...359NotImplementedError: Invariants of binary sextics/genus 2 hyperelliptic curves not implemented in characteristics 2, 3, and 5360"""361I2, I4, I6, I10 = igusa_clebsch_invariants(f)362i1 = I4*I6/I10363i2 = I2**3*I4/I10364i3 = I2**2*I6/I10365return (i1, i2, i3)366367368