Compute invariants of quintics and sextics via ‘Ueberschiebung’

Todo

  • Implement invariants in small positive characteristic.

  • Cardona-Quer and additional invariants for classifying automorphism groups.

AUTHOR:

  • Nick Alexander

sage.schemes.hyperelliptic_curves.invariants.Ueberschiebung(f, g, k)[source]

Return the differential operator \((f g)_k\).

This is defined by Mestre on page 315 [Mes1991]:

\[(f g)_k = \frac{(m - k)! (n - k)!}{m! n!} \left( \frac{\partial f}{\partial x} \frac{\partial g}{\partial y} - \frac{\partial f}{\partial y} \frac{\partial g}{\partial x} \right)^k .\]

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import Ueberschiebung as ub
sage: R.<x, y> = QQ[]
sage: ub(x, y, 0)
x*y
sage: ub(x^5 + 1, x^5 + 1, 1)
0
sage: ub(x^5 + 5*x + 1, x^5 + 5*x + 1, 0)
x^10 + 10*x^6 + 2*x^5 + 25*x^2 + 10*x + 1
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import Ueberschiebung as ub
>>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
>>> ub(x, y, Integer(0))
x*y
>>> ub(x**Integer(5) + Integer(1), x**Integer(5) + Integer(1), Integer(1))
0
>>> ub(x**Integer(5) + Integer(5)*x + Integer(1), x**Integer(5) + Integer(5)*x + Integer(1), Integer(0))
x^10 + 10*x^6 + 2*x^5 + 25*x^2 + 10*x + 1
from sage.schemes.hyperelliptic_curves.invariants import Ueberschiebung as ub
R.<x, y> = QQ[]
ub(x, y, 0)
ub(x^5 + 1, x^5 + 1, 1)
ub(x^5 + 5*x + 1, x^5 + 5*x + 1, 0)
sage.schemes.hyperelliptic_curves.invariants.absolute_igusa_invariants_kohel(f)[source]

Given a sextic form \(f\), return the three absolute Igusa invariants used by Kohel [KohECHIDNA].

\(f\) may be homogeneous in two variables or inhomogeneous in one.

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_kohel
sage: R.<x> = QQ[]
sage: absolute_igusa_invariants_kohel(x^5 - 1)
(0, 0, 0)
sage: absolute_igusa_invariants_kohel(x^5 - x)
(100, -20000, -2000)
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_kohel
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> absolute_igusa_invariants_kohel(x**Integer(5) - Integer(1))
(0, 0, 0)
>>> absolute_igusa_invariants_kohel(x**Integer(5) - x)
(100, -20000, -2000)
from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_kohel
R.<x> = QQ[]
absolute_igusa_invariants_kohel(x^5 - 1)
absolute_igusa_invariants_kohel(x^5 - x)

The following example can be checked against Kohel’s database [KohECHIDNA]

sage: h = -x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1
sage: i1, i2, i3 = absolute_igusa_invariants_kohel(h)
sage: list(map(factor, (i1, i2, i3)))
[2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]
sage: list(map(factor, (150660, 28343520, 9762768)))
[2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]
>>> from sage.all import *
>>> h = -x**Integer(5) + Integer(3)*x**Integer(4) + Integer(2)*x**Integer(3) - Integer(6)*x**Integer(2) - Integer(3)*x + Integer(1)
>>> i1, i2, i3 = absolute_igusa_invariants_kohel(h)
>>> list(map(factor, (i1, i2, i3)))
[2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]
>>> list(map(factor, (Integer(150660), Integer(28343520), Integer(9762768))))
[2^2 * 3^5 * 5 * 31, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]
h = -x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1
i1, i2, i3 = absolute_igusa_invariants_kohel(h)
list(map(factor, (i1, i2, i3)))
list(map(factor, (150660, 28343520, 9762768)))
sage.schemes.hyperelliptic_curves.invariants.absolute_igusa_invariants_wamelen(f)[source]

Given a sextic form \(f\), return the three absolute Igusa invariants used by van Wamelen [Wam1999].

\(f\) may be homogeneous in two variables or inhomogeneous in one.

REFERENCES:

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_wamelen
sage: R.<x> = QQ[]
sage: absolute_igusa_invariants_wamelen(x^5 - 1)
(0, 0, 0)
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_wamelen
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> absolute_igusa_invariants_wamelen(x**Integer(5) - Integer(1))
(0, 0, 0)
from sage.schemes.hyperelliptic_curves.invariants import absolute_igusa_invariants_wamelen
R.<x> = QQ[]
absolute_igusa_invariants_wamelen(x^5 - 1)

The following example can be checked against van Wamelen’s paper:

sage: h = -x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1
sage: i1, i2, i3 = absolute_igusa_invariants_wamelen(h)
sage: list(map(factor, (i1, i2, i3)))
[2^7 * 3^15, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]
>>> from sage.all import *
>>> h = -x**Integer(5) + Integer(3)*x**Integer(4) + Integer(2)*x**Integer(3) - Integer(6)*x**Integer(2) - Integer(3)*x + Integer(1)
>>> i1, i2, i3 = absolute_igusa_invariants_wamelen(h)
>>> list(map(factor, (i1, i2, i3)))
[2^7 * 3^15, 2^5 * 3^11 * 5, 2^4 * 3^9 * 31]
h = -x^5 + 3*x^4 + 2*x^3 - 6*x^2 - 3*x + 1
i1, i2, i3 = absolute_igusa_invariants_wamelen(h)
list(map(factor, (i1, i2, i3)))
sage.schemes.hyperelliptic_curves.invariants.clebsch_invariants(f)[source]

Given a sextic form \(f\), return the Clebsch invariants \((A, B, C, D)\) of Mestre, p 317, [Mes1991].

\(f\) may be homogeneous in two variables or inhomogeneous in one.

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import clebsch_invariants
sage: R.<x, y> = QQ[]
sage: clebsch_invariants(x^6 + y^6)
(2, 2/3, -2/9, 0)
sage: R.<x> = QQ[]
sage: clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2)
(62/15, 15434/5625, -236951/140625, 229930748/791015625)

sage: magma(x^6 + 1).ClebschInvariants()                    # optional - magma
[ 2, 2/3, -2/9, 0 ]
sage: magma(x^6 + x^5 + x^4 + x^2 + 2).ClebschInvariants()  # optional - magma
[ 62/15, 15434/5625, -236951/140625, 229930748/791015625 ]
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import clebsch_invariants
>>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
>>> clebsch_invariants(x**Integer(6) + y**Integer(6))
(2, 2/3, -2/9, 0)
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> clebsch_invariants(x**Integer(6) + x**Integer(5) + x**Integer(4) + x**Integer(2) + Integer(2))
(62/15, 15434/5625, -236951/140625, 229930748/791015625)

>>> magma(x**Integer(6) + Integer(1)).ClebschInvariants()                    # optional - magma
[ 2, 2/3, -2/9, 0 ]
>>> magma(x**Integer(6) + x**Integer(5) + x**Integer(4) + x**Integer(2) + Integer(2)).ClebschInvariants()  # optional - magma
[ 62/15, 15434/5625, -236951/140625, 229930748/791015625 ]
from sage.schemes.hyperelliptic_curves.invariants import clebsch_invariants
R.<x, y> = QQ[]
clebsch_invariants(x^6 + y^6)
R.<x> = QQ[]
clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2)
magma(x^6 + 1).ClebschInvariants()                    # optional - magma
magma(x^6 + x^5 + x^4 + x^2 + 2).ClebschInvariants()  # optional - magma
sage.schemes.hyperelliptic_curves.invariants.clebsch_to_igusa(A, B, C, D)[source]

Convert Clebsch invariants \(A, B, C, D\) to Igusa invariants \(I_2, I_4, I_6, I_{10}\).

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch
sage: clebsch_to_igusa(2, 3, 4, 5)
(-240, 17370, 231120, -103098906)
sage: igusa_to_clebsch(*clebsch_to_igusa(2, 3, 4, 5))
(2, 3, 4, 5)

sage: Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs
(2, 3, 4, 5)
sage: clebsch_to_igusa(*Cs)
(8, 10, 15, 26)
sage: igusa_to_clebsch(*clebsch_to_igusa(*Cs))
(2, 3, 4, 5)
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch
>>> clebsch_to_igusa(Integer(2), Integer(3), Integer(4), Integer(5))
(-240, 17370, 231120, -103098906)
>>> igusa_to_clebsch(*clebsch_to_igusa(Integer(2), Integer(3), Integer(4), Integer(5)))
(2, 3, 4, 5)

>>> Cs = tuple(map(GF(Integer(31)), (Integer(2), Integer(3), Integer(4), Integer(5)))); Cs
(2, 3, 4, 5)
>>> clebsch_to_igusa(*Cs)
(8, 10, 15, 26)
>>> igusa_to_clebsch(*clebsch_to_igusa(*Cs))
(2, 3, 4, 5)
from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch
clebsch_to_igusa(2, 3, 4, 5)
igusa_to_clebsch(*clebsch_to_igusa(2, 3, 4, 5))
Cs = tuple(map(GF(31), (2, 3, 4, 5))); Cs
clebsch_to_igusa(*Cs)
igusa_to_clebsch(*clebsch_to_igusa(*Cs))
sage.schemes.hyperelliptic_curves.invariants.differential_operator(f, g, k)[source]

Return the differential operator \((f g)_k\) symbolically in the polynomial ring in dfdx, dfdy, dgdx, dgdy.

This is defined by Mestre on p 315 [Mes1991]:

\[(f g)_k = \frac{(m - k)! (n - k)!}{m! n!} \left( \frac{\partial f}{\partial x} \frac{\partial g}{\partial y} - \frac{\partial f}{\partial y} \frac{\partial g}{\partial x} \right)^k .\]

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import differential_operator
sage: R.<x, y> = QQ[]
sage: differential_operator(x, y, 0)
1
sage: differential_operator(x, y, 1)
-dfdy*dgdx + dfdx*dgdy
sage: differential_operator(x*y, x*y, 2)
1/4*dfdy^2*dgdx^2 - 1/2*dfdx*dfdy*dgdx*dgdy + 1/4*dfdx^2*dgdy^2
sage: differential_operator(x^2*y, x*y^2, 2)
1/36*dfdy^2*dgdx^2 - 1/18*dfdx*dfdy*dgdx*dgdy + 1/36*dfdx^2*dgdy^2
sage: differential_operator(x^2*y, x*y^2, 4)
1/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^4
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import differential_operator
>>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
>>> differential_operator(x, y, Integer(0))
1
>>> differential_operator(x, y, Integer(1))
-dfdy*dgdx + dfdx*dgdy
>>> differential_operator(x*y, x*y, Integer(2))
1/4*dfdy^2*dgdx^2 - 1/2*dfdx*dfdy*dgdx*dgdy + 1/4*dfdx^2*dgdy^2
>>> differential_operator(x**Integer(2)*y, x*y**Integer(2), Integer(2))
1/36*dfdy^2*dgdx^2 - 1/18*dfdx*dfdy*dgdx*dgdy + 1/36*dfdx^2*dgdy^2
>>> differential_operator(x**Integer(2)*y, x*y**Integer(2), Integer(4))
1/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^4
from sage.schemes.hyperelliptic_curves.invariants import differential_operator
R.<x, y> = QQ[]
differential_operator(x, y, 0)
differential_operator(x, y, 1)
differential_operator(x*y, x*y, 2)
differential_operator(x^2*y, x*y^2, 2)
differential_operator(x^2*y, x*y^2, 4)
sage.schemes.hyperelliptic_curves.invariants.diffsymb(U, f, g)[source]

Given a differential operator U in dfdx, dfdy, dgdx, dgdy, represented symbolically by U, apply it to f, g.

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import diffsymb
sage: R.<x, y> = QQ[]
sage: S.<dfdx, dfdy, dgdx, dgdy> = QQ[]
sage: [ diffsymb(dd, x^2, y*0 + 1) for dd in S.gens() ]
[2*x, 0, 0, 0]
sage: [ diffsymb(dd, x*0 + 1, y^2) for dd in S.gens() ]
[0, 0, 0, 2*y]
sage: [ diffsymb(dd, x^2, y^2) for dd in S.gens() ]
[2*x*y^2, 0, 0, 2*x^2*y]

sage: diffsymb(dfdx + dfdy*dgdy, y*x^2, y^3)
2*x*y^4 + 3*x^2*y^2
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import diffsymb
>>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
>>> S = QQ['dfdx, dfdy, dgdx, dgdy']; (dfdx, dfdy, dgdx, dgdy,) = S._first_ngens(4)
>>> [ diffsymb(dd, x**Integer(2), y*Integer(0) + Integer(1)) for dd in S.gens() ]
[2*x, 0, 0, 0]
>>> [ diffsymb(dd, x*Integer(0) + Integer(1), y**Integer(2)) for dd in S.gens() ]
[0, 0, 0, 2*y]
>>> [ diffsymb(dd, x**Integer(2), y**Integer(2)) for dd in S.gens() ]
[2*x*y^2, 0, 0, 2*x^2*y]

>>> diffsymb(dfdx + dfdy*dgdy, y*x**Integer(2), y**Integer(3))
2*x*y^4 + 3*x^2*y^2
from sage.schemes.hyperelliptic_curves.invariants import diffsymb
R.<x, y> = QQ[]
S.<dfdx, dfdy, dgdx, dgdy> = QQ[]
[ diffsymb(dd, x^2, y*0 + 1) for dd in S.gens() ]
[ diffsymb(dd, x*0 + 1, y^2) for dd in S.gens() ]
[ diffsymb(dd, x^2, y^2) for dd in S.gens() ]
diffsymb(dfdx + dfdy*dgdy, y*x^2, y^3)
sage.schemes.hyperelliptic_curves.invariants.diffxy(f, x, xtimes, y, ytimes)[source]

Differentiate a polynomial f, xtimes with respect to x, and ytimes with respect to y.

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import diffxy
sage: R.<u, v> = QQ[]
sage: diffxy(u^2*v^3, u, 0, v, 0)
u^2*v^3
sage: diffxy(u^2*v^3, u, 2, v, 1)
6*v^2
sage: diffxy(u^2*v^3, u, 2, v, 2)
12*v
sage: diffxy(u^2*v^3 + u^4*v^4, u, 2, v, 2)
144*u^2*v^2 + 12*v
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import diffxy
>>> R = QQ['u, v']; (u, v,) = R._first_ngens(2)
>>> diffxy(u**Integer(2)*v**Integer(3), u, Integer(0), v, Integer(0))
u^2*v^3
>>> diffxy(u**Integer(2)*v**Integer(3), u, Integer(2), v, Integer(1))
6*v^2
>>> diffxy(u**Integer(2)*v**Integer(3), u, Integer(2), v, Integer(2))
12*v
>>> diffxy(u**Integer(2)*v**Integer(3) + u**Integer(4)*v**Integer(4), u, Integer(2), v, Integer(2))
144*u^2*v^2 + 12*v
from sage.schemes.hyperelliptic_curves.invariants import diffxy
R.<u, v> = QQ[]
diffxy(u^2*v^3, u, 0, v, 0)
diffxy(u^2*v^3, u, 2, v, 1)
diffxy(u^2*v^3, u, 2, v, 2)
diffxy(u^2*v^3 + u^4*v^4, u, 2, v, 2)
sage.schemes.hyperelliptic_curves.invariants.igusa_clebsch_invariants(f)[source]

Given a sextic form \(f\), return the Igusa-Clebsch invariants \(I_2, I_4, I_6, I_{10}\) of Igusa and Clebsch [IJ1960].

\(f\) may be homogeneous in two variables or inhomogeneous in one.

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import igusa_clebsch_invariants
sage: R.<x, y> = QQ[]
sage: igusa_clebsch_invariants(x^6 + y^6)
(-240, 1620, -119880, -46656)
sage: R.<x> = QQ[]
sage: igusa_clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2)
(-496, 6220, -955932, -1111784)

sage: magma(x^6 + 1).IgusaClebschInvariants()                    # optional - magma
[ -240, 1620, -119880, -46656 ]
sage: magma(x^6 + x^5 + x^4 + x^2 + 2).IgusaClebschInvariants()  # optional - magma
[ -496, 6220, -955932, -1111784 ]
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import igusa_clebsch_invariants
>>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
>>> igusa_clebsch_invariants(x**Integer(6) + y**Integer(6))
(-240, 1620, -119880, -46656)
>>> R = QQ['x']; (x,) = R._first_ngens(1)
>>> igusa_clebsch_invariants(x**Integer(6) + x**Integer(5) + x**Integer(4) + x**Integer(2) + Integer(2))
(-496, 6220, -955932, -1111784)

>>> magma(x**Integer(6) + Integer(1)).IgusaClebschInvariants()                    # optional - magma
[ -240, 1620, -119880, -46656 ]
>>> magma(x**Integer(6) + x**Integer(5) + x**Integer(4) + x**Integer(2) + Integer(2)).IgusaClebschInvariants()  # optional - magma
[ -496, 6220, -955932, -1111784 ]
from sage.schemes.hyperelliptic_curves.invariants import igusa_clebsch_invariants
R.<x, y> = QQ[]
igusa_clebsch_invariants(x^6 + y^6)
R.<x> = QQ[]
igusa_clebsch_invariants(x^6 + x^5 + x^4 + x^2 + 2)
magma(x^6 + 1).IgusaClebschInvariants()                    # optional - magma
magma(x^6 + x^5 + x^4 + x^2 + 2).IgusaClebschInvariants()  # optional - magma
sage.schemes.hyperelliptic_curves.invariants.igusa_to_clebsch(I2, I4, I6, I10)[source]

Convert Igusa invariants \(I_2, I_4, I_6, I_{10}\) to Clebsch invariants \(A, B, C, D\).

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch
sage: igusa_to_clebsch(-2400, 173700, 23112000, -10309890600)
(20, 342/5, 2512/5, 43381012/1125)
sage: clebsch_to_igusa(*igusa_to_clebsch(-2400, 173700, 23112000, -10309890600))
(-2400, 173700, 23112000, -10309890600)

sage: Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is
(18, 7, 12, 27)
sage: igusa_to_clebsch(*Is)
(20, 25, 25, 12)
sage: clebsch_to_igusa(*igusa_to_clebsch(*Is))
(18, 7, 12, 27)
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch
>>> igusa_to_clebsch(-Integer(2400), Integer(173700), Integer(23112000), -Integer(10309890600))
(20, 342/5, 2512/5, 43381012/1125)
>>> clebsch_to_igusa(*igusa_to_clebsch(-Integer(2400), Integer(173700), Integer(23112000), -Integer(10309890600)))
(-2400, 173700, 23112000, -10309890600)

>>> Is = tuple(map(GF(Integer(31)), (-Integer(2400), Integer(173700), Integer(23112000), -Integer(10309890600)))); Is
(18, 7, 12, 27)
>>> igusa_to_clebsch(*Is)
(20, 25, 25, 12)
>>> clebsch_to_igusa(*igusa_to_clebsch(*Is))
(18, 7, 12, 27)
from sage.schemes.hyperelliptic_curves.invariants import clebsch_to_igusa, igusa_to_clebsch
igusa_to_clebsch(-2400, 173700, 23112000, -10309890600)
clebsch_to_igusa(*igusa_to_clebsch(-2400, 173700, 23112000, -10309890600))
Is = tuple(map(GF(31), (-2400, 173700, 23112000, -10309890600))); Is
igusa_to_clebsch(*Is)
clebsch_to_igusa(*igusa_to_clebsch(*Is))
sage.schemes.hyperelliptic_curves.invariants.ubs(f)[source]

Given a sextic form \(f\), return a dictionary of the invariants of Mestre, p 317 [Mes1991].

\(f\) may be homogeneous in two variables or inhomogeneous in one.

EXAMPLES:

sage: from sage.schemes.hyperelliptic_curves.invariants import ubs
sage: x = QQ['x'].0
sage: ubs(x^6 + 1)
{'A': 2,
 'B': 2/3,
 'C': -2/9,
 'D': 0,
 'Delta': -2/3*x^2*h^2,
 'f': x^6 + h^6,
 'i': 2*x^2*h^2,
 'y1': 0,
 'y2': 0,
 'y3': 0}

sage: R.<u, v> = QQ[]
sage: ubs(u^6 + v^6)
{'A': 2,
 'B': 2/3,
 'C': -2/9,
 'D': 0,
 'Delta': -2/3*u^2*v^2,
 'f': u^6 + v^6,
 'i': 2*u^2*v^2,
 'y1': 0,
 'y2': 0,
 'y3': 0}

sage: R.<t> = GF(31)[]
sage: ubs(t^6 + 2*t^5 + t^2 + 3*t + 1)
{'A': 0,
 'B': -12,
 'C': -15,
 'D': -15,
 'Delta': -10*t^4 + 12*t^3*h + 7*t^2*h^2 - 5*t*h^3 + 2*h^4,
 '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,
 'y1': 4*t^2 - 10*t*h - 13*h^2,
 'y2': 6*t^2 - 4*t*h + 2*h^2,
 'y3': 4*t^2 - 4*t*h - 9*h^2}
>>> from sage.all import *
>>> from sage.schemes.hyperelliptic_curves.invariants import ubs
>>> x = QQ['x'].gen(0)
>>> ubs(x**Integer(6) + Integer(1))
{'A': 2,
 'B': 2/3,
 'C': -2/9,
 'D': 0,
 'Delta': -2/3*x^2*h^2,
 'f': x^6 + h^6,
 'i': 2*x^2*h^2,
 'y1': 0,
 'y2': 0,
 'y3': 0}

>>> R = QQ['u, v']; (u, v,) = R._first_ngens(2)
>>> ubs(u**Integer(6) + v**Integer(6))
{'A': 2,
 'B': 2/3,
 'C': -2/9,
 'D': 0,
 'Delta': -2/3*u^2*v^2,
 'f': u^6 + v^6,
 'i': 2*u^2*v^2,
 'y1': 0,
 'y2': 0,
 'y3': 0}

>>> R = GF(Integer(31))['t']; (t,) = R._first_ngens(1)
>>> ubs(t**Integer(6) + Integer(2)*t**Integer(5) + t**Integer(2) + Integer(3)*t + Integer(1))
{'A': 0,
 'B': -12,
 'C': -15,
 'D': -15,
 'Delta': -10*t^4 + 12*t^3*h + 7*t^2*h^2 - 5*t*h^3 + 2*h^4,
 '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,
 'y1': 4*t^2 - 10*t*h - 13*h^2,
 'y2': 6*t^2 - 4*t*h + 2*h^2,
 'y3': 4*t^2 - 4*t*h - 9*h^2}
from sage.schemes.hyperelliptic_curves.invariants import ubs
x = QQ['x'].0
ubs(x^6 + 1)
R.<u, v> = QQ[]
ubs(u^6 + v^6)
R.<t> = GF(31)[]
ubs(t^6 + 2*t^5 + t^2 + 3*t + 1)