Classical Invariant Theory - Polynomials

Skip to content
Back to top
View this page
Edit this page

# Classical Invariant Theory

This module lists classical invariants and covariants of homogeneous polynomials (also called algebraic forms) under the action of the special linear group. That is, we are dealing with polynomials of degree \(d\) in \(n\) variables. The special linear group \(SL(n,\CC)\) acts on the variables \((x_1,\dots, x_n)\) linearly,

\[(x_1,\dots, x_n)^t \to A (x_1,\dots, x_n)^t ,\qquad A \in SL(n,\CC)\]

The linear action on the variables transforms a polynomial \(p\) generally into a different polynomial \(gp\). We can think of it as an action on the space of coefficients in \(p\). An invariant is a polynomial in the coefficients that is invariant under this action. A covariant is a polynomial in the coefficients and the variables \((x_1,\dots, x_n)\) that is invariant under the combined action.

For example, the binary quadratic \(p(x,y) = a x^2 + b x y + c y^2\) has as its invariant the discriminant \(\mathop{disc}(p) = b^2 - 4 a c\). This means that for any \(SL(2,\CC)\) coordinate change

\[\begin{split}\begin{pmatrix} x' \\ y' \end{pmatrix} = \begin{pmatrix} \alpha & \beta \\ \gamma & \delta \end{pmatrix} \begin{pmatrix} x \\ y \end{pmatrix} \qquad \alpha\delta-\beta\gamma=1\end{split}\]

the discriminant is invariant, \(\mathop{disc}\big(p(x',y')\big) = \mathop{disc}\big(p(x,y)\big)\).

To use this module, you should use the factory object `invariant_theory`. For example, take the quartic:

Sage

    sage: R.<x,y> = QQ[]
    sage: q = x^4 + y^4
    sage: quartic = invariant_theory.binary_quartic(q);  quartic
    Binary quartic with coefficients (1, 0, 0, 0, 1)

Python

    >>> from sage.all import *
    >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
    >>> q = x**Integer(4) + y**Integer(4)
    >>> quartic = invariant_theory.binary_quartic(q);  quartic
    Binary quartic with coefficients (1, 0, 0, 0, 1)

One invariant of a quartic is known as the Eisenstein D-invariant. Since it is an invariant, it is a polynomial in the coefficients (which are integers in this example):

Sage

    sage: quartic.EisensteinD()
    1

[Python]

    >>> from sage.all import *
    >>> quartic.EisensteinD()
    1

One example of a covariant of a quartic is the so-called g-covariant (actually, the Hessian). As with all covariants, it is a polynomial in \(x\), \(y\) and the coefficients:

Sage

    sage: quartic.g_covariant()
    -x^2*y^2

Python

    >>> from sage.all import *
    >>> quartic.g_covariant()
    -x^2*y^2

As usual, use tab completion and the online help to discover the implemented invariants and covariants.

In general, the variables of the defining polynomial cannot be guessed. For example, the zero polynomial can be thought of as a homogeneous polynomial of any degree. Also, since we also want to allow polynomial coefficients we cannot just take all variables of the polynomial ring as the variables of the form. This is why you will have to specify the variables explicitly if there is any potential ambiguity. For example:

Sage

    sage: invariant_theory.binary_quartic(R.zero(), [x,y])
    Binary quartic with coefficients (0, 0, 0, 0, 0)

    sage: invariant_theory.binary_quartic(x^4, [x,y])
    Binary quartic with coefficients (0, 0, 0, 0, 1)

    sage: R.<x,y,t> = QQ[]
    sage: invariant_theory.binary_quartic(x^4 + y^4 + t*x^2*y^2, [x,y])
    Binary quartic with coefficients (1, 0, t, 0, 1)

[Python]

    >>> from sage.all import *
    >>> invariant_theory.binary_quartic(R.zero(), [x,y])
    Binary quartic with coefficients (0, 0, 0, 0, 0)

    >>> invariant_theory.binary_quartic(x**Integer(4), [x,y])
    Binary quartic with coefficients (0, 0, 0, 0, 1)

    >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
    >>> invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4) + t*x**Integer(2)*y**Integer(2), [x,y])
    Binary quartic with coefficients (1, 0, t, 0, 1)

Finally, it is often convenient to use inhomogeneous polynomials where it is understood that one wants to homogenize them. This is also supported, just define the form with an inhomogeneous polynomial and specify one less variable:

Sage

    sage: R.<x,t> = QQ[]
    sage: invariant_theory.binary_quartic(x^4 + 1 + t*x^2, [x])
    Binary quartic with coefficients (1, 0, t, 0, 1)

Python

    >>> from sage.all import *
    >>> R = QQ['x, t']; (x, t,) = R._first_ngens(2)
    >>> invariant_theory.binary_quartic(x**Integer(4) + Integer(1) + t*x**Integer(2), [x])
    Binary quartic with coefficients (1, 0, t, 0, 1)

REFERENCES:

- Wikipedia article Glossary_of_invariant_theory

AUTHORS:

- Volker Braun (2013-01-24): initial version

- Jesper Noordsij (2018-05-18): support for binary quintics added

class sage.rings.invariants.invariant_theory.AlgebraicForm(n, d, polynomial, *args, **kwds)

  Bases: `FormsBase`

  The base class of algebraic forms (i.e. homogeneous polynomials).

  You should only instantiate the derived classes of this base class.

  Derived classes must implement `coeffs()` and `scaled_coeffs()`

  INPUT:

  - `n` – the number of variables

  - `d` – the degree of the polynomial

  - `polynomial` – the polynomial

  - `*args` – the variables, as a single list/tuple, multiple arguments, or `None` to use all variables of the polynomial

  Derived classes must implement the same arguments for the constructor.

  EXAMPLES:

  Sage

      sage: from sage.rings.invariants.invariant_theory import AlgebraicForm
      sage: R.<x,y> = QQ[]
      sage: p = x^2 + y^2
      sage: AlgebraicForm(2, 2, p).variables()
      (x, y)
      sage: AlgebraicForm(2, 2, p, None).variables()
      (x, y)
      sage: AlgebraicForm(3, 2, p).variables()
      (x, y, None)
      sage: AlgebraicForm(3, 2, p, None).variables()
      (x, y, None)

      sage: from sage.rings.invariants.invariant_theory import AlgebraicForm
      sage: R.<x,y,s,t> = QQ[]
      sage: p = s*x^2 + t*y^2
      sage: AlgebraicForm(2, 2, p, [x,y]).variables()
      (x, y)
      sage: AlgebraicForm(2, 2, p, x,y).variables()
      (x, y)

      sage: AlgebraicForm(3, 2, p, [x,y,None]).variables()
      (x, y, None)
      sage: AlgebraicForm(3, 2, p, x,y,None).variables()
      (x, y, None)

      sage: AlgebraicForm(2, 1, p, [x,y]).variables()
      Traceback (most recent call last):
      ...
      ValueError: polynomial is of the wrong degree

      sage: AlgebraicForm(2, 2, x^2 + y, [x,y]).variables()
      Traceback (most recent call last):
      ...
      ValueError: polynomial is not homogeneous

  Python

      >>> from sage.all import *
      >>> from sage.rings.invariants.invariant_theory import AlgebraicForm
      >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
      >>> p = x**Integer(2) + y**Integer(2)
      >>> AlgebraicForm(Integer(2), Integer(2), p).variables()
      (x, y)
      >>> AlgebraicForm(Integer(2), Integer(2), p, None).variables()
      (x, y)
      >>> AlgebraicForm(Integer(3), Integer(2), p).variables()
      (x, y, None)
      >>> AlgebraicForm(Integer(3), Integer(2), p, None).variables()
      (x, y, None)

      >>> from sage.rings.invariants.invariant_theory import AlgebraicForm
      >>> R = QQ['x, y, s, t']; (x, y, s, t,) = R._first_ngens(4)
      >>> p = s*x**Integer(2) + t*y**Integer(2)
      >>> AlgebraicForm(Integer(2), Integer(2), p, [x,y]).variables()
      (x, y)
      >>> AlgebraicForm(Integer(2), Integer(2), p, x,y).variables()
      (x, y)

      >>> AlgebraicForm(Integer(3), Integer(2), p, [x,y,None]).variables()
      (x, y, None)
      >>> AlgebraicForm(Integer(3), Integer(2), p, x,y,None).variables()
      (x, y, None)

      >>> AlgebraicForm(Integer(2), Integer(1), p, [x,y]).variables()
      Traceback (most recent call last):
      ...
      ValueError: polynomial is of the wrong degree

      >>> AlgebraicForm(Integer(2), Integer(2), x**Integer(2) + y, [x,y]).variables()
      Traceback (most recent call last):
      ...
      ValueError: polynomial is not homogeneous

  coefficients()

    Alias for `coeffs()`.

    See the documentation for `coeffs()` for details.

    EXAMPLES:

    Sage

        sage: R.<a,b,c,d,e,f,g, x,y,z> = QQ[]
        sage: p = a*x^2 + b*y^2 + c*z^2 + d*x*y + e*x*z + f*y*z
        sage: q = invariant_theory.quadratic_form(p, x,y,z)
        sage: q.coefficients()
        (a, b, c, d, e, f)
        sage: q.coeffs()
        (a, b, c, d, e, f)

    Python

        >>> from sage.all import *
        >>> R = QQ['a, b, c, d, e, f, g, x, y, z']; (a, b, c, d, e, f, g, x, y, z,) = R._first_ngens(10)
        >>> p = a*x**Integer(2) + b*y**Integer(2) + c*z**Integer(2) + d*x*y + e*x*z + f*y*z
        >>> q = invariant_theory.quadratic_form(p, x,y,z)
        >>> q.coefficients()
        (a, b, c, d, e, f)
        >>> q.coeffs()
        (a, b, c, d, e, f)

  form()

    Return the defining polynomial.

    OUTPUT: the polynomial used to define the algebraic form

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + y^4)
        sage: quartic.form()
        x^4 + y^4
        sage: quartic.polynomial()
        x^4 + y^4

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4))
        >>> quartic.form()
        x^4 + y^4
        >>> quartic.polynomial()
        x^4 + y^4

  homogenized(var='h')

    Return form as defined by a homogeneous polynomial.

    INPUT:

    - `var` – either a variable name, variable index or a variable (default: `'h'`)

    OUTPUT:

    The same algebraic form, but defined by a homogeneous polynomial.

    EXAMPLES:

    Sage

        sage: T.<t> = QQ[]
        sage: quadratic = invariant_theory.binary_quadratic(t^2 + 2*t + 3)
        sage: quadratic
        Binary quadratic with coefficients (1, 3, 2)
        sage: quadratic.homogenized()
        Binary quadratic with coefficients (1, 3, 2)
        sage: quadratic == quadratic.homogenized()
        True
        sage: quadratic.form()
        t^2 + 2*t + 3
        sage: quadratic.homogenized().form()
        t^2 + 2*t*h + 3*h^2

        sage: R.<x,y,z> = QQ[]
        sage: quadratic = invariant_theory.ternary_quadratic(x^2 + 1, [x,y])
        sage: quadratic.homogenized().form()
        x^2 + h^2

        sage: R.<x> = QQ[]
        sage: quintic = invariant_theory.binary_quintic(x^4 + 1, x)
        sage: quintic.homogenized().form()
        x^4*h + h^5

    Python

        >>> from sage.all import *
        >>> T = QQ['t']; (t,) = T._first_ngens(1)
        >>> quadratic = invariant_theory.binary_quadratic(t**Integer(2) + Integer(2)*t + Integer(3))
        >>> quadratic
        Binary quadratic with coefficients (1, 3, 2)
        >>> quadratic.homogenized()
        Binary quadratic with coefficients (1, 3, 2)
        >>> quadratic == quadratic.homogenized()
        True
        >>> quadratic.form()
        t^2 + 2*t + 3
        >>> quadratic.homogenized().form()
        t^2 + 2*t*h + 3*h^2

        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> quadratic = invariant_theory.ternary_quadratic(x**Integer(2) + Integer(1), [x,y])
        >>> quadratic.homogenized().form()
        x^2 + h^2

        >>> R = QQ['x']; (x,) = R._first_ngens(1)
        >>> quintic = invariant_theory.binary_quintic(x**Integer(4) + Integer(1), x)
        >>> quintic.homogenized().form()
        x^4*h + h^5

  polynomial()

    alias of `form()`.

  transformed(g)

    Return the image under a linear transformation of the variables.

    INPUT:

    - `g` – a \(GL(n,\CC)\) matrix or a dictionary with the variables as keys. A matrix is used to define the linear transformation of homogeneous variables, a dictionary acts by substitution of the variables.

    OUTPUT:

    A new instance of a subclass of `AlgebraicForm` obtained by replacing the variables of the homogeneous polynomial by their image under `g`.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + 2*y^3 + 3*z^3 + 4*x*y*z)
        sage: cubic.transformed({x: y, y: z, z: x}).form()
        3*x^3 + y^3 + 4*x*y*z + 2*z^3
        sage: cyc = matrix([[0,1,0], [0,0,1], [1,0,0]])
        sage: cubic.transformed(cyc) == cubic.transformed({x:y, y:z, z:x})
        True
        sage: g = matrix(QQ, [[1, 0, 0], [-1, 1, -3], [-5, -5, 16]])
        sage: cubic.transformed(g)
        Ternary cubic with coefficients (-356, -373, 12234, -1119, 3578, -1151,
        3582, -11766, -11466, 7360)
        sage: cubic.transformed(g).transformed(g.inverse()) == cubic
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + Integer(2)*y**Integer(3) + Integer(3)*z**Integer(3) + Integer(4)*x*y*z)
        >>> cubic.transformed({x: y, y: z, z: x}).form()
        3*x^3 + y^3 + 4*x*y*z + 2*z^3
        >>> cyc = matrix([[Integer(0),Integer(1),Integer(0)], [Integer(0),Integer(0),Integer(1)], [Integer(1),Integer(0),Integer(0)]])
        >>> cubic.transformed(cyc) == cubic.transformed({x:y, y:z, z:x})
        True
        >>> g = matrix(QQ, [[Integer(1), Integer(0), Integer(0)], [-Integer(1), Integer(1), -Integer(3)], [-Integer(5), -Integer(5), Integer(16)]])
        >>> cubic.transformed(g)
        Ternary cubic with coefficients (-356, -373, 12234, -1119, 3578, -1151,
        3582, -11766, -11466, 7360)
        >>> cubic.transformed(g).transformed(g.inverse()) == cubic
        True

class sage.rings.invariants.invariant_theory.BinaryQuartic(n, d, polynomial, *args)

  Bases: `AlgebraicForm`

  Invariant theory of a binary quartic.

  You should use the `invariant_theory` factory object to construct instances of this class. See `binary_quartic()` for details.

  EisensteinD()

    One of the Eisenstein invariants of a binary quartic.

    OUTPUT: the Eisenstein D-invariant of the quartic

    \[\begin{split}f(x) = a_0 x_1^4 + 4 a_1 x_0 x_1^3 + 6 a_2 x_0^2 x_1^2 + 4 a_3 x_0^3 x_1 + a_4 x_0^4 \\ \Rightarrow D(f) = a_0 a_4+3 a_2^2-4 a_1 a_3\end{split}\]

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, x0, x1> = QQ[]
        sage: f = a0*x1^4 + 4*a1*x0*x1^3 + 6*a2*x0^2*x1^2 + 4*a3*x0^3*x1 + a4*x0^4
        sage: inv = invariant_theory.binary_quartic(f, x0, x1)
        sage: inv.EisensteinD()
        3*a2^2 - 4*a1*a3 + a0*a4

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, x0, x1']; (a0, a1, a2, a3, a4, x0, x1,) = R._first_ngens(7)
        >>> f = a0*x1**Integer(4) + Integer(4)*a1*x0*x1**Integer(3) + Integer(6)*a2*x0**Integer(2)*x1**Integer(2) + Integer(4)*a3*x0**Integer(3)*x1 + a4*x0**Integer(4)
        >>> inv = invariant_theory.binary_quartic(f, x0, x1)
        >>> inv.EisensteinD()
        3*a2^2 - 4*a1*a3 + a0*a4

  EisensteinE()

    One of the Eisenstein invariants of a binary quartic.

    OUTPUT: the Eisenstein E-invariant of the quartic

    \[\begin{split}f(x) = a_0 x_1^4 + 4 a_1 x_0 x_1^3 + 6 a_2 x_0^2 x_1^2 + 4 a_3 x_0^3 x_1 + a_4 x_0^4 \\ \Rightarrow E(f) = a_0 a_3^2 +a_1^2 a_4 -a_0 a_2 a_4 -2 a_1 a_2 a_3 + a_2^3\end{split}\]

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, x0, x1> = QQ[]
        sage: f = a0*x1^4 + 4*a1*x0*x1^3 + 6*a2*x0^2*x1^2 + 4*a3*x0^3*x1 + a4*x0^4
        sage: inv = invariant_theory.binary_quartic(f, x0, x1)
        sage: inv.EisensteinE()
        a2^3 - 2*a1*a2*a3 + a0*a3^2 + a1^2*a4 - a0*a2*a4

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, x0, x1']; (a0, a1, a2, a3, a4, x0, x1,) = R._first_ngens(7)
        >>> f = a0*x1**Integer(4) + Integer(4)*a1*x0*x1**Integer(3) + Integer(6)*a2*x0**Integer(2)*x1**Integer(2) + Integer(4)*a3*x0**Integer(3)*x1 + a4*x0**Integer(4)
        >>> inv = invariant_theory.binary_quartic(f, x0, x1)
        >>> inv.EisensteinE()
        a2^3 - 2*a1*a2*a3 + a0*a3^2 + a1^2*a4 - a0*a2*a4

  coeffs()

    The coefficients of a binary quartic.

    Given

    \[f(x) = a_0 x_1^4 + a_1 x_0 x_1^3 + a_2 x_0^2 x_1^2 + a_3 x_0^3 x_1 + a_4 x_0^4\]

    this function returns \(a = (a_0, a_1, a_2, a_3, a_4)\)

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, x0, x1> = QQ[]
        sage: p = a0*x1^4 + a1*x1^3*x0 + a2*x1^2*x0^2 + a3*x1*x0^3 + a4*x0^4
        sage: quartic = invariant_theory.binary_quartic(p, x0, x1)
        sage: quartic.coeffs()
        (a0, a1, a2, a3, a4)

        sage: R.<a0, a1, a2, a3, a4, x> = QQ[]
        sage: p = a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4
        sage: quartic = invariant_theory.binary_quartic(p, x)
        sage: quartic.coeffs()
        (a0, a1, a2, a3, a4)

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, x0, x1']; (a0, a1, a2, a3, a4, x0, x1,) = R._first_ngens(7)
        >>> p = a0*x1**Integer(4) + a1*x1**Integer(3)*x0 + a2*x1**Integer(2)*x0**Integer(2) + a3*x1*x0**Integer(3) + a4*x0**Integer(4)
        >>> quartic = invariant_theory.binary_quartic(p, x0, x1)
        >>> quartic.coeffs()
        (a0, a1, a2, a3, a4)

        >>> R = QQ['a0, a1, a2, a3, a4, x']; (a0, a1, a2, a3, a4, x,) = R._first_ngens(6)
        >>> p = a0 + a1*x + a2*x**Integer(2) + a3*x**Integer(3) + a4*x**Integer(4)
        >>> quartic = invariant_theory.binary_quartic(p, x)
        >>> quartic.coeffs()
        (a0, a1, a2, a3, a4)

  g_covariant()

    The g-covariant of a binary quartic.

    OUTPUT: the g-covariant of the quartic

    \[\begin{split}f(x) = a_0 x_1^4 + 4 a_1 x_0 x_1^3 + 6 a_2 x_0^2 x_1^2 + 4 a_3 x_0^3 x_1 + a_4 x_0^4 \\ \Rightarrow D(f) = \frac{1}{144} \begin{pmatrix} \frac{\partial^2 f}{\partial x \partial x} \end{pmatrix}\end{split}\]

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, x, y> = QQ[]
        sage: p = a0*x^4 + 4*a1*x^3*y + 6*a2*x^2*y^2 + 4*a3*x*y^3 + a4*y^4
        sage: inv = invariant_theory.binary_quartic(p, x, y)
        sage: g = inv.g_covariant();  g
        a1^2*x^4 - a0*a2*x^4 + 2*a1*a2*x^3*y - 2*a0*a3*x^3*y + 3*a2^2*x^2*y^2
        - 2*a1*a3*x^2*y^2 - a0*a4*x^2*y^2 + 2*a2*a3*x*y^3
        - 2*a1*a4*x*y^3 + a3^2*y^4 - a2*a4*y^4

        sage: inv_inhomogeneous = invariant_theory.binary_quartic(p.subs(y=1), x)
        sage: inv_inhomogeneous.g_covariant()
        a1^2*x^4 - a0*a2*x^4 + 2*a1*a2*x^3 - 2*a0*a3*x^3 + 3*a2^2*x^2
        - 2*a1*a3*x^2 - a0*a4*x^2 + 2*a2*a3*x - 2*a1*a4*x + a3^2 - a2*a4

        sage: g == 1/144 * (p.derivative(x,y)^2 - p.derivative(x,x)*p.derivative(y,y))
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, x, y']; (a0, a1, a2, a3, a4, x, y,) = R._first_ngens(7)
        >>> p = a0*x**Integer(4) + Integer(4)*a1*x**Integer(3)*y + Integer(6)*a2*x**Integer(2)*y**Integer(2) + Integer(4)*a3*x*y**Integer(3) + a4*y**Integer(4)
        >>> inv = invariant_theory.binary_quartic(p, x, y)
        >>> g = inv.g_covariant();  g
        a1^2*x^4 - a0*a2*x^4 + 2*a1*a2*x^3*y - 2*a0*a3*x^3*y + 3*a2^2*x^2*y^2
        - 2*a1*a3*x^2*y^2 - a0*a4*x^2*y^2 + 2*a2*a3*x*y^3
        - 2*a1*a4*x*y^3 + a3^2*y^4 - a2*a4*y^4

        >>> inv_inhomogeneous = invariant_theory.binary_quartic(p.subs(y=Integer(1)), x)
        >>> inv_inhomogeneous.g_covariant()
        a1^2*x^4 - a0*a2*x^4 + 2*a1*a2*x^3 - 2*a0*a3*x^3 + 3*a2^2*x^2
        - 2*a1*a3*x^2 - a0*a4*x^2 + 2*a2*a3*x - 2*a1*a4*x + a3^2 - a2*a4

        >>> g == Integer(1)/Integer(144) * (p.derivative(x,y)**Integer(2) - p.derivative(x,x)*p.derivative(y,y))
        True

  h_covariant()

    The h-covariant of a binary quartic.

    OUTPUT: the h-covariant of the quartic

    \[\begin{split}f(x) = a_0 x_1^4 + 4 a_1 x_0 x_1^3 + 6 a_2 x_0^2 x_1^2 + 4 a_3 x_0^3 x_1 + a_4 x_0^4 \\ \Rightarrow D(f) = \frac{1}{144} \begin{pmatrix} \frac{\partial^2 f}{\partial x \partial x} \end{pmatrix}\end{split}\]

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, x, y> = QQ[]
        sage: p = a0*x^4 + 4*a1*x^3*y + 6*a2*x^2*y^2 + 4*a3*x*y^3 + a4*y^4
        sage: inv = invariant_theory.binary_quartic(p, x, y)
        sage: h = inv.h_covariant();   h
        -2*a1^3*x^6 + 3*a0*a1*a2*x^6 - a0^2*a3*x^6 - 6*a1^2*a2*x^5*y + 9*a0*a2^2*x^5*y
        - 2*a0*a1*a3*x^5*y - a0^2*a4*x^5*y - 10*a1^2*a3*x^4*y^2 + 15*a0*a2*a3*x^4*y^2
        - 5*a0*a1*a4*x^4*y^2 + 10*a0*a3^2*x^3*y^3 - 10*a1^2*a4*x^3*y^3
        + 10*a1*a3^2*x^2*y^4 - 15*a1*a2*a4*x^2*y^4 + 5*a0*a3*a4*x^2*y^4
        + 6*a2*a3^2*x*y^5 - 9*a2^2*a4*x*y^5 + 2*a1*a3*a4*x*y^5 + a0*a4^2*x*y^5
        + 2*a3^3*y^6 - 3*a2*a3*a4*y^6 + a1*a4^2*y^6

        sage: inv_inhomogeneous = invariant_theory.binary_quartic(p.subs(y=1), x)
        sage: inv_inhomogeneous.h_covariant()
        -2*a1^3*x^6 + 3*a0*a1*a2*x^6 - a0^2*a3*x^6 - 6*a1^2*a2*x^5 + 9*a0*a2^2*x^5
        - 2*a0*a1*a3*x^5 - a0^2*a4*x^5 - 10*a1^2*a3*x^4 + 15*a0*a2*a3*x^4
        - 5*a0*a1*a4*x^4 + 10*a0*a3^2*x^3 - 10*a1^2*a4*x^3 + 10*a1*a3^2*x^2
        - 15*a1*a2*a4*x^2 + 5*a0*a3*a4*x^2 + 6*a2*a3^2*x - 9*a2^2*a4*x
        + 2*a1*a3*a4*x + a0*a4^2*x + 2*a3^3 - 3*a2*a3*a4 + a1*a4^2

        sage: g = inv.g_covariant()
        sage: h == 1/8 * (p.derivative(x)*g.derivative(y) - p.derivative(y)*g.derivative(x))
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, x, y']; (a0, a1, a2, a3, a4, x, y,) = R._first_ngens(7)
        >>> p = a0*x**Integer(4) + Integer(4)*a1*x**Integer(3)*y + Integer(6)*a2*x**Integer(2)*y**Integer(2) + Integer(4)*a3*x*y**Integer(3) + a4*y**Integer(4)
        >>> inv = invariant_theory.binary_quartic(p, x, y)
        >>> h = inv.h_covariant();   h
        -2*a1^3*x^6 + 3*a0*a1*a2*x^6 - a0^2*a3*x^6 - 6*a1^2*a2*x^5*y + 9*a0*a2^2*x^5*y
        - 2*a0*a1*a3*x^5*y - a0^2*a4*x^5*y - 10*a1^2*a3*x^4*y^2 + 15*a0*a2*a3*x^4*y^2
        - 5*a0*a1*a4*x^4*y^2 + 10*a0*a3^2*x^3*y^3 - 10*a1^2*a4*x^3*y^3
        + 10*a1*a3^2*x^2*y^4 - 15*a1*a2*a4*x^2*y^4 + 5*a0*a3*a4*x^2*y^4
        + 6*a2*a3^2*x*y^5 - 9*a2^2*a4*x*y^5 + 2*a1*a3*a4*x*y^5 + a0*a4^2*x*y^5
        + 2*a3^3*y^6 - 3*a2*a3*a4*y^6 + a1*a4^2*y^6

        >>> inv_inhomogeneous = invariant_theory.binary_quartic(p.subs(y=Integer(1)), x)
        >>> inv_inhomogeneous.h_covariant()
        -2*a1^3*x^6 + 3*a0*a1*a2*x^6 - a0^2*a3*x^6 - 6*a1^2*a2*x^5 + 9*a0*a2^2*x^5
        - 2*a0*a1*a3*x^5 - a0^2*a4*x^5 - 10*a1^2*a3*x^4 + 15*a0*a2*a3*x^4
        - 5*a0*a1*a4*x^4 + 10*a0*a3^2*x^3 - 10*a1^2*a4*x^3 + 10*a1*a3^2*x^2
        - 15*a1*a2*a4*x^2 + 5*a0*a3*a4*x^2 + 6*a2*a3^2*x - 9*a2^2*a4*x
        + 2*a1*a3*a4*x + a0*a4^2*x + 2*a3^3 - 3*a2*a3*a4 + a1*a4^2

        >>> g = inv.g_covariant()
        >>> h == Integer(1)/Integer(8) * (p.derivative(x)*g.derivative(y) - p.derivative(y)*g.derivative(x))
        True

  monomials()

    List the basis monomials in the form.

    OUTPUT:

    A tuple of monomials. They are in the same order as `coeffs()`.

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + y^4)
        sage: quartic.monomials()
        (y^4, x*y^3, x^2*y^2, x^3*y, x^4)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4))
        >>> quartic.monomials()
        (y^4, x*y^3, x^2*y^2, x^3*y, x^4)

  scaled_coeffs()

    The coefficients of a binary quartic.

    Given

    \[f(x) = a_0 x_1^4 + 4 a_1 x_0 x_1^3 + 6 a_2 x_0^2 x_1^2 + 4 a_3 x_0^3 x_1 + a_4 x_0^4\]

    this function returns \(a = (a_0, a_1, a_2, a_3, a_4)\)

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, x0, x1> = QQ[]
        sage: quartic = a0*x1^4 + 4*a1*x1^3*x0 + 6*a2*x1^2*x0^2 + 4*a3*x1*x0^3 + a4*x0^4
        sage: inv = invariant_theory.binary_quartic(quartic, x0, x1)
        sage: inv.scaled_coeffs()
        (a0, a1, a2, a3, a4)

        sage: R.<a0, a1, a2, a3, a4, x> = QQ[]
        sage: quartic = a0 + 4*a1*x + 6*a2*x^2 + 4*a3*x^3 + a4*x^4
        sage: inv = invariant_theory.binary_quartic(quartic, x)
        sage: inv.scaled_coeffs()
        (a0, a1, a2, a3, a4)

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, x0, x1']; (a0, a1, a2, a3, a4, x0, x1,) = R._first_ngens(7)
        >>> quartic = a0*x1**Integer(4) + Integer(4)*a1*x1**Integer(3)*x0 + Integer(6)*a2*x1**Integer(2)*x0**Integer(2) + Integer(4)*a3*x1*x0**Integer(3) + a4*x0**Integer(4)
        >>> inv = invariant_theory.binary_quartic(quartic, x0, x1)
        >>> inv.scaled_coeffs()
        (a0, a1, a2, a3, a4)

        >>> R = QQ['a0, a1, a2, a3, a4, x']; (a0, a1, a2, a3, a4, x,) = R._first_ngens(6)
        >>> quartic = a0 + Integer(4)*a1*x + Integer(6)*a2*x**Integer(2) + Integer(4)*a3*x**Integer(3) + a4*x**Integer(4)
        >>> inv = invariant_theory.binary_quartic(quartic, x)
        >>> inv.scaled_coeffs()
        (a0, a1, a2, a3, a4)

class sage.rings.invariants.invariant_theory.BinaryQuintic(n, d, polynomial, *args)

  Bases: `AlgebraicForm`

  Invariant theory of a binary quintic form.

  You should use the `invariant_theory` factory object to construct instances of this class. See `binary_quintic()` for details.

  REFERENCES:

  For a description of all invariants and covariants of a binary quintic, see section 73 of [Cle1872].

  A_invariant()

    Return the invariant \(A\) of a binary quintic.

    OUTPUT: the \(A\)-invariant of the binary quintic

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.A_invariant()
        4/625*a2^2*a3^2 - 12/625*a1*a3^3 - 12/625*a2^3*a4
        + 38/625*a1*a2*a3*a4 + 6/125*a0*a3^2*a4 - 18/625*a1^2*a4^2
        - 16/125*a0*a2*a4^2 + 6/125*a1*a2^2*a5 - 16/125*a1^2*a3*a5
        - 2/25*a0*a2*a3*a5 + 4/5*a0*a1*a4*a5 - 2*a0^2*a5^2

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.A_invariant()
        4/625*a2^2*a3^2 - 12/625*a1*a3^3 - 12/625*a2^3*a4
        + 38/625*a1*a2*a3*a4 + 6/125*a0*a3^2*a4 - 18/625*a1^2*a4^2
        - 16/125*a0*a2*a4^2 + 6/125*a1*a2^2*a5 - 16/125*a1^2*a3*a5
        - 2/25*a0*a2*a3*a5 + 4/5*a0*a1*a4*a5 - 2*a0^2*a5^2

  B_invariant()

    Return the invariant \(B\) of a binary quintic.

    OUTPUT: the \(B\)-invariant of the binary quintic

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.B_invariant()
        1/1562500*a2^4*a3^4 - 3/781250*a1*a2^2*a3^5 + 9/1562500*a1^2*a3^6
        - 3/781250*a2^5*a3^2*a4 + 37/1562500*a1*a2^3*a3^3*a4
        - 57/1562500*a1^2*a2*a3^4*a4 + 3/312500*a0*a2^2*a3^4*a4
        ...
        + 8/625*a0^2*a1^2*a4^2*a5^2 - 4/125*a0^3*a2*a4^2*a5^2 - 16/3125*a1^5*a5^3
        + 4/125*a0*a1^3*a2*a5^3 - 6/125*a0^2*a1*a2^2*a5^3
        - 4/125*a0^2*a1^2*a3*a5^3 + 2/25*a0^3*a2*a3*a5^3

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.B_invariant()
        1/1562500*a2^4*a3^4 - 3/781250*a1*a2^2*a3^5 + 9/1562500*a1^2*a3^6
        - 3/781250*a2^5*a3^2*a4 + 37/1562500*a1*a2^3*a3^3*a4
        - 57/1562500*a1^2*a2*a3^4*a4 + 3/312500*a0*a2^2*a3^4*a4
        ...
        + 8/625*a0^2*a1^2*a4^2*a5^2 - 4/125*a0^3*a2*a4^2*a5^2 - 16/3125*a1^5*a5^3
        + 4/125*a0*a1^3*a2*a5^3 - 6/125*a0^2*a1*a2^2*a5^3
        - 4/125*a0^2*a1^2*a3*a5^3 + 2/25*a0^3*a2*a3*a5^3

  C_invariant()

    Return the invariant \(C\) of a binary quintic.

    OUTPUT: the \(C\)-invariant of the binary quintic

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.C_invariant()
        -3/1953125000*a2^6*a3^6 + 27/1953125000*a1*a2^4*a3^7
        - 249/7812500000*a1^2*a2^2*a3^8 - 3/78125000*a0*a2^3*a3^8
        + 3/976562500*a1^3*a3^9 + 27/156250000*a0*a1*a2*a3^9
        ...
        + 192/15625*a0^2*a1^3*a2^2*a3*a5^4 - 36/3125*a0^3*a1*a2^3*a3*a5^4
        + 24/15625*a0^2*a1^4*a3^2*a5^4 - 24/3125*a0^3*a1^2*a2*a3^2*a5^4
        + 6/625*a0^4*a2^2*a3^2*a5^4

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.C_invariant()
        -3/1953125000*a2^6*a3^6 + 27/1953125000*a1*a2^4*a3^7
        - 249/7812500000*a1^2*a2^2*a3^8 - 3/78125000*a0*a2^3*a3^8
        + 3/976562500*a1^3*a3^9 + 27/156250000*a0*a1*a2*a3^9
        ...
        + 192/15625*a0^2*a1^3*a2^2*a3*a5^4 - 36/3125*a0^3*a1*a2^3*a3*a5^4
        + 24/15625*a0^2*a1^4*a3^2*a5^4 - 24/3125*a0^3*a1^2*a2*a3^2*a5^4
        + 6/625*a0^4*a2^2*a3^2*a5^4

  H_covariant(as_form=False)

    Return the covariant \(H\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT: the \(H\)-covariant of the binary quintic as polynomial or as binary form

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.H_covariant()
        -2/25*a4^2*x0^6 + 1/5*a3*a5*x0^6 - 3/25*a3*a4*x0^5*x1
        + 3/5*a2*a5*x0^5*x1 - 3/25*a3^2*x0^4*x1^2 + 3/25*a2*a4*x0^4*x1^2
        + 6/5*a1*a5*x0^4*x1^2 - 4/25*a2*a3*x0^3*x1^3 + 14/25*a1*a4*x0^3*x1^3
        + 2*a0*a5*x0^3*x1^3 - 3/25*a2^2*x0^2*x1^4 + 3/25*a1*a3*x0^2*x1^4
        + 6/5*a0*a4*x0^2*x1^4 - 3/25*a1*a2*x0*x1^5 + 3/5*a0*a3*x0*x1^5
        - 2/25*a1^2*x1^6 + 1/5*a0*a2*x1^6

        sage: quintic.H_covariant(as_form=True)
        Binary sextic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.H_covariant()
        -2/25*a4^2*x0^6 + 1/5*a3*a5*x0^6 - 3/25*a3*a4*x0^5*x1
        + 3/5*a2*a5*x0^5*x1 - 3/25*a3^2*x0^4*x1^2 + 3/25*a2*a4*x0^4*x1^2
        + 6/5*a1*a5*x0^4*x1^2 - 4/25*a2*a3*x0^3*x1^3 + 14/25*a1*a4*x0^3*x1^3
        + 2*a0*a5*x0^3*x1^3 - 3/25*a2^2*x0^2*x1^4 + 3/25*a1*a3*x0^2*x1^4
        + 6/5*a0*a4*x0^2*x1^4 - 3/25*a1*a2*x0*x1^5 + 3/5*a0*a3*x0*x1^5
        - 2/25*a1^2*x1^6 + 1/5*a0*a2*x1^6

        >>> quintic.H_covariant(as_form=True)
        Binary sextic given by ...

  R_invariant()

    Return the invariant \(R\) of a binary quintic.

    OUTPUT: the \(R\)-invariant of the binary quintic

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.R_invariant()
        3/3906250000000*a1^2*a2^5*a3^11 - 3/976562500000*a0*a2^6*a3^11
        - 51/7812500000000*a1^3*a2^3*a3^12 + 27/976562500000*a0*a1*a2^4*a3^12
        + 27/1953125000000*a1^4*a2*a3^13 - 81/1562500000000*a0*a1^2*a2^2*a3^13
        ...
        + 384/9765625*a0*a1^10*a5^7 - 192/390625*a0^2*a1^8*a2*a5^7
        + 192/78125*a0^3*a1^6*a2^2*a5^7 - 96/15625*a0^4*a1^4*a2^3*a5^7
        + 24/3125*a0^5*a1^2*a2^4*a5^7 - 12/3125*a0^6*a2^5*a5^7

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.R_invariant()
        3/3906250000000*a1^2*a2^5*a3^11 - 3/976562500000*a0*a2^6*a3^11
        - 51/7812500000000*a1^3*a2^3*a3^12 + 27/976562500000*a0*a1*a2^4*a3^12
        + 27/1953125000000*a1^4*a2*a3^13 - 81/1562500000000*a0*a1^2*a2^2*a3^13
        ...
        + 384/9765625*a0*a1^10*a5^7 - 192/390625*a0^2*a1^8*a2*a5^7
        + 192/78125*a0^3*a1^6*a2^2*a5^7 - 96/15625*a0^4*a1^4*a2^3*a5^7
        + 24/3125*a0^5*a1^2*a2^4*a5^7 - 12/3125*a0^6*a2^5*a5^7

  T_covariant(as_form=False)

    Return the covariant \(T\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT: the \(T\)-covariant of the binary quintic as polynomial or as binary form

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.T_covariant()
        2/125*a4^3*x0^9 - 3/50*a3*a4*a5*x0^9 + 1/10*a2*a5^2*x0^9
        + 9/250*a3*a4^2*x0^8*x1 - 3/25*a3^2*a5*x0^8*x1 + 1/50*a2*a4*a5*x0^8*x1
        + 2/5*a1*a5^2*x0^8*x1 + 3/250*a3^2*a4*x0^7*x1^2 + 8/125*a2*a4^2*x0^7*x1^2
        ...
        11/25*a0*a1*a4*x0^2*x1^7 - a0^2*a5*x0^2*x1^7 - 9/250*a1^2*a2*x0*x1^8
        + 3/25*a0*a2^2*x0*x1^8 - 1/50*a0*a1*a3*x0*x1^8 - 2/5*a0^2*a4*x0*x1^8
        - 2/125*a1^3*x1^9 + 3/50*a0*a1*a2*x1^9 - 1/10*a0^2*a3*x1^9

        sage: quintic.T_covariant(as_form=True)
        Binary nonic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.T_covariant()
        2/125*a4^3*x0^9 - 3/50*a3*a4*a5*x0^9 + 1/10*a2*a5^2*x0^9
        + 9/250*a3*a4^2*x0^8*x1 - 3/25*a3^2*a5*x0^8*x1 + 1/50*a2*a4*a5*x0^8*x1
        + 2/5*a1*a5^2*x0^8*x1 + 3/250*a3^2*a4*x0^7*x1^2 + 8/125*a2*a4^2*x0^7*x1^2
        ...
        11/25*a0*a1*a4*x0^2*x1^7 - a0^2*a5*x0^2*x1^7 - 9/250*a1^2*a2*x0*x1^8
        + 3/25*a0*a2^2*x0*x1^8 - 1/50*a0*a1*a3*x0*x1^8 - 2/5*a0^2*a4*x0*x1^8
        - 2/125*a1^3*x1^9 + 3/50*a0*a1*a2*x1^9 - 1/10*a0^2*a3*x1^9

        >>> quintic.T_covariant(as_form=True)
        Binary nonic given by ...

  alpha_covariant(as_form=False)

    Return the covariant \(\alpha\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT:

    The \(\alpha\)-covariant of the binary quintic as polynomial or as binary form.

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.alpha_covariant()
        1/2500*a2^2*a3^3*x0 - 3/2500*a1*a3^4*x0 - 1/625*a2^3*a3*a4*x0
        + 3/625*a1*a2*a3^2*a4*x0 + 3/625*a0*a3^3*a4*x0 + 2/625*a1*a2^2*a4^2*x0
        - 6/625*a1^2*a3*a4^2*x0 - 12/625*a0*a2*a3*a4^2*x0 + 24/625*a0*a1*a4^3*x0
        ...
        - 12/625*a1^2*a2*a3*a5*x1 - 1/125*a0*a2^2*a3*a5*x1
        + 8/125*a0*a1*a3^2*a5*x1 + 24/625*a1^3*a4*a5*x1 - 8/125*a0*a1*a2*a4*a5*x1
        - 4/25*a0^2*a3*a4*a5*x1 - 4/25*a0*a1^2*a5^2*x1 + 2/5*a0^2*a2*a5^2*x1

        sage: quintic.alpha_covariant(as_form=True)
        Binary monic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.alpha_covariant()
        1/2500*a2^2*a3^3*x0 - 3/2500*a1*a3^4*x0 - 1/625*a2^3*a3*a4*x0
        + 3/625*a1*a2*a3^2*a4*x0 + 3/625*a0*a3^3*a4*x0 + 2/625*a1*a2^2*a4^2*x0
        - 6/625*a1^2*a3*a4^2*x0 - 12/625*a0*a2*a3*a4^2*x0 + 24/625*a0*a1*a4^3*x0
        ...
        - 12/625*a1^2*a2*a3*a5*x1 - 1/125*a0*a2^2*a3*a5*x1
        + 8/125*a0*a1*a3^2*a5*x1 + 24/625*a1^3*a4*a5*x1 - 8/125*a0*a1*a2*a4*a5*x1
        - 4/25*a0^2*a3*a4*a5*x1 - 4/25*a0*a1^2*a5^2*x1 + 2/5*a0^2*a2*a5^2*x1

        >>> quintic.alpha_covariant(as_form=True)
        Binary monic given by ...

  arithmetic_invariants()

    Return a set of generating arithmetic invariants of a binary quintic.

    An arithmetic invariants is an invariant whose coefficients are integers for a general binary quintic. They are linear combinations of the Clebsch invariants, such that they still generate the ring of invariants.

    OUTPUT: the arithmetic invariants of the binary quintic. They are given by

    \[\begin{split}\begin{aligned} I_4 & = 2^{-1} \cdot 5^4 \cdot A \\ I_8 & = 5^5 \cdot (2^{-1} \cdot 47 \cdot A^2 - 2^2 \cdot B) \\ I_{12} & = 5^{10} \cdot (2^{-1} \cdot 3 \cdot A^3 - 2^5 \cdot 3^{-1} \cdot C) \\ I_{18} & = 2^8 \cdot 3^{-1} \cdot 5^{15} \cdot R \\ \end{aligned}\end{split}\]

    where \(A\), \(B\), \(C\) and \(R\) are the `BinaryQuintic.clebsch_invariants()`.

    EXAMPLES:

    Sage

        sage: R.<x0, x1> = QQ[]
        sage: p = 2*x1^5 + 4*x1^4*x0 + 5*x1^3*x0^2 + 7*x1^2*x0^3 - 11*x1*x0^4 + x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.arithmetic_invariants()
        {'I12': -1156502613073152,
         'I18': -12712872348048797642752,
         'I4': -138016,
         'I8': 14164936192}

    Python

        >>> from sage.all import *
        >>> R = QQ['x0, x1']; (x0, x1,) = R._first_ngens(2)
        >>> p = Integer(2)*x1**Integer(5) + Integer(4)*x1**Integer(4)*x0 + Integer(5)*x1**Integer(3)*x0**Integer(2) + Integer(7)*x1**Integer(2)*x0**Integer(3) - Integer(11)*x1*x0**Integer(4) + x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.arithmetic_invariants()
        {'I12': -1156502613073152,
         'I18': -12712872348048797642752,
         'I4': -138016,
         'I8': 14164936192}

    We can check that the coefficients of the invariants have no common divisor for a general quintic form:

    Sage

        sage: R.<a0,a1,a2,a3,a4,a5,x0,x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: invs = quintic.arithmetic_invariants()
        sage: [invs[x].content() for x in invs]
        [1, 1, 1, 1]

    [Python]

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> invs = quintic.arithmetic_invariants()
        >>> [invs[x].content() for x in invs]
        [1, 1, 1, 1]

  beta_covariant(as_form=False)

    Return the covariant \(\beta\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT:

    The \(\beta\)-covariant of the binary quintic as polynomial or as binary form.

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.beta_covariant()
        -1/62500*a2^3*a3^4*x0 + 9/125000*a1*a2*a3^5*x0 - 27/125000*a0*a3^6*x0
        + 13/125000*a2^4*a3^2*a4*x0 - 31/62500*a1*a2^2*a3^3*a4*x0
        - 3/62500*a1^2*a3^4*a4*x0 + 27/15625*a0*a2*a3^4*a4*x0
        ...
        - 16/125*a0^2*a1*a3^2*a5^2*x1 - 28/625*a0*a1^3*a4*a5^2*x1
        + 6/125*a0^2*a1*a2*a4*a5^2*x1 + 8/25*a0^3*a3*a4*a5^2*x1
        + 4/25*a0^2*a1^2*a5^3*x1 - 2/5*a0^3*a2*a5^3*x1

        sage: quintic.beta_covariant(as_form=True)
        Binary monic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.beta_covariant()
        -1/62500*a2^3*a3^4*x0 + 9/125000*a1*a2*a3^5*x0 - 27/125000*a0*a3^6*x0
        + 13/125000*a2^4*a3^2*a4*x0 - 31/62500*a1*a2^2*a3^3*a4*x0
        - 3/62500*a1^2*a3^4*a4*x0 + 27/15625*a0*a2*a3^4*a4*x0
        ...
        - 16/125*a0^2*a1*a3^2*a5^2*x1 - 28/625*a0*a1^3*a4*a5^2*x1
        + 6/125*a0^2*a1*a2*a4*a5^2*x1 + 8/25*a0^3*a3*a4*a5^2*x1
        + 4/25*a0^2*a1^2*a5^3*x1 - 2/5*a0^3*a2*a5^3*x1

        >>> quintic.beta_covariant(as_form=True)
        Binary monic given by ...

  canonical_form(reduce_gcd=False)

    Return a canonical representative of the quintic.

    Given a binary quintic \(f\) with coefficients in a field \(K\), returns a canonical representative of the \(GL(2,\bar{K})\)-orbit of the quintic, where \(\bar{K}\) is an algebraic closure of \(K\). This means that two binary quintics \(f\) and \(g\) are \(GL(2,\bar{K})\)-equivalent if and only if their canonical forms are the same.

    INPUT:

    - `reduce_gcd` – if set to `True`, then a variant of this canonical form is computed where the coefficients are coprime integers. The obtained form is then unique up to multiplication by a unit. See also `binary_quintic_from_invariants()`’.

    OUTPUT:

    A canonical \(GL(2,\bar{K})\)-equivalent binary quintic.

    EXAMPLES:

    Sage

        sage: R.<x0, x1> = QQ[]
        sage: p = 2*x1^5 + 4*x1^4*x0 + 5*x1^3*x0^2 + 7*x1^2*x0^3 - 11*x1*x0^4 + x0^5
        sage: f = invariant_theory.binary_quintic(p, x0, x1)
        sage: g = matrix(QQ, [[11,5],[7,2]])
        sage: gf = f.transformed(g)
        sage: f.canonical_form() == gf.canonical_form()
        True
        sage: h = f.canonical_form(reduce_gcd=True)
        sage: gcd(h.coeffs())
        1

    Python

        >>> from sage.all import *
        >>> R = QQ['x0, x1']; (x0, x1,) = R._first_ngens(2)
        >>> p = Integer(2)*x1**Integer(5) + Integer(4)*x1**Integer(4)*x0 + Integer(5)*x1**Integer(3)*x0**Integer(2) + Integer(7)*x1**Integer(2)*x0**Integer(3) - Integer(11)*x1*x0**Integer(4) + x0**Integer(5)
        >>> f = invariant_theory.binary_quintic(p, x0, x1)
        >>> g = matrix(QQ, [[Integer(11),Integer(5)],[Integer(7),Integer(2)]])
        >>> gf = f.transformed(g)
        >>> f.canonical_form() == gf.canonical_form()
        True
        >>> h = f.canonical_form(reduce_gcd=True)
        >>> gcd(h.coeffs())
        1

  clebsch_invariants(as_tuple=False)

    Return the invariants of a binary quintic as described by Clebsch.

    The following invariants are returned: \(A\), \(B\), \(C\) and \(R\).

    OUTPUT: the Clebsch invariants of the binary quintic

    EXAMPLES:

    Sage

        sage: R.<x0, x1> = QQ[]
        sage: p = 2*x1^5 + 4*x1^4*x0 + 5*x1^3*x0^2 + 7*x1^2*x0^3 - 11*x1*x0^4 + x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.clebsch_invariants()
        {'A': -276032/625,
         'B': 4983526016/390625,
         'C': -247056495846408/244140625,
         'R': -148978972828696847376/30517578125}

        sage: quintic.clebsch_invariants(as_tuple=True)
        (-276032/625,
         4983526016/390625,
         -247056495846408/244140625,
         -148978972828696847376/30517578125)

    Python

        >>> from sage.all import *
        >>> R = QQ['x0, x1']; (x0, x1,) = R._first_ngens(2)
        >>> p = Integer(2)*x1**Integer(5) + Integer(4)*x1**Integer(4)*x0 + Integer(5)*x1**Integer(3)*x0**Integer(2) + Integer(7)*x1**Integer(2)*x0**Integer(3) - Integer(11)*x1*x0**Integer(4) + x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.clebsch_invariants()
        {'A': -276032/625,
         'B': 4983526016/390625,
         'C': -247056495846408/244140625,
         'R': -148978972828696847376/30517578125}

        >>> quintic.clebsch_invariants(as_tuple=True)
        (-276032/625,
         4983526016/390625,
         -247056495846408/244140625,
         -148978972828696847376/30517578125)

  coeffs()

    The coefficients of a binary quintic.

    Given

    \[f(x) = a_0 x_1^5 + a_1 x_0 x_1^4 + a_2 x_0^2 x_1^3 + a_3 x_0^3 x_1^2 + a_4 x_0^4 x_1 + a_5 x_1^5\]

    this function returns \(a = (a_0, a_1, a_2, a_3, a_4, a_5)\)

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.coeffs()
        (a0, a1, a2, a3, a4, a5)

        sage: R.<a0, a1, a2, a3, a4, a5, x> = QQ[]
        sage: p = a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5
        sage: quintic = invariant_theory.binary_quintic(p, x)
        sage: quintic.coeffs()
        (a0, a1, a2, a3, a4, a5)

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.coeffs()
        (a0, a1, a2, a3, a4, a5)

        >>> R = QQ['a0, a1, a2, a3, a4, a5, x']; (a0, a1, a2, a3, a4, a5, x,) = R._first_ngens(7)
        >>> p = a0 + a1*x + a2*x**Integer(2) + a3*x**Integer(3) + a4*x**Integer(4) + a5*x**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x)
        >>> quintic.coeffs()
        (a0, a1, a2, a3, a4, a5)

  delta_covariant(as_form=False)

    Return the covariant \(\delta\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT:

    The \(\delta\)-covariant of the binary quintic as polynomial or as binary form.

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.delta_covariant()
        1/1562500000*a2^6*a3^7*x0 - 9/1562500000*a1*a2^4*a3^8*x0
        + 9/625000000*a1^2*a2^2*a3^9*x0 + 9/781250000*a0*a2^3*a3^9*x0
        - 9/1562500000*a1^3*a3^10*x0 - 81/1562500000*a0*a1*a2*a3^10*x0
        ...
        + 64/3125*a0^3*a1^3*a2^2*a5^5*x1 - 12/625*a0^4*a1*a2^3*a5^5*x1
        + 16/3125*a0^3*a1^4*a3*a5^5*x1 - 16/625*a0^4*a1^2*a2*a3*a5^5*x1
        + 4/125*a0^5*a2^2*a3*a5^5*x1

        sage: quintic.delta_covariant(as_form=True)
        Binary monic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.delta_covariant()
        1/1562500000*a2^6*a3^7*x0 - 9/1562500000*a1*a2^4*a3^8*x0
        + 9/625000000*a1^2*a2^2*a3^9*x0 + 9/781250000*a0*a2^3*a3^9*x0
        - 9/1562500000*a1^3*a3^10*x0 - 81/1562500000*a0*a1*a2*a3^10*x0
        ...
        + 64/3125*a0^3*a1^3*a2^2*a5^5*x1 - 12/625*a0^4*a1*a2^3*a5^5*x1
        + 16/3125*a0^3*a1^4*a3*a5^5*x1 - 16/625*a0^4*a1^2*a2*a3*a5^5*x1
        + 4/125*a0^5*a2^2*a3*a5^5*x1

        >>> quintic.delta_covariant(as_form=True)
        Binary monic given by ...

  classmethod from_invariants(invariants, x, z, *args, **kwargs)

    Construct a binary quintic from its invariants.

    This function constructs a binary quintic whose invariants equal the ones provided as argument up to scaling.

    INPUT:

    - `invariants` – list or tuple of invariants that are used to reconstruct the binary quintic

    OUTPUT: a BinaryQuintic

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: from sage.rings.invariants.invariant_theory import BinaryQuintic
        sage: BinaryQuintic.from_invariants([3,6,12], x, y)
        Binary quintic with coefficients (0, 1, 0, 0, 1, 0)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> from sage.rings.invariants.invariant_theory import BinaryQuintic
        >>> BinaryQuintic.from_invariants([Integer(3),Integer(6),Integer(12)], x, y)
        Binary quintic with coefficients (0, 1, 0, 0, 1, 0)

  gamma_covariant(as_form=False)

    Return the covariant \(\gamma\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT:

    The \(\gamma\)-covariant of the binary quintic as polynomial or as binary form.

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.gamma_covariant()
        1/156250000*a2^5*a3^6*x0 - 3/62500000*a1*a2^3*a3^7*x0
        + 27/312500000*a1^2*a2*a3^8*x0 + 27/312500000*a0*a2^2*a3^8*x0
        - 81/312500000*a0*a1*a3^9*x0 - 19/312500000*a2^6*a3^4*a4*x0
        ...
        - 32/3125*a0^2*a1^3*a2^2*a5^4*x1 + 6/625*a0^3*a1*a2^3*a5^4*x1
        - 8/3125*a0^2*a1^4*a3*a5^4*x1 + 8/625*a0^3*a1^2*a2*a3*a5^4*x1
        - 2/125*a0^4*a2^2*a3*a5^4*x1

        sage: quintic.gamma_covariant(as_form=True)
        Binary monic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.gamma_covariant()
        1/156250000*a2^5*a3^6*x0 - 3/62500000*a1*a2^3*a3^7*x0
        + 27/312500000*a1^2*a2*a3^8*x0 + 27/312500000*a0*a2^2*a3^8*x0
        - 81/312500000*a0*a1*a3^9*x0 - 19/312500000*a2^6*a3^4*a4*x0
        ...
        - 32/3125*a0^2*a1^3*a2^2*a5^4*x1 + 6/625*a0^3*a1*a2^3*a5^4*x1
        - 8/3125*a0^2*a1^4*a3*a5^4*x1 + 8/625*a0^3*a1^2*a2*a3*a5^4*x1
        - 2/125*a0^4*a2^2*a3*a5^4*x1

        >>> quintic.gamma_covariant(as_form=True)
        Binary monic given by ...

  i_covariant(as_form=False)

    Return the covariant \(i\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT: the \(i\)-covariant of the binary quintic as polynomial or as binary form

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.i_covariant()
        3/50*a3^2*x0^2 - 4/25*a2*a4*x0^2 + 2/5*a1*a5*x0^2 + 1/25*a2*a3*x0*x1
        - 6/25*a1*a4*x0*x1 + 2*a0*a5*x0*x1 + 3/50*a2^2*x1^2 - 4/25*a1*a3*x1^2
        + 2/5*a0*a4*x1^2

        sage: quintic.i_covariant(as_form=True)
        Binary quadratic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.i_covariant()
        3/50*a3^2*x0^2 - 4/25*a2*a4*x0^2 + 2/5*a1*a5*x0^2 + 1/25*a2*a3*x0*x1
        - 6/25*a1*a4*x0*x1 + 2*a0*a5*x0*x1 + 3/50*a2^2*x1^2 - 4/25*a1*a3*x1^2
        + 2/5*a0*a4*x1^2

        >>> quintic.i_covariant(as_form=True)
        Binary quadratic given by ...

  invariants(type='clebsch')

    Return a tuple of invariants of a binary quintic.

    INPUT:

    - `type` – the type of invariants to return; the default choice is to return the Clebsch invariants

    OUTPUT: the invariants of the binary quintic

    EXAMPLES:

    Sage

        sage: R.<x0, x1> = QQ[]
        sage: p = 2*x1^5 + 4*x1^4*x0 + 5*x1^3*x0^2 + 7*x1^2*x0^3 - 11*x1*x0^4 + x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.invariants()
        (-276032/625,
         4983526016/390625,
         -247056495846408/244140625,
         -148978972828696847376/30517578125)
        sage: quintic.invariants('unknown')
        Traceback (most recent call last):
        ...
        ValueError: unknown type of invariants unknown for a binary quintic

    Python

        >>> from sage.all import *
        >>> R = QQ['x0, x1']; (x0, x1,) = R._first_ngens(2)
        >>> p = Integer(2)*x1**Integer(5) + Integer(4)*x1**Integer(4)*x0 + Integer(5)*x1**Integer(3)*x0**Integer(2) + Integer(7)*x1**Integer(2)*x0**Integer(3) - Integer(11)*x1*x0**Integer(4) + x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.invariants()
        (-276032/625,
         4983526016/390625,
         -247056495846408/244140625,
         -148978972828696847376/30517578125)
        >>> quintic.invariants('unknown')
        Traceback (most recent call last):
        ...
        ValueError: unknown type of invariants unknown for a binary quintic

  j_covariant(as_form=False)

    Return the covariant \(j\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT: the \(j\)-covariant of the binary quintic as polynomial or as binary form

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.j_covariant()
        -3/500*a3^3*x0^3 + 3/125*a2*a3*a4*x0^3 - 6/125*a1*a4^2*x0^3
        - 3/50*a2^2*a5*x0^3 + 3/25*a1*a3*a5*x0^3 - 3/500*a2*a3^2*x0^2*x1
        + 3/250*a2^2*a4*x0^2*x1 + 3/125*a1*a3*a4*x0^2*x1 - 6/25*a0*a4^2*x0^2*x1
        - 3/25*a1*a2*a5*x0^2*x1 + 3/5*a0*a3*a5*x0^2*x1 - 3/500*a2^2*a3*x0*x1^2
        + 3/250*a1*a3^2*x0*x1^2 + 3/125*a1*a2*a4*x0*x1^2 - 3/25*a0*a3*a4*x0*x1^2
        - 6/25*a1^2*a5*x0*x1^2 + 3/5*a0*a2*a5*x0*x1^2 - 3/500*a2^3*x1^3
        + 3/125*a1*a2*a3*x1^3 - 3/50*a0*a3^2*x1^3 - 6/125*a1^2*a4*x1^3
        + 3/25*a0*a2*a4*x1^3

        sage: quintic.j_covariant(as_form=True)
        Binary cubic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.j_covariant()
        -3/500*a3^3*x0^3 + 3/125*a2*a3*a4*x0^3 - 6/125*a1*a4^2*x0^3
        - 3/50*a2^2*a5*x0^3 + 3/25*a1*a3*a5*x0^3 - 3/500*a2*a3^2*x0^2*x1
        + 3/250*a2^2*a4*x0^2*x1 + 3/125*a1*a3*a4*x0^2*x1 - 6/25*a0*a4^2*x0^2*x1
        - 3/25*a1*a2*a5*x0^2*x1 + 3/5*a0*a3*a5*x0^2*x1 - 3/500*a2^2*a3*x0*x1^2
        + 3/250*a1*a3^2*x0*x1^2 + 3/125*a1*a2*a4*x0*x1^2 - 3/25*a0*a3*a4*x0*x1^2
        - 6/25*a1^2*a5*x0*x1^2 + 3/5*a0*a2*a5*x0*x1^2 - 3/500*a2^3*x1^3
        + 3/125*a1*a2*a3*x1^3 - 3/50*a0*a3^2*x1^3 - 6/125*a1^2*a4*x1^3
        + 3/25*a0*a2*a4*x1^3

        >>> quintic.j_covariant(as_form=True)
        Binary cubic given by ...

  monomials()

    List the basis monomials of the form.

    This function lists a basis of monomials of the space of binary quintics of which this form is an element.

    OUTPUT:

    A tuple of monomials. They are in the same order as `coeffs()`.

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: quintic = invariant_theory.binary_quintic(x^5 + y^5)
        sage: quintic.monomials()
        (y^5, x*y^4, x^2*y^3, x^3*y^2, x^4*y, x^5)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + y**Integer(5))
        >>> quintic.monomials()
        (y^5, x*y^4, x^2*y^3, x^3*y^2, x^4*y, x^5)

  scaled_coeffs()

    The coefficients of a binary quintic.

    Given

    \[f(x) = a_0 x_1^5 + 5 a_1 x_0 x_1^4 + 10 a_2 x_0^2 x_1^3 + 10 a_3 x_0^3 x_1^2 + 5 a_4 x_0^4 x_1 + a_5 x_1^5\]

    this function returns \(a = (a_0, a_1, a_2, a_3, a_4, a_5)\)

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + 5*a1*x1^4*x0 + 10*a2*x1^3*x0^2 + 10*a3*x1^2*x0^3 + 5*a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.scaled_coeffs()
        (a0, a1, a2, a3, a4, a5)

        sage: R.<a0, a1, a2, a3, a4, a5, x> = QQ[]
        sage: p = a0 + 5*a1*x + 10*a2*x^2 + 10*a3*x^3 + 5*a4*x^4 + a5*x^5
        sage: quintic = invariant_theory.binary_quintic(p, x)
        sage: quintic.scaled_coeffs()
        (a0, a1, a2, a3, a4, a5)

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + Integer(5)*a1*x1**Integer(4)*x0 + Integer(10)*a2*x1**Integer(3)*x0**Integer(2) + Integer(10)*a3*x1**Integer(2)*x0**Integer(3) + Integer(5)*a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.scaled_coeffs()
        (a0, a1, a2, a3, a4, a5)

        >>> R = QQ['a0, a1, a2, a3, a4, a5, x']; (a0, a1, a2, a3, a4, a5, x,) = R._first_ngens(7)
        >>> p = a0 + Integer(5)*a1*x + Integer(10)*a2*x**Integer(2) + Integer(10)*a3*x**Integer(3) + Integer(5)*a4*x**Integer(4) + a5*x**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x)
        >>> quintic.scaled_coeffs()
        (a0, a1, a2, a3, a4, a5)

  tau_covariant(as_form=False)

    Return the covariant \(\tau\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT:

    The \(\tau\)-covariant of the binary quintic as polynomial or as binary form.

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.tau_covariant()
        1/62500*a2^2*a3^4*x0^2 - 3/62500*a1*a3^5*x0^2
        - 1/15625*a2^3*a3^2*a4*x0^2 + 1/6250*a1*a2*a3^3*a4*x0^2
        + 3/6250*a0*a3^4*a4*x0^2 - 1/31250*a2^4*a4^2*x0^2
        ...
        - 2/125*a0*a1*a2^2*a4*a5*x1^2 - 4/125*a0*a1^2*a3*a4*a5*x1^2
        + 2/25*a0^2*a2*a3*a4*a5*x1^2 - 8/625*a1^4*a5^2*x1^2
        + 8/125*a0*a1^2*a2*a5^2*x1^2 - 2/25*a0^2*a2^2*a5^2*x1^2

        sage: quintic.tau_covariant(as_form=True)
        Binary quadratic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.tau_covariant()
        1/62500*a2^2*a3^4*x0^2 - 3/62500*a1*a3^5*x0^2
        - 1/15625*a2^3*a3^2*a4*x0^2 + 1/6250*a1*a2*a3^3*a4*x0^2
        + 3/6250*a0*a3^4*a4*x0^2 - 1/31250*a2^4*a4^2*x0^2
        ...
        - 2/125*a0*a1*a2^2*a4*a5*x1^2 - 4/125*a0*a1^2*a3*a4*a5*x1^2
        + 2/25*a0^2*a2*a3*a4*a5*x1^2 - 8/625*a1^4*a5^2*x1^2
        + 8/125*a0*a1^2*a2*a5^2*x1^2 - 2/25*a0^2*a2^2*a5^2*x1^2

        >>> quintic.tau_covariant(as_form=True)
        Binary quadratic given by ...

  theta_covariant(as_form=False)

    Return the covariant \(\theta\) of a binary quintic.

    INPUT:

    - `as_form` – if `as_form` is `False`, the result will be returned as polynomial (default). If it is `True` the result is returned as an object of the class `AlgebraicForm`.

    OUTPUT:

    The \(\theta\)-covariant of the binary quintic as polynomial or as binary form.

    EXAMPLES:

    Sage

        sage: R.<a0, a1, a2, a3, a4, a5, x0, x1> = QQ[]
        sage: p = a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2 + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: quintic.theta_covariant()
        -1/625000*a2^3*a3^5*x0^2 + 9/1250000*a1*a2*a3^6*x0^2
        - 27/1250000*a0*a3^7*x0^2 + 3/250000*a2^4*a3^3*a4*x0^2
        - 7/125000*a1*a2^2*a3^4*a4*x0^2 - 3/312500*a1^2*a3^5*a4*x0^2
        ...
        + 6/625*a0^2*a1*a2^2*a4*a5^2*x1^2 + 24/625*a0^2*a1^2*a3*a4*a5^2*x1^2
        - 12/125*a0^3*a2*a3*a4*a5^2*x1^2 + 8/625*a0*a1^4*a5^3*x1^2
        - 8/125*a0^2*a1^2*a2*a5^3*x1^2 + 2/25*a0^3*a2^2*a5^3*x1^2

        sage: quintic.theta_covariant(as_form=True)
        Binary quadratic given by ...

    Python

        >>> from sage.all import *
        >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
        >>> p = a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2) + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> quintic.theta_covariant()
        -1/625000*a2^3*a3^5*x0^2 + 9/1250000*a1*a2*a3^6*x0^2
        - 27/1250000*a0*a3^7*x0^2 + 3/250000*a2^4*a3^3*a4*x0^2
        - 7/125000*a1*a2^2*a3^4*a4*x0^2 - 3/312500*a1^2*a3^5*a4*x0^2
        ...
        + 6/625*a0^2*a1*a2^2*a4*a5^2*x1^2 + 24/625*a0^2*a1^2*a3*a4*a5^2*x1^2
        - 12/125*a0^3*a2*a3*a4*a5^2*x1^2 + 8/625*a0*a1^4*a5^3*x1^2
        - 8/125*a0^2*a1^2*a2*a5^3*x1^2 + 2/25*a0^3*a2^2*a5^3*x1^2

        >>> quintic.theta_covariant(as_form=True)
        Binary quadratic given by ...

class sage.rings.invariants.invariant_theory.FormsBase(n, homogeneous, ring, variables)

  Bases: `SageObject`

  The common base class of `AlgebraicForm` and `SeveralAlgebraicForms`.

  This is an abstract base class to provide common methods. It does not make much sense to instantiate it.

  is_homogeneous()

    Return whether the forms were defined by homogeneous polynomials.

    OUTPUT: boolean; whether the user originally defined the form via homogeneous variables

    EXAMPLES:

    Sage

        sage: R.<x,y,t> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + y^4 + t*x^2*y^2, [x,y])
        sage: quartic.is_homogeneous()
        True
        sage: quartic.form()
        x^2*y^2*t + x^4 + y^4

        sage: R.<x,y,t> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + 1 + t*x^2, [x])
        sage: quartic.is_homogeneous()
        False
        sage: quartic.form()
        x^4 + x^2*t + 1

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4) + t*x**Integer(2)*y**Integer(2), [x,y])
        >>> quartic.is_homogeneous()
        True
        >>> quartic.form()
        x^2*y^2*t + x^4 + y^4

        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + Integer(1) + t*x**Integer(2), [x])
        >>> quartic.is_homogeneous()
        False
        >>> quartic.form()
        x^4 + x^2*t + 1

  ring()

    Return the polynomial ring.

    OUTPUT:

    A polynomial ring. This is where the defining polynomial(s) live. Note that the polynomials may be homogeneous or inhomogeneous, depending on how the user constructed the object.

    EXAMPLES:

    Sage

        sage: R.<x,y,t> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + y^4 + t*x^2*y^2, [x,y])
        sage: quartic.ring()
        Multivariate Polynomial Ring in x, y, t over Rational Field

        sage: R.<x,y,t> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + 1 + t*x^2, [x])
        sage: quartic.ring()
        Multivariate Polynomial Ring in x, y, t over Rational Field

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4) + t*x**Integer(2)*y**Integer(2), [x,y])
        >>> quartic.ring()
        Multivariate Polynomial Ring in x, y, t over Rational Field

        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + Integer(1) + t*x**Integer(2), [x])
        >>> quartic.ring()
        Multivariate Polynomial Ring in x, y, t over Rational Field

  variables()

    Return the variables of the form.

    OUTPUT:

    A tuple of variables. If inhomogeneous notation is used for the defining polynomial then the last entry will be `None`.

    EXAMPLES:

    Sage

        sage: R.<x,y,t> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + y^4 + t*x^2*y^2, [x,y])
        sage: quartic.variables()
        (x, y)

        sage: R.<x,y,t> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + 1 + t*x^2, [x])
        sage: quartic.variables()
        (x, None)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4) + t*x**Integer(2)*y**Integer(2), [x,y])
        >>> quartic.variables()
        (x, y)

        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + Integer(1) + t*x**Integer(2), [x])
        >>> quartic.variables()
        (x, None)

class sage.rings.invariants.invariant_theory.InvariantTheoryFactory

  Bases: `object`

  Factory object for invariants of multilinear forms.

  Use the invariant_theory object to construct algebraic forms. These can then be queried for invariant and covariants.

  EXAMPLES:

  Sage

      sage: R.<x,y,z> = QQ[]
      sage: invariant_theory.ternary_cubic(x^3 + y^3 + z^3)
      Ternary cubic with coefficients (1, 1, 1, 0, 0, 0, 0, 0, 0, 0)

      sage: invariant_theory.ternary_cubic(x^3 + y^3 + z^3).J_covariant()
      x^6*y^3 - x^3*y^6 - x^6*z^3 + y^6*z^3 + x^3*z^6 - y^3*z^6

  Python

      >>> from sage.all import *
      >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
      >>> invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3))
      Ternary cubic with coefficients (1, 1, 1, 0, 0, 0, 0, 0, 0, 0)

      >>> invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3)).J_covariant()
      x^6*y^3 - x^3*y^6 - x^6*z^3 + y^6*z^3 + x^3*z^6 - y^3*z^6

  binary_form_from_invariants(degree, invariants, variables=None, as_form=True, *args, **kwargs)

    Reconstruct a binary form from the values of its invariants.

    INPUT:

    - `degree` – the degree of the binary form

    - `invariants` – list or tuple of values of the invariants of the binary form

    - `variables` – list or tuple of two variables that are used for the resulting form (only if `as_form` is `True`). If no variables are provided, two abstract variables `x` and `z` will be used.

    - `as_form` – boolean; if `False`, the function will return a tuple of coefficients of a binary form

    OUTPUT:

    A binary form or a tuple of its coefficients, whose invariants are equal to the given `invariants` up to a scaling.

    EXAMPLES:

    In the case of binary quadratics and cubics, the form is reconstructed based on the value of the discriminant. See also `binary_quadratic_coefficients_from_invariants()` and `binary_cubic_coefficients_from_invariants()`. These methods will always return the same result if the discriminant is nonzero:

    Sage

        sage: discriminant = 1
        sage: invariant_theory.binary_form_from_invariants(2, [discriminant])
        Binary quadratic with coefficients (1, -1/4, 0)
        sage: invariant_theory.binary_form_from_invariants(3, [discriminant], as_form=false)
        (0, 1, -1, 0)

    Python

        >>> from sage.all import *
        >>> discriminant = Integer(1)
        >>> invariant_theory.binary_form_from_invariants(Integer(2), [discriminant])
        Binary quadratic with coefficients (1, -1/4, 0)
        >>> invariant_theory.binary_form_from_invariants(Integer(3), [discriminant], as_form=false)
        (0, 1, -1, 0)

    For binary cubics, there is no class implemented yet, so `as_form=True` will yield a `NotImplementedError`:

    Sage

        sage: invariant_theory.binary_form_from_invariants(3, [discriminant])
        Traceback (most recent call last):
        ...
        NotImplementedError: no class for binary cubics implemented

    [Python]

        >>> from sage.all import *
        >>> invariant_theory.binary_form_from_invariants(Integer(3), [discriminant])
        Traceback (most recent call last):
        ...
        NotImplementedError: no class for binary cubics implemented

    For binary quintics, the three Clebsch invariants of the form should be provided to reconstruct the form. For more details about these invariants, see `clebsch_invariants()`:

    Sage

        sage: invariants = [1, 0, 0]
        sage: invariant_theory.binary_form_from_invariants(5, invariants)
        Binary quintic with coefficients (1, 0, 0, 0, 0, 1)

    Python

        >>> from sage.all import *
        >>> invariants = [Integer(1), Integer(0), Integer(0)]
        >>> invariant_theory.binary_form_from_invariants(Integer(5), invariants)
        Binary quintic with coefficients (1, 0, 0, 0, 0, 1)

    An optional `scaling` argument may be provided in order to scale the resulting quintic. For more details, see `binary_quintic_coefficients_from_invariants()`:

    Sage

        sage: invariants = [3, 4, 7]
        sage: invariant_theory.binary_form_from_invariants(5, invariants)
        Binary quintic with coefficients (-37725479487783/1048576,
        565882192316745/8388608, 0, 1033866765362693115/67108864,
        12849486940936328715/268435456, -23129076493685391687/2147483648)
        sage: invariant_theory.binary_form_from_invariants(5, invariants,
        ....:                                              scaling='normalized')
        Binary quintic with coefficients (24389/892616806656,
        4205/11019960576, 0, 1015/209952, -145/1296, -3/16)
        sage: invariant_theory.binary_form_from_invariants(5, invariants,
        ....:                                                 scaling='coprime')
        Binary quintic with coefficients (-2048, 3840, 0, 876960, 2724840, -613089)

    [Python]

        >>> from sage.all import *
        >>> invariants = [Integer(3), Integer(4), Integer(7)]
        >>> invariant_theory.binary_form_from_invariants(Integer(5), invariants)
        Binary quintic with coefficients (-37725479487783/1048576,
        565882192316745/8388608, 0, 1033866765362693115/67108864,
        12849486940936328715/268435456, -23129076493685391687/2147483648)
        >>> invariant_theory.binary_form_from_invariants(Integer(5), invariants,
        ...                                              scaling='normalized')
        Binary quintic with coefficients (24389/892616806656,
        4205/11019960576, 0, 1015/209952, -145/1296, -3/16)
        >>> invariant_theory.binary_form_from_invariants(Integer(5), invariants,
        ...                                                 scaling='coprime')
        Binary quintic with coefficients (-2048, 3840, 0, 876960, 2724840, -613089)

    The invariants can also be computed using the invariants of a given binary quintic. The resulting form has the same invariants up to scaling, is \(GL(2,\QQ)\)-equivalent to the provided form and hence has the same canonical form (see `canonical_form()`):

    Sage

        sage: R.<x0, x1> = QQ[]
        sage: p = 3*x1^5 + 6*x1^4*x0 + 3*x1^3*x0^2 + 4*x1^2*x0^3 - 5*x1*x0^4 + 4*x0^5
        sage: quintic = invariant_theory.binary_quintic(p, x0, x1)
        sage: invariants = quintic.clebsch_invariants(as_tuple=True)
        sage: newquintic = invariant_theory.binary_form_from_invariants(
        ....:                  5, invariants, variables=quintic.variables())
        sage: newquintic
        Binary quintic with coefficients (9592267437341790539005557/244140625000000,
        2149296928207625556323004064707/610351562500000000,
        11149651890347700974453304786783/76293945312500000,
        122650775751894638395648891202734239/47683715820312500000,
        323996630945706528474286334593218447/11920928955078125000,
        1504506503644608395841632538558481466127/14901161193847656250000)
        sage: quintic.canonical_form() == newquintic.canonical_form()
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x0, x1']; (x0, x1,) = R._first_ngens(2)
        >>> p = Integer(3)*x1**Integer(5) + Integer(6)*x1**Integer(4)*x0 + Integer(3)*x1**Integer(3)*x0**Integer(2) + Integer(4)*x1**Integer(2)*x0**Integer(3) - Integer(5)*x1*x0**Integer(4) + Integer(4)*x0**Integer(5)
        >>> quintic = invariant_theory.binary_quintic(p, x0, x1)
        >>> invariants = quintic.clebsch_invariants(as_tuple=True)
        >>> newquintic = invariant_theory.binary_form_from_invariants(
        ...                  Integer(5), invariants, variables=quintic.variables())
        >>> newquintic
        Binary quintic with coefficients (9592267437341790539005557/244140625000000,
        2149296928207625556323004064707/610351562500000000,
        11149651890347700974453304786783/76293945312500000,
        122650775751894638395648891202734239/47683715820312500000,
        323996630945706528474286334593218447/11920928955078125000,
        1504506503644608395841632538558481466127/14901161193847656250000)
        >>> quintic.canonical_form() == newquintic.canonical_form()
        True

    For binary forms of other degrees, no reconstruction has been implemented yet. For forms of degree 6, see Issue #26462:

    Sage

        sage: invariant_theory.binary_form_from_invariants(6, invariants)
        Traceback (most recent call last):
        ...
        NotImplementedError: no reconstruction for binary forms of degree 6 implemented

    [Python]

        >>> from sage.all import *
        >>> invariant_theory.binary_form_from_invariants(Integer(6), invariants)
        Traceback (most recent call last):
        ...
        NotImplementedError: no reconstruction for binary forms of degree 6 implemented

  binary_quadratic(quadratic, *args)

    Invariant theory of a quadratic in two variables.

    INPUT:

    - `quadratic` – a quadratic form

    - `x`, `y` – the homogeneous variables. If `y` is `None`, the quadratic is assumed to be inhomogeneous.

    REFERENCES:

    - Wikipedia article Invariant_of_a_binary_form

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: invariant_theory.binary_quadratic(x^2 + y^2)
        Binary quadratic with coefficients (1, 1, 0)

        sage: T.<t> = QQ[]
        sage: invariant_theory.binary_quadratic(t^2 + 2*t + 1, [t])
        Binary quadratic with coefficients (1, 1, 2)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> invariant_theory.binary_quadratic(x**Integer(2) + y**Integer(2))
        Binary quadratic with coefficients (1, 1, 0)

        >>> T = QQ['t']; (t,) = T._first_ngens(1)
        >>> invariant_theory.binary_quadratic(t**Integer(2) + Integer(2)*t + Integer(1), [t])
        Binary quadratic with coefficients (1, 1, 2)

  binary_quartic(quartic, *args, **kwds)

    Invariant theory of a quartic in two variables.

    The algebra of invariants of a quartic form is generated by invariants \(i\), \(j\) of degrees 2, 3. This ring is naturally isomorphic to the ring of modular forms of level 1, with the two generators corresponding to the Eisenstein series \(E_4\) (see `EisensteinD()`) and \(E_6\) (see `EisensteinE()`). The algebra of covariants is generated by these two invariants together with the form \(f\) of degree 1 and order 4, the Hessian \(g\) (see `g_covariant()`) of degree 2 and order 4, and a covariant \(h\) (see `h_covariant()`) of degree 3 and order 6. They are related by a syzygy

    \[j f^3 - g f^2 i + 4 g^3 + h^2 = 0\]

    of degree 6 and order 12.

    INPUT:

    - `quartic` – a quartic

    - `x`, `y` – the homogeneous variables. If `y` is `None`, the quartic is assumed to be inhomogeneous.

    REFERENCES:

    - Wikipedia article Invariant_of_a_binary_form

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: quartic = invariant_theory.binary_quartic(x^4 + y^4)
        sage: quartic
        Binary quartic with coefficients (1, 0, 0, 0, 1)
        sage: type(quartic)
        <class 'sage.rings.invariants.invariant_theory.BinaryQuartic'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> quartic = invariant_theory.binary_quartic(x**Integer(4) + y**Integer(4))
        >>> quartic
        Binary quartic with coefficients (1, 0, 0, 0, 1)
        >>> type(quartic)
        <class 'sage.rings.invariants.invariant_theory.BinaryQuartic'>

  binary_quintic(quintic, *args, **kwds)

    Create a binary quintic for computing invariants.

    A binary quintic is a homogeneous polynomial of degree 5 in two variables. The algebra of invariants of a binary quintic is generated by the invariants \(A\), \(B\) and \(C\) of respective degrees 4, 8 and 12 (see `A_invariant()`, `B_invariant()` and `C_invariant()`).

    INPUT:

    - `quintic` – a homogeneous polynomial of degree five in two variables or a (possibly inhomogeneous) polynomial of degree at most five in one variable.

    - `*args` – the two homogeneous variables. If only one variable is given, the polynomial `quintic` is assumed to be univariate. If no variables are given, they are guessed.

    REFERENCES:

    - Wikipedia article Invariant_of_a_binary_form

    - [Cle1872]

    EXAMPLES:

    If no variables are provided, they will be guessed:

    Sage

        sage: R.<x,y> = QQ[]
        sage: quintic = invariant_theory.binary_quintic(x^5 + y^5)
        sage: quintic
        Binary quintic with coefficients (1, 0, 0, 0, 0, 1)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + y**Integer(5))
        >>> quintic
        Binary quintic with coefficients (1, 0, 0, 0, 0, 1)

    If only one variable is given, the quintic is the homogenisation of the provided polynomial:

    Sage

        sage: quintic = invariant_theory.binary_quintic(x^5 + y^5, x)
        sage: quintic
        Binary quintic with coefficients (y^5, 0, 0, 0, 0, 1)
        sage: quintic.is_homogeneous()
        False

    [Python]

        >>> from sage.all import *
        >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + y**Integer(5), x)
        >>> quintic
        Binary quintic with coefficients (y^5, 0, 0, 0, 0, 1)
        >>> quintic.is_homogeneous()
        False

    If the polynomial has three or more variables, the variables should be specified:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: quintic = invariant_theory.binary_quintic(x^5 + z*y^5)
        Traceback (most recent call last):
        ...
        ValueError: need 2 or 1 variables, got (x, y, z)
        sage: quintic = invariant_theory.binary_quintic(x^5 + z*y^5, x, y)
        sage: quintic
        Binary quintic with coefficients (z, 0, 0, 0, 0, 1)

        sage: type(quintic)
        <class 'sage.rings.invariants.invariant_theory.BinaryQuintic'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + z*y**Integer(5))
        Traceback (most recent call last):
        ...
        ValueError: need 2 or 1 variables, got (x, y, z)
        >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + z*y**Integer(5), x, y)
        >>> quintic
        Binary quintic with coefficients (z, 0, 0, 0, 0, 1)

        >>> type(quintic)
        <class 'sage.rings.invariants.invariant_theory.BinaryQuintic'>

  inhomogeneous_quadratic_form(polynomial, *args)

    Invariants of an inhomogeneous quadratic form.

    INPUT:

    - `polynomial` – an inhomogeneous quadratic form

    - `*args` – the variables as multiple arguments, or as a single list/tuple

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: quadratic = x^2 + 2*y^2 + 3*x*y + 4*x + 5*y + 6
        sage: inv3 = invariant_theory.inhomogeneous_quadratic_form(quadratic)
        sage: type(inv3)
        <class 'sage.rings.invariants.invariant_theory.TernaryQuadratic'>
        sage: inv4 = invariant_theory.inhomogeneous_quadratic_form(x^2 + y^2 + z^2)
        sage: type(inv4)
        <class 'sage.rings.invariants.invariant_theory.QuadraticForm'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> quadratic = x**Integer(2) + Integer(2)*y**Integer(2) + Integer(3)*x*y + Integer(4)*x + Integer(5)*y + Integer(6)
        >>> inv3 = invariant_theory.inhomogeneous_quadratic_form(quadratic)
        >>> type(inv3)
        <class 'sage.rings.invariants.invariant_theory.TernaryQuadratic'>
        >>> inv4 = invariant_theory.inhomogeneous_quadratic_form(x**Integer(2) + y**Integer(2) + z**Integer(2))
        >>> type(inv4)
        <class 'sage.rings.invariants.invariant_theory.QuadraticForm'>

  quadratic_form(polynomial, *args)

    Invariants of a homogeneous quadratic form.

    INPUT:

    - `polynomial` – a homogeneous or inhomogeneous quadratic form

    - `*args` – the variables as multiple arguments, or as a single list/tuple. If the last argument is `None`, the cubic is assumed to be inhomogeneous.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: quadratic = x^2 + y^2 + z^2
        sage: inv = invariant_theory.quadratic_form(quadratic)
        sage: type(inv)
        <class 'sage.rings.invariants.invariant_theory.TernaryQuadratic'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> quadratic = x**Integer(2) + y**Integer(2) + z**Integer(2)
        >>> inv = invariant_theory.quadratic_form(quadratic)
        >>> type(inv)
        <class 'sage.rings.invariants.invariant_theory.TernaryQuadratic'>

    If some of the ring variables are to be treated as coefficients you need to specify the polynomial variables:

    Sage

        sage: R.<x,y,z, a,b> = QQ[]
        sage: quadratic = a*x^2 + b*y^2 + z^2 + 2*y*z
        sage: invariant_theory.quadratic_form(quadratic, x,y,z)
        Ternary quadratic with coefficients (a, b, 1, 0, 0, 2)
        sage: invariant_theory.quadratic_form(quadratic, [x,y,z])   # alternate syntax
        Ternary quadratic with coefficients (a, b, 1, 0, 0, 2)

    [Python]

        >>> from sage.all import *
        >>> R = QQ['x, y, z, a, b']; (x, y, z, a, b,) = R._first_ngens(5)
        >>> quadratic = a*x**Integer(2) + b*y**Integer(2) + z**Integer(2) + Integer(2)*y*z
        >>> invariant_theory.quadratic_form(quadratic, x,y,z)
        Ternary quadratic with coefficients (a, b, 1, 0, 0, 2)
        >>> invariant_theory.quadratic_form(quadratic, [x,y,z])   # alternate syntax
        Ternary quadratic with coefficients (a, b, 1, 0, 0, 2)

    Inhomogeneous quadratic forms (see also `inhomogeneous_quadratic_form()`) can be specified by passing `None` as the last variable:

    Sage

        sage: inhom = quadratic.subs(z=1)
        sage: invariant_theory.quadratic_form(inhom, x,y,None)
        Ternary quadratic with coefficients (a, b, 1, 0, 0, 2)

    Python

        >>> from sage.all import *
        >>> inhom = quadratic.subs(z=Integer(1))
        >>> invariant_theory.quadratic_form(inhom, x,y,None)
        Ternary quadratic with coefficients (a, b, 1, 0, 0, 2)

  quaternary_biquadratic(quadratic1, quadratic2, *args, **kwds)

    Invariants of two quadratics in four variables.

    INPUT:

    - `quadratic1`, `quadratic2` – two polynomials. Either homogeneous quadratic in 4 homogeneous variables, or inhomogeneous quadratic in 3 variables.

    - `w`, `x`, `y`, `z` – the variables. If `z` is `None`, the quadratics are assumed to be inhomogeneous.

    EXAMPLES:

    Sage

        sage: R.<w,x,y,z> = QQ[]
        sage: q1 = w^2 + x^2 + y^2 + z^2
        sage: q2 = w*x + y*z
        sage: inv = invariant_theory.quaternary_biquadratic(q1, q2)
        sage: type(inv)
        <class 'sage.rings.invariants.invariant_theory.TwoQuaternaryQuadratics'>

    Python

        >>> from sage.all import *
        >>> R = QQ['w, x, y, z']; (w, x, y, z,) = R._first_ngens(4)
        >>> q1 = w**Integer(2) + x**Integer(2) + y**Integer(2) + z**Integer(2)
        >>> q2 = w*x + y*z
        >>> inv = invariant_theory.quaternary_biquadratic(q1, q2)
        >>> type(inv)
        <class 'sage.rings.invariants.invariant_theory.TwoQuaternaryQuadratics'>

    Distance between two spheres [Sal1958], [Sal1965]

    Sage

        sage: R.<x,y,z, a,b,c, r1,r2> = QQ[]
        sage: S1 = -r1^2 + x^2 + y^2 + z^2
        sage: S2 = -r2^2 + (x-a)^2 + (y-b)^2 + (z-c)^2
        sage: inv = invariant_theory.quaternary_biquadratic(S1, S2, [x, y, z])
        sage: inv.Delta_invariant()
        -r1^2
        sage: inv.Delta_prime_invariant()
        -r2^2
        sage: inv.Theta_invariant()
        a^2 + b^2 + c^2 - 3*r1^2 - r2^2
        sage: inv.Theta_prime_invariant()
        a^2 + b^2 + c^2 - r1^2 - 3*r2^2
        sage: inv.Phi_invariant()
        2*a^2 + 2*b^2 + 2*c^2 - 3*r1^2 - 3*r2^2
        sage: inv.J_covariant()
        0

    [Python]

        >>> from sage.all import *
        >>> R = QQ['x, y, z, a, b, c, r1, r2']; (x, y, z, a, b, c, r1, r2,) = R._first_ngens(8)
        >>> S1 = -r1**Integer(2) + x**Integer(2) + y**Integer(2) + z**Integer(2)
        >>> S2 = -r2**Integer(2) + (x-a)**Integer(2) + (y-b)**Integer(2) + (z-c)**Integer(2)
        >>> inv = invariant_theory.quaternary_biquadratic(S1, S2, [x, y, z])
        >>> inv.Delta_invariant()
        -r1^2
        >>> inv.Delta_prime_invariant()
        -r2^2
        >>> inv.Theta_invariant()
        a^2 + b^2 + c^2 - 3*r1^2 - r2^2
        >>> inv.Theta_prime_invariant()
        a^2 + b^2 + c^2 - r1^2 - 3*r2^2
        >>> inv.Phi_invariant()
        2*a^2 + 2*b^2 + 2*c^2 - 3*r1^2 - 3*r2^2
        >>> inv.J_covariant()
        0

  quaternary_quadratic(quadratic, *args)

    Invariant theory of a quadratic in four variables.

    INPUT:

    - `quadratic` – a quadratic form

    - `w`, `x`, `y`, `z` – the homogeneous variables. If `z` is `None`, the quadratic is assumed to be inhomogeneous.

    REFERENCES:

    - Wikipedia article Invariant_of_a_binary_form

    EXAMPLES:

    Sage

        sage: R.<w,x,y,z> = QQ[]
        sage: invariant_theory.quaternary_quadratic(w^2 + x^2 + y^2 + z^2)
        Quaternary quadratic with coefficients (1, 1, 1, 1, 0, 0, 0, 0, 0, 0)

        sage: R.<x,y,z> = QQ[]
        sage: invariant_theory.quaternary_quadratic(1 + x^2 + y^2 + z^2)
        Quaternary quadratic with coefficients (1, 1, 1, 1, 0, 0, 0, 0, 0, 0)

    Python

        >>> from sage.all import *
        >>> R = QQ['w, x, y, z']; (w, x, y, z,) = R._first_ngens(4)
        >>> invariant_theory.quaternary_quadratic(w**Integer(2) + x**Integer(2) + y**Integer(2) + z**Integer(2))
        Quaternary quadratic with coefficients (1, 1, 1, 1, 0, 0, 0, 0, 0, 0)

        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> invariant_theory.quaternary_quadratic(Integer(1) + x**Integer(2) + y**Integer(2) + z**Integer(2))
        Quaternary quadratic with coefficients (1, 1, 1, 1, 0, 0, 0, 0, 0, 0)

  ternary_biquadratic(quadratic1, quadratic2, *args, **kwds)

    Invariants of two quadratics in three variables.

    INPUT:

    - `quadratic1`, `quadratic2` – two polynomials. Either homogeneous quadratic in 3 homogeneous variables, or inhomogeneous quadratic in 2 variables.

    - `x`, `y`, `z` – the variables. If `z` is `None`, the quadratics are assumed to be inhomogeneous.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: q1 = x^2 + y^2 + z^2
        sage: q2 = x*y + y*z + x*z
        sage: inv = invariant_theory.ternary_biquadratic(q1, q2)
        sage: type(inv)
        <class 'sage.rings.invariants.invariant_theory.TwoTernaryQuadratics'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> q1 = x**Integer(2) + y**Integer(2) + z**Integer(2)
        >>> q2 = x*y + y*z + x*z
        >>> inv = invariant_theory.ternary_biquadratic(q1, q2)
        >>> type(inv)
        <class 'sage.rings.invariants.invariant_theory.TwoTernaryQuadratics'>

    Distance between two circles:

    Sage

        sage: R.<x,y, a,b, r1,r2> = QQ[]
        sage: S1 = -r1^2 + x^2 + y^2
        sage: S2 = -r2^2 + (x-a)^2 + (y-b)^2
        sage: inv = invariant_theory.ternary_biquadratic(S1, S2, [x, y])
        sage: inv.Delta_invariant()
        -r1^2
        sage: inv.Delta_prime_invariant()
        -r2^2
        sage: inv.Theta_invariant()
        a^2 + b^2 - 2*r1^2 - r2^2
        sage: inv.Theta_prime_invariant()
        a^2 + b^2 - r1^2 - 2*r2^2
        sage: inv.F_covariant()
        2*x^2*a^2 + y^2*a^2 - 2*x*a^3 + a^4 + 2*x*y*a*b - 2*y*a^2*b + x^2*b^2 +
        2*y^2*b^2 - 2*x*a*b^2 + 2*a^2*b^2 - 2*y*b^3 + b^4 - 2*x^2*r1^2 - 2*y^2*r1^2 +
        2*x*a*r1^2 - 2*a^2*r1^2 + 2*y*b*r1^2 - 2*b^2*r1^2 + r1^4 - 2*x^2*r2^2 -
        2*y^2*r2^2 + 2*x*a*r2^2 - 2*a^2*r2^2 + 2*y*b*r2^2 - 2*b^2*r2^2 + 2*r1^2*r2^2 +
        r2^4
        sage: inv.J_covariant()
        -8*x^2*y*a^3 + 8*x*y*a^4 + 8*x^3*a^2*b - 16*x*y^2*a^2*b - 8*x^2*a^3*b +
        8*y^2*a^3*b + 16*x^2*y*a*b^2 - 8*y^3*a*b^2 + 8*x*y^2*b^3 - 8*x^2*a*b^3 +
        8*y^2*a*b^3 - 8*x*y*b^4 + 8*x*y*a^2*r1^2 - 8*y*a^3*r1^2 - 8*x^2*a*b*r1^2 +
        8*y^2*a*b*r1^2 + 8*x*a^2*b*r1^2 - 8*x*y*b^2*r1^2 - 8*y*a*b^2*r1^2 + 8*x*b^3*r1^2 -
        8*x*y*a^2*r2^2 + 8*x^2*a*b*r2^2 - 8*y^2*a*b*r2^2 + 8*x*y*b^2*r2^2

    [Python]

        >>> from sage.all import *
        >>> R = QQ['x, y, a, b, r1, r2']; (x, y, a, b, r1, r2,) = R._first_ngens(6)
        >>> S1 = -r1**Integer(2) + x**Integer(2) + y**Integer(2)
        >>> S2 = -r2**Integer(2) + (x-a)**Integer(2) + (y-b)**Integer(2)
        >>> inv = invariant_theory.ternary_biquadratic(S1, S2, [x, y])
        >>> inv.Delta_invariant()
        -r1^2
        >>> inv.Delta_prime_invariant()
        -r2^2
        >>> inv.Theta_invariant()
        a^2 + b^2 - 2*r1^2 - r2^2
        >>> inv.Theta_prime_invariant()
        a^2 + b^2 - r1^2 - 2*r2^2
        >>> inv.F_covariant()
        2*x^2*a^2 + y^2*a^2 - 2*x*a^3 + a^4 + 2*x*y*a*b - 2*y*a^2*b + x^2*b^2 +
        2*y^2*b^2 - 2*x*a*b^2 + 2*a^2*b^2 - 2*y*b^3 + b^4 - 2*x^2*r1^2 - 2*y^2*r1^2 +
        2*x*a*r1^2 - 2*a^2*r1^2 + 2*y*b*r1^2 - 2*b^2*r1^2 + r1^4 - 2*x^2*r2^2 -
        2*y^2*r2^2 + 2*x*a*r2^2 - 2*a^2*r2^2 + 2*y*b*r2^2 - 2*b^2*r2^2 + 2*r1^2*r2^2 +
        r2^4
        >>> inv.J_covariant()
        -8*x^2*y*a^3 + 8*x*y*a^4 + 8*x^3*a^2*b - 16*x*y^2*a^2*b - 8*x^2*a^3*b +
        8*y^2*a^3*b + 16*x^2*y*a*b^2 - 8*y^3*a*b^2 + 8*x*y^2*b^3 - 8*x^2*a*b^3 +
        8*y^2*a*b^3 - 8*x*y*b^4 + 8*x*y*a^2*r1^2 - 8*y*a^3*r1^2 - 8*x^2*a*b*r1^2 +
        8*y^2*a*b*r1^2 + 8*x*a^2*b*r1^2 - 8*x*y*b^2*r1^2 - 8*y*a*b^2*r1^2 + 8*x*b^3*r1^2 -
        8*x*y*a^2*r2^2 + 8*x^2*a*b*r2^2 - 8*y^2*a*b*r2^2 + 8*x*y*b^2*r2^2

  ternary_cubic(cubic, *args, **kwds)

    Invariants of a cubic in three variables.

    The algebra of invariants of a ternary cubic under \(SL_3(\CC)\) is a polynomial algebra generated by two invariants \(S\) (see `S_invariant()`) and T (see `T_invariant()`) of degrees 4 and 6, called Aronhold invariants.

    The ring of covariants is given as follows. The identity covariant U of a ternary cubic has degree 1 and order 3. The Hessian \(H\) (see `Hessian()`) is a covariant of ternary cubics of degree 3 and order 3. There is a covariant \(\Theta\) (see `Theta_covariant()`) of ternary cubics of degree 8 and order 6 that vanishes on points \(x\) lying on the Salmon conic of the polar of \(x\) with respect to the curve and its Hessian curve. The Brioschi covariant \(J\) (see `J_covariant()`) is the Jacobian of \(U\), \(\Theta\), and \(H\) of degree 12, order 9. The algebra of covariants of a ternary cubic is generated over the ring of invariants by \(U\), \(\Theta\), \(H\), and \(J\), with a relation

    \[\begin{split}\begin{split} J^2 =& 4 \Theta^3 + T U^2 \Theta^2 + \Theta (-4 S^3 U^4 + 2 S T U^3 H - 72 S^2 U^2 H^2 \\ & - 18 T U H^3 + 108 S H^4) -16 S^4 U^5 H - 11 S^2 T U^4 H^2 \\ & -4 T^2 U^3 H^3 +54 S T U^2 H^4 -432 S^2 U H^5 -27 T H^6 \end{split}\end{split}\]

    REFERENCES:

    - Wikipedia article Ternary_cubic

    INPUT:

    - `cubic` – a homogeneous cubic in 3 homogeneous variables, or an inhomogeneous cubic in 2 variables

    - `x`, `y`, `z` – the variables. If `z` is `None`, the cubic is assumed to be inhomogeneous.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + z^3)
        sage: type(cubic)
        <class 'sage.rings.invariants.invariant_theory.TernaryCubic'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3))
        >>> type(cubic)
        <class 'sage.rings.invariants.invariant_theory.TernaryCubic'>

  ternary_quadratic(quadratic, *args, **kwds)

    Invariants of a quadratic in three variables.

    INPUT:

    - `quadratic` – a homogeneous quadratic in 3 homogeneous variables, or an inhomogeneous quadratic in 2 variables

    - `x`, `y`, `z` – the variables. If `z` is `None`, the quadratic is assumed to be inhomogeneous.

    REFERENCES:

    - Wikipedia article Invariant_of_a_binary_form

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: invariant_theory.ternary_quadratic(x^2 + y^2 + z^2)
        Ternary quadratic with coefficients (1, 1, 1, 0, 0, 0)

        sage: T.<u, v> = QQ[]
        sage: invariant_theory.ternary_quadratic(1 + u^2 + v^2)
        Ternary quadratic with coefficients (1, 1, 1, 0, 0, 0)

        sage: quadratic = x^2 + y^2 + z^2
        sage: inv = invariant_theory.ternary_quadratic(quadratic)
        sage: type(inv)
        <class 'sage.rings.invariants.invariant_theory.TernaryQuadratic'>

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> invariant_theory.ternary_quadratic(x**Integer(2) + y**Integer(2) + z**Integer(2))
        Ternary quadratic with coefficients (1, 1, 1, 0, 0, 0)

        >>> T = QQ['u, v']; (u, v,) = T._first_ngens(2)
        >>> invariant_theory.ternary_quadratic(Integer(1) + u**Integer(2) + v**Integer(2))
        Ternary quadratic with coefficients (1, 1, 1, 0, 0, 0)

        >>> quadratic = x**Integer(2) + y**Integer(2) + z**Integer(2)
        >>> inv = invariant_theory.ternary_quadratic(quadratic)
        >>> type(inv)
        <class 'sage.rings.invariants.invariant_theory.TernaryQuadratic'>

class sage.rings.invariants.invariant_theory.QuadraticForm(n, d, polynomial, *args)

  Bases: `AlgebraicForm`

  Invariant theory of a multivariate quadratic form.

  You should use the `invariant_theory` factory object to construct instances of this class. See `quadratic_form()` for details.

  as_QuadraticForm()

    Convert into a `QuadraticForm`.

    OUTPUT:

    Sage has a special quadratic forms subsystem. This method converts `self` into this `QuadraticForm` representation.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: p = x^2 + y^2 + z^2 + 2*x*y + 3*x*z
        sage: quadratic = invariant_theory.ternary_quadratic(p)
        sage: matrix(quadratic)
        [  1   1 3/2]
        [  1   1   0]
        [3/2   0   1]
        sage: quadratic.as_QuadraticForm()
        Quadratic form in 3 variables over Multivariate Polynomial
        Ring in x, y, z over Rational Field with coefficients:
        [ 1 2 3 ]
        [ * 1 0 ]
        [ * * 1 ]
        sage: _.polynomial('X,Y,Z')
        X^2 + 2*X*Y + Y^2 + 3*X*Z + Z^2

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> p = x**Integer(2) + y**Integer(2) + z**Integer(2) + Integer(2)*x*y + Integer(3)*x*z
        >>> quadratic = invariant_theory.ternary_quadratic(p)
        >>> matrix(quadratic)
        [  1   1 3/2]
        [  1   1   0]
        [3/2   0   1]
        >>> quadratic.as_QuadraticForm()
        Quadratic form in 3 variables over Multivariate Polynomial
        Ring in x, y, z over Rational Field with coefficients:
        [ 1 2 3 ]
        [ * 1 0 ]
        [ * * 1 ]
        >>> _.polynomial('X,Y,Z')
        X^2 + 2*X*Y + Y^2 + 3*X*Z + Z^2

  coeffs()

    The coefficients of a quadratic form.

    Given

    \[f(x) = \sum_{0\leq i<n} a_i x_i^2 + \sum_{0\leq j <k<n} a_{jk} x_j x_k\]

    this function returns \(a = (a_0, \dots, a_n, a_{00}, a_{01}, \dots, a_{n-1,n})\)

    EXAMPLES:

    Sage

        sage: R.<a,b,c,d,e,f,g, x,y,z> = QQ[]
        sage: p = a*x^2 + b*y^2 + c*z^2 + d*x*y + e*x*z + f*y*z
        sage: inv = invariant_theory.quadratic_form(p, x,y,z); inv
        Ternary quadratic with coefficients (a, b, c, d, e, f)
        sage: inv.coeffs()
        (a, b, c, d, e, f)
        sage: inv.scaled_coeffs()
        (a, b, c, 1/2*d, 1/2*e, 1/2*f)

    Python

        >>> from sage.all import *
        >>> R = QQ['a, b, c, d, e, f, g, x, y, z']; (a, b, c, d, e, f, g, x, y, z,) = R._first_ngens(10)
        >>> p = a*x**Integer(2) + b*y**Integer(2) + c*z**Integer(2) + d*x*y + e*x*z + f*y*z
        >>> inv = invariant_theory.quadratic_form(p, x,y,z); inv
        Ternary quadratic with coefficients (a, b, c, d, e, f)
        >>> inv.coeffs()
        (a, b, c, d, e, f)
        >>> inv.scaled_coeffs()
        (a, b, c, 1/2*d, 1/2*e, 1/2*f)

  discriminant()

    Return the discriminant of the quadratic form.

    Up to an overall constant factor, this is just the determinant of the defining matrix, see `matrix()`. For a quadratic form in \(n\) variables, the overall constant is \(2^{n-1}\) if \(n\) is odd and \((-1)^{n/2} 2^n\) if \(n\) is even.

    EXAMPLES:

    Sage

        sage: R.<a,b,c, x,y> = QQ[]
        sage: p = a*x^2 + b*x*y + c*y^2
        sage: quadratic = invariant_theory.quadratic_form(p, x,y)
        sage: quadratic.discriminant()
        b^2 - 4*a*c

        sage: R.<a,b,c,d,e,f,g, x,y,z> = QQ[]
        sage: p = a*x^2 + b*y^2 + c*z^2 + d*x*y + e*x*z + f*y*z
        sage: quadratic = invariant_theory.quadratic_form(p, x,y,z)
        sage: quadratic.discriminant()
        4*a*b*c - c*d^2 - b*e^2 + d*e*f - a*f^2

    Python

        >>> from sage.all import *
        >>> R = QQ['a, b, c, x, y']; (a, b, c, x, y,) = R._first_ngens(5)
        >>> p = a*x**Integer(2) + b*x*y + c*y**Integer(2)
        >>> quadratic = invariant_theory.quadratic_form(p, x,y)
        >>> quadratic.discriminant()
        b^2 - 4*a*c

        >>> R = QQ['a, b, c, d, e, f, g, x, y, z']; (a, b, c, d, e, f, g, x, y, z,) = R._first_ngens(10)
        >>> p = a*x**Integer(2) + b*y**Integer(2) + c*z**Integer(2) + d*x*y + e*x*z + f*y*z
        >>> quadratic = invariant_theory.quadratic_form(p, x,y,z)
        >>> quadratic.discriminant()
        4*a*b*c - c*d^2 - b*e^2 + d*e*f - a*f^2

  dual()

    Return the dual quadratic form.

    OUTPUT:

    A new quadratic form (with the same number of variables) defined by the adjoint matrix.

    EXAMPLES:

    Sage

        sage: R.<a,b,c,x,y,z> = QQ[]
        sage: cubic = x^2+y^2+z^2
        sage: quadratic = invariant_theory.ternary_quadratic(a*x^2+b*y^2+c*z^2, [x,y,z])
        sage: quadratic.form()
        a*x^2 + b*y^2 + c*z^2
        sage: quadratic.dual().form()
        b*c*x^2 + a*c*y^2 + a*b*z^2

        sage: R.<x,y,z, t> = QQ[]
        sage: cubic = x^2+y^2+z^2
        sage: quadratic = invariant_theory.ternary_quadratic(x^2+y^2+z^2 + t*x*y, [x,y,z])
        sage: quadratic.dual()
        Ternary quadratic with coefficients (1, 1, -1/4*t^2 + 1, -t, 0, 0)

        sage: R.<x,y, t> = QQ[]
        sage: quadratic = invariant_theory.ternary_quadratic(x^2+y^2+1 + t*x*y, [x,y])
        sage: quadratic.dual()
        Ternary quadratic with coefficients (1, 1, -1/4*t^2 + 1, -t, 0, 0)

    Python

        >>> from sage.all import *
        >>> R = QQ['a, b, c, x, y, z']; (a, b, c, x, y, z,) = R._first_ngens(6)
        >>> cubic = x**Integer(2)+y**Integer(2)+z**Integer(2)
        >>> quadratic = invariant_theory.ternary_quadratic(a*x**Integer(2)+b*y**Integer(2)+c*z**Integer(2), [x,y,z])
        >>> quadratic.form()
        a*x^2 + b*y^2 + c*z^2
        >>> quadratic.dual().form()
        b*c*x^2 + a*c*y^2 + a*b*z^2

        >>> R = QQ['x, y, z, t']; (x, y, z, t,) = R._first_ngens(4)
        >>> cubic = x**Integer(2)+y**Integer(2)+z**Integer(2)
        >>> quadratic = invariant_theory.ternary_quadratic(x**Integer(2)+y**Integer(2)+z**Integer(2) + t*x*y, [x,y,z])
        >>> quadratic.dual()
        Ternary quadratic with coefficients (1, 1, -1/4*t^2 + 1, -t, 0, 0)

        >>> R = QQ['x, y, t']; (x, y, t,) = R._first_ngens(3)
        >>> quadratic = invariant_theory.ternary_quadratic(x**Integer(2)+y**Integer(2)+Integer(1) + t*x*y, [x,y])
        >>> quadratic.dual()
        Ternary quadratic with coefficients (1, 1, -1/4*t^2 + 1, -t, 0, 0)

  classmethod from_invariants(discriminant, x, z, *args, **kwargs)

    Construct a binary quadratic from its discriminant.

    This function constructs a binary quadratic whose discriminant equal the one provided as argument up to scaling.

    INPUT:

    - `discriminant` – value of the discriminant used to reconstruct the binary quadratic

    OUTPUT: a QuadraticForm with 2 variables

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: from sage.rings.invariants.invariant_theory import QuadraticForm
        sage: QuadraticForm.from_invariants(1, x, y)
        Binary quadratic with coefficients (1, -1/4, 0)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> from sage.rings.invariants.invariant_theory import QuadraticForm
        >>> QuadraticForm.from_invariants(Integer(1), x, y)
        Binary quadratic with coefficients (1, -1/4, 0)

  invariants(type='discriminant')

    Return a tuple of invariants of a binary quadratic.

    INPUT:

    - `type` – the type of invariants to return; the default choice is to return the discriminant

    OUTPUT: the invariants of the binary quadratic

    EXAMPLES:

    Sage

        sage: R.<x0, x1> = QQ[]
        sage: p = 2*x1^2 + 5*x0*x1 + 3*x0^2
        sage: quadratic = invariant_theory.binary_quadratic(p, x0, x1)
        sage: quadratic.invariants()
        (1,)
        sage: quadratic.invariants('unknown')
        Traceback (most recent call last):
        ...
        ValueError: unknown type of invariants unknown for a binary quadratic

    Python

        >>> from sage.all import *
        >>> R = QQ['x0, x1']; (x0, x1,) = R._first_ngens(2)
        >>> p = Integer(2)*x1**Integer(2) + Integer(5)*x0*x1 + Integer(3)*x0**Integer(2)
        >>> quadratic = invariant_theory.binary_quadratic(p, x0, x1)
        >>> quadratic.invariants()
        (1,)
        >>> quadratic.invariants('unknown')
        Traceback (most recent call last):
        ...
        ValueError: unknown type of invariants unknown for a binary quadratic

  matrix()

    Return the quadratic form as a symmetric matrix.

    OUTPUT:

    This method returns a symmetric matrix \(A\) such that the quadratic \(Q\) equals

    \[Q(x,y,z,\dots) = (x,y,\dots) A (x,y,\dots)^t\]

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: quadratic = invariant_theory.ternary_quadratic(x^2+y^2+z^2+x*y)
        sage: matrix(quadratic)
        [  1 1/2   0]
        [1/2   1   0]
        [  0   0   1]
        sage: quadratic._matrix_() == matrix(quadratic)
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> quadratic = invariant_theory.ternary_quadratic(x**Integer(2)+y**Integer(2)+z**Integer(2)+x*y)
        >>> matrix(quadratic)
        [  1 1/2   0]
        [1/2   1   0]
        [  0   0   1]
        >>> quadratic._matrix_() == matrix(quadratic)
        True

  monomials()

    List the basis monomials in the form.

    OUTPUT:

    A tuple of monomials. They are in the same order as `coeffs()`.

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: quadratic = invariant_theory.quadratic_form(x^2 + y^2)
        sage: quadratic.monomials()
        (x^2, y^2, x*y)

        sage: quadratic = invariant_theory.inhomogeneous_quadratic_form(x^2 + y^2)
        sage: quadratic.monomials()
        (x^2, y^2, 1, x*y, x, y)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> quadratic = invariant_theory.quadratic_form(x**Integer(2) + y**Integer(2))
        >>> quadratic.monomials()
        (x^2, y^2, x*y)

        >>> quadratic = invariant_theory.inhomogeneous_quadratic_form(x**Integer(2) + y**Integer(2))
        >>> quadratic.monomials()
        (x^2, y^2, 1, x*y, x, y)

  scaled_coeffs()

    The scaled coefficients of a quadratic form.

    Given

    \[f(x) = \sum_{0\leq i<n} a_i x_i^2 + \sum_{0\leq j <k<n} 2 a_{jk} x_j x_k\]

    this function returns \(a = (a_0, \cdots, a_n, a_{00}, a_{01}, \dots, a_{n-1,n})\)

    EXAMPLES:

    Sage

        sage: R.<a,b,c,d,e,f,g, x,y,z> = QQ[]
        sage: p = a*x^2 + b*y^2 + c*z^2 + d*x*y + e*x*z + f*y*z
        sage: inv = invariant_theory.quadratic_form(p, x,y,z); inv
        Ternary quadratic with coefficients (a, b, c, d, e, f)
        sage: inv.coeffs()
        (a, b, c, d, e, f)
        sage: inv.scaled_coeffs()
        (a, b, c, 1/2*d, 1/2*e, 1/2*f)

    Python

        >>> from sage.all import *
        >>> R = QQ['a, b, c, d, e, f, g, x, y, z']; (a, b, c, d, e, f, g, x, y, z,) = R._first_ngens(10)
        >>> p = a*x**Integer(2) + b*y**Integer(2) + c*z**Integer(2) + d*x*y + e*x*z + f*y*z
        >>> inv = invariant_theory.quadratic_form(p, x,y,z); inv
        Ternary quadratic with coefficients (a, b, c, d, e, f)
        >>> inv.coeffs()
        (a, b, c, d, e, f)
        >>> inv.scaled_coeffs()
        (a, b, c, 1/2*d, 1/2*e, 1/2*f)

class sage.rings.invariants.invariant_theory.SeveralAlgebraicForms(forms)

  Bases: `FormsBase`

  The base class of multiple algebraic forms (i.e. homogeneous polynomials).

  You should only instantiate the derived classes of this base class.

  See `AlgebraicForm` for the base class of a single algebraic form.

  INPUT:

  - `forms` – list/tuple/iterable of at least one `AlgebraicForm` object, all with the same number of variables. Interpreted as multiple homogeneous polynomials in a common polynomial ring.

  EXAMPLES:

  Sage

      sage: from sage.rings.invariants.invariant_theory import AlgebraicForm, SeveralAlgebraicForms
      sage: R.<x,y> = QQ[]
      sage: p = AlgebraicForm(2, 2, x^2, (x,y))
      sage: q = AlgebraicForm(2, 2, y^2, (x,y))
      sage: pq = SeveralAlgebraicForms([p, q])

  Python

      >>> from sage.all import *
      >>> from sage.rings.invariants.invariant_theory import AlgebraicForm, SeveralAlgebraicForms
      >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
      >>> p = AlgebraicForm(Integer(2), Integer(2), x**Integer(2), (x,y))
      >>> q = AlgebraicForm(Integer(2), Integer(2), y**Integer(2), (x,y))
      >>> pq = SeveralAlgebraicForms([p, q])

  get_form(i)

    Return the \(i\)-th form.

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: q1 = invariant_theory.quadratic_form(x^2 + y^2)
        sage: q2 = invariant_theory.quadratic_form(x*y)
        sage: from sage.rings.invariants.invariant_theory import SeveralAlgebraicForms
        sage: q12 = SeveralAlgebraicForms([q1, q2])
        sage: q12.get_form(0) is q1
        True
        sage: q12.get_form(1) is q2
        True
        sage: q12[0] is q12.get_form(0)   # syntactic sugar
        True
        sage: q12[1] is q12.get_form(1)   # syntactic sugar
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> q1 = invariant_theory.quadratic_form(x**Integer(2) + y**Integer(2))
        >>> q2 = invariant_theory.quadratic_form(x*y)
        >>> from sage.rings.invariants.invariant_theory import SeveralAlgebraicForms
        >>> q12 = SeveralAlgebraicForms([q1, q2])
        >>> q12.get_form(Integer(0)) is q1
        True
        >>> q12.get_form(Integer(1)) is q2
        True
        >>> q12[Integer(0)] is q12.get_form(Integer(0))   # syntactic sugar
        True
        >>> q12[Integer(1)] is q12.get_form(Integer(1))   # syntactic sugar
        True

  homogenized(var='h')

    Return form as defined by a homogeneous polynomial.

    INPUT:

    - `var` – either a variable name, variable index or a variable (default: `'h'`)

    OUTPUT:

    The same algebraic form, but defined by a homogeneous polynomial.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: q = invariant_theory.quaternary_biquadratic(x^2 + 1, y^2 + 1, [x,y,z])
        sage: q
        Joint quaternary quadratic with coefficients (1, 0, 0, 1, 0, 0, 0, 0, 0, 0)
        and quaternary quadratic with coefficients (0, 1, 0, 1, 0, 0, 0, 0, 0, 0)
        sage: q.homogenized()
        Joint quaternary quadratic with coefficients (1, 0, 0, 1, 0, 0, 0, 0, 0, 0)
        and quaternary quadratic with coefficients (0, 1, 0, 1, 0, 0, 0, 0, 0, 0)
        sage: type(q) is type(q.homogenized())
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> q = invariant_theory.quaternary_biquadratic(x**Integer(2) + Integer(1), y**Integer(2) + Integer(1), [x,y,z])
        >>> q
        Joint quaternary quadratic with coefficients (1, 0, 0, 1, 0, 0, 0, 0, 0, 0)
        and quaternary quadratic with coefficients (0, 1, 0, 1, 0, 0, 0, 0, 0, 0)
        >>> q.homogenized()
        Joint quaternary quadratic with coefficients (1, 0, 0, 1, 0, 0, 0, 0, 0, 0)
        and quaternary quadratic with coefficients (0, 1, 0, 1, 0, 0, 0, 0, 0, 0)
        >>> type(q) is type(q.homogenized())
        True

  n_forms()

    Return the number of forms.

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: q1 = invariant_theory.quadratic_form(x^2 + y^2)
        sage: q2 = invariant_theory.quadratic_form(x*y)
        sage: from sage.rings.invariants.invariant_theory import SeveralAlgebraicForms
        sage: q12 = SeveralAlgebraicForms([q1, q2])
        sage: q12.n_forms()
        2
        sage: len(q12) == q12.n_forms()    # syntactic sugar
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> q1 = invariant_theory.quadratic_form(x**Integer(2) + y**Integer(2))
        >>> q2 = invariant_theory.quadratic_form(x*y)
        >>> from sage.rings.invariants.invariant_theory import SeveralAlgebraicForms
        >>> q12 = SeveralAlgebraicForms([q1, q2])
        >>> q12.n_forms()
        2
        >>> len(q12) == q12.n_forms()    # syntactic sugar
        True

class sage.rings.invariants.invariant_theory.TernaryCubic(n, d, polynomial, *args)

  Bases: `AlgebraicForm`

  Invariant theory of a ternary cubic.

  You should use the `invariant_theory` factory object to construct instances of this class. See `ternary_cubic()` for details.

  Hessian()

    Return the Hessian covariant.

    OUTPUT:

    The Hessian matrix multiplied with the conventional normalization factor \(1/216\).

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + z^3)
        sage: cubic.Hessian()
        x*y*z

        sage: R.<x,y> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + 1)
        sage: cubic.Hessian()
        x*y

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3))
        >>> cubic.Hessian()
        x*y*z

        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + Integer(1))
        >>> cubic.Hessian()
        x*y

  J_covariant()

    Return the J-covariant of the ternary cubic.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + z^3)
        sage: cubic.J_covariant()
        x^6*y^3 - x^3*y^6 - x^6*z^3 + y^6*z^3 + x^3*z^6 - y^3*z^6

        sage: R.<x,y> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + 1)
        sage: cubic.J_covariant()
        x^6*y^3 - x^3*y^6 - x^6 + y^6 + x^3 - y^3

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3))
        >>> cubic.J_covariant()
        x^6*y^3 - x^3*y^6 - x^6*z^3 + y^6*z^3 + x^3*z^6 - y^3*z^6

        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + Integer(1))
        >>> cubic.J_covariant()
        x^6*y^3 - x^3*y^6 - x^6 + y^6 + x^3 - y^3

  S_invariant()

    Return the S-invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^2*y + y^3 + z^3 + x*y*z)
        sage: cubic.S_invariant()
        -1/1296

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(2)*y + y**Integer(3) + z**Integer(3) + x*y*z)
        >>> cubic.S_invariant()
        -1/1296

  T_invariant()

    Return the T-invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + z^3)
        sage: cubic.T_invariant()
        1

        sage: R.<x,y,z,t> = GF(7)[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + z^3 + t*x*y*z, [x,y,z])
        sage: cubic.T_invariant()
        -t^6 - t^3 + 1

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3))
        >>> cubic.T_invariant()
        1

        >>> R = GF(Integer(7))['x, y, z, t']; (x, y, z, t,) = R._first_ngens(4)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3) + t*x*y*z, [x,y,z])
        >>> cubic.T_invariant()
        -t^6 - t^3 + 1

  Theta_covariant()

    Return the \(\Theta\) covariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + z^3)
        sage: cubic.Theta_covariant()
        -x^3*y^3 - x^3*z^3 - y^3*z^3

        sage: R.<x,y> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3 + y^3 + 1)
        sage: cubic.Theta_covariant()
        -x^3*y^3 - x^3 - y^3

        sage: R.<x,y,z,a30,a21,a12,a03,a20,a11,a02,a10,a01,a00> = QQ[]
        sage: p = ( a30*x^3 + a21*x^2*y + a12*x*y^2 + a03*y^3 + a20*x^2*z +
        ....:       a11*x*y*z + a02*y^2*z + a10*x*z^2 + a01*y*z^2 + a00*z^3 )
        sage: cubic = invariant_theory.ternary_cubic(p, x,y,z)
        sage: len(list(cubic.Theta_covariant()))
        6952

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + z**Integer(3))
        >>> cubic.Theta_covariant()
        -x^3*y^3 - x^3*z^3 - y^3*z^3

        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3) + y**Integer(3) + Integer(1))
        >>> cubic.Theta_covariant()
        -x^3*y^3 - x^3 - y^3

        >>> R = QQ['x, y, z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00']; (x, y, z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00,) = R._first_ngens(13)
        >>> p = ( a30*x**Integer(3) + a21*x**Integer(2)*y + a12*x*y**Integer(2) + a03*y**Integer(3) + a20*x**Integer(2)*z +
        ...       a11*x*y*z + a02*y**Integer(2)*z + a10*x*z**Integer(2) + a01*y*z**Integer(2) + a00*z**Integer(3) )
        >>> cubic = invariant_theory.ternary_cubic(p, x,y,z)
        >>> len(list(cubic.Theta_covariant()))
        6952

  coeffs()

    Return the coefficients of a cubic.

    Given

    \[\begin{split}\begin{split} p(x,y) =&\; a_{30} x^{3} + a_{21} x^{2} y + a_{12} x y^{2} + a_{03} y^{3} + a_{20} x^{2} + \\ &\; a_{11} x y + a_{02} y^{2} + a_{10} x + a_{01} y + a_{00} \end{split}\end{split}\]

    this function returns \(a = (a_{30}, a_{03}, a_{00}, a_{21}, a_{20}, a_{12}, a_{02}, a_{10}, a_{01}, a_{11})\)

    EXAMPLES:

    Sage

        sage: R.<x,y,z,a30,a21,a12,a03,a20,a11,a02,a10,a01,a00> = QQ[]
        sage: p = ( a30*x^3 + a21*x^2*y + a12*x*y^2 + a03*y^3 + a20*x^2*z +
        ....:       a11*x*y*z + a02*y^2*z + a10*x*z^2 + a01*y*z^2 + a00*z^3 )
        sage: invariant_theory.ternary_cubic(p, x,y,z).coeffs()
        (a30, a03, a00, a21, a20, a12, a02, a10, a01, a11)
        sage: invariant_theory.ternary_cubic(p.subs(z=1), x, y).coeffs()
        (a30, a03, a00, a21, a20, a12, a02, a10, a01, a11)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00']; (x, y, z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00,) = R._first_ngens(13)
        >>> p = ( a30*x**Integer(3) + a21*x**Integer(2)*y + a12*x*y**Integer(2) + a03*y**Integer(3) + a20*x**Integer(2)*z +
        ...       a11*x*y*z + a02*y**Integer(2)*z + a10*x*z**Integer(2) + a01*y*z**Integer(2) + a00*z**Integer(3) )
        >>> invariant_theory.ternary_cubic(p, x,y,z).coeffs()
        (a30, a03, a00, a21, a20, a12, a02, a10, a01, a11)
        >>> invariant_theory.ternary_cubic(p.subs(z=Integer(1)), x, y).coeffs()
        (a30, a03, a00, a21, a20, a12, a02, a10, a01, a11)

  monomials()

    List the basis monomials of the form.

    OUTPUT:

    A tuple of monomials. They are in the same order as `coeffs()`.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: cubic = invariant_theory.ternary_cubic(x^3+y*z^2)
        sage: cubic.monomials()
        (x^3, y^3, z^3, x^2*y, x^2*z, x*y^2, y^2*z, x*z^2, y*z^2, x*y*z)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> cubic = invariant_theory.ternary_cubic(x**Integer(3)+y*z**Integer(2))
        >>> cubic.monomials()
        (x^3, y^3, z^3, x^2*y, x^2*z, x*y^2, y^2*z, x*z^2, y*z^2, x*y*z)

  polar_conic()

    Return the polar conic of the cubic.

    OUTPUT:

    Given the ternary cubic \(f(X,Y,Z)\), this method returns the symmetric matrix \(A(x,y,z)\) defined by

    \[x f_X + y f_Y + z f_Z = (X,Y,Z) \cdot A(x,y,z) \cdot (X,Y,Z)^t\]

    EXAMPLES:

    Sage

        sage: R.<x,y,z,X,Y,Z,a30,a21,a12,a03,a20,a11,a02,a10,a01,a00> = QQ[]
        sage: p = ( a30*x^3 + a21*x^2*y + a12*x*y^2 + a03*y^3 + a20*x^2*z +
        ....:       a11*x*y*z + a02*y^2*z + a10*x*z^2 + a01*y*z^2 + a00*z^3 )
        sage: cubic = invariant_theory.ternary_cubic(p, x,y,z)
        sage: cubic.polar_conic()
        [  3*x*a30 + y*a21 + z*a20 x*a21 + y*a12 + 1/2*z*a11 x*a20 + 1/2*y*a11 + z*a10]
        [x*a21 + y*a12 + 1/2*z*a11   x*a12 + 3*y*a03 + z*a02 1/2*x*a11 + y*a02 + z*a01]
        [x*a20 + 1/2*y*a11 + z*a10 1/2*x*a11 + y*a02 + z*a01   x*a10 + y*a01 + 3*z*a00]

        sage: polar_eqn = X*p.derivative(x) + Y*p.derivative(y) + Z*p.derivative(z)
        sage: polar = invariant_theory.ternary_quadratic(polar_eqn, [x,y,z])
        sage: polar.matrix().subs(X=x,Y=y,Z=z) == cubic.polar_conic()
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, X, Y, Z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00']; (x, y, z, X, Y, Z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00,) = R._first_ngens(16)
        >>> p = ( a30*x**Integer(3) + a21*x**Integer(2)*y + a12*x*y**Integer(2) + a03*y**Integer(3) + a20*x**Integer(2)*z +
        ...       a11*x*y*z + a02*y**Integer(2)*z + a10*x*z**Integer(2) + a01*y*z**Integer(2) + a00*z**Integer(3) )
        >>> cubic = invariant_theory.ternary_cubic(p, x,y,z)
        >>> cubic.polar_conic()
        [  3*x*a30 + y*a21 + z*a20 x*a21 + y*a12 + 1/2*z*a11 x*a20 + 1/2*y*a11 + z*a10]
        [x*a21 + y*a12 + 1/2*z*a11   x*a12 + 3*y*a03 + z*a02 1/2*x*a11 + y*a02 + z*a01]
        [x*a20 + 1/2*y*a11 + z*a10 1/2*x*a11 + y*a02 + z*a01   x*a10 + y*a01 + 3*z*a00]

        >>> polar_eqn = X*p.derivative(x) + Y*p.derivative(y) + Z*p.derivative(z)
        >>> polar = invariant_theory.ternary_quadratic(polar_eqn, [x,y,z])
        >>> polar.matrix().subs(X=x,Y=y,Z=z) == cubic.polar_conic()
        True

  scaled_coeffs()

    Return the coefficients of a cubic.

    Compared to `coeffs()`, this method returns rescaled coefficients that are often used in invariant theory.

    Given

    \[\begin{split}\begin{split} p(x,y) =&\; a_{30} x^{3} + a_{21} x^{2} y + a_{12} x y^{2} + a_{03} y^{3} + a_{20} x^{2} + \\ &\; a_{11} x y + a_{02} y^{2} + a_{10} x + a_{01} y + a_{00} \end{split}\end{split}\]

    this function returns \(a = (a_{30}, a_{03}, a_{00}, a_{21}/3, a_{20}/3, a_{12}/3, a_{02}/3, a_{10}/3, a_{01}/3, a_{11}/6)\)

    EXAMPLES:

    Sage

        sage: R.<x,y,z,a30,a21,a12,a03,a20,a11,a02,a10,a01,a00> = QQ[]
        sage: p = ( a30*x^3 + a21*x^2*y + a12*x*y^2 + a03*y^3 + a20*x^2*z +
        ....:       a11*x*y*z + a02*y^2*z + a10*x*z^2 + a01*y*z^2 + a00*z^3 )
        sage: invariant_theory.ternary_cubic(p, x,y,z).scaled_coeffs()
        (a30, a03, a00, 1/3*a21, 1/3*a20, 1/3*a12, 1/3*a02, 1/3*a10, 1/3*a01, 1/6*a11)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00']; (x, y, z, a30, a21, a12, a03, a20, a11, a02, a10, a01, a00,) = R._first_ngens(13)
        >>> p = ( a30*x**Integer(3) + a21*x**Integer(2)*y + a12*x*y**Integer(2) + a03*y**Integer(3) + a20*x**Integer(2)*z +
        ...       a11*x*y*z + a02*y**Integer(2)*z + a10*x*z**Integer(2) + a01*y*z**Integer(2) + a00*z**Integer(3) )
        >>> invariant_theory.ternary_cubic(p, x,y,z).scaled_coeffs()
        (a30, a03, a00, 1/3*a21, 1/3*a20, 1/3*a12, 1/3*a02, 1/3*a10, 1/3*a01, 1/6*a11)

  syzygy(U, S, T, H, Theta, J)

    Return the syzygy of the cubic evaluated on the invariants and covariants.

    INPUT:

    - `U`, `S`, `T`, `H`, `Theta`, `J` – polynomials from the same polynomial ring.

    OUTPUT:

    0 if evaluated for the form, the S invariant, the T invariant, the Hessian, the \(\Theta\) covariant and the J-covariant of a ternary cubic.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: monomials = (x^3, y^3, z^3, x^2*y, x^2*z, x*y^2,
        ....:              y^2*z, x*z^2, y*z^2, x*y*z)
        sage: random_poly = sum([ randint(0,10000) * m for m in monomials ])
        sage: cubic = invariant_theory.ternary_cubic(random_poly)
        sage: U = cubic.form()
        sage: S = cubic.S_invariant()
        sage: T = cubic.T_invariant()
        sage: H = cubic.Hessian()
        sage: Theta = cubic.Theta_covariant()
        sage: J = cubic.J_covariant()
        sage: cubic.syzygy(U, S, T, H, Theta, J)
        0

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> monomials = (x**Integer(3), y**Integer(3), z**Integer(3), x**Integer(2)*y, x**Integer(2)*z, x*y**Integer(2),
        ...              y**Integer(2)*z, x*z**Integer(2), y*z**Integer(2), x*y*z)
        >>> random_poly = sum([ randint(Integer(0),Integer(10000)) * m for m in monomials ])
        >>> cubic = invariant_theory.ternary_cubic(random_poly)
        >>> U = cubic.form()
        >>> S = cubic.S_invariant()
        >>> T = cubic.T_invariant()
        >>> H = cubic.Hessian()
        >>> Theta = cubic.Theta_covariant()
        >>> J = cubic.J_covariant()
        >>> cubic.syzygy(U, S, T, H, Theta, J)
        0

class sage.rings.invariants.invariant_theory.TernaryQuadratic(n, d, polynomial, *args)

  Bases: `QuadraticForm`

  Invariant theory of a ternary quadratic.

  You should use the `invariant_theory` factory object to construct instances of this class. See `ternary_quadratic()` for details.

  coeffs()

    Return the coefficients of a quadratic.

    Given

    \[p(x,y) =&\; a_{20} x^{2} + a_{11} x y + a_{02} y^{2} + a_{10} x + a_{01} y + a_{00}\]

    this function returns \(a = (a_{20}, a_{02}, a_{00}, a_{11}, a_{10}, a_{01} )\)

    EXAMPLES:

    Sage

        sage: R.<x,y,z,a20,a11,a02,a10,a01,a00> = QQ[]
        sage: p = ( a20*x^2 + a11*x*y + a02*y^2 +
        ....:       a10*x*z + a01*y*z + a00*z^2 )
        sage: invariant_theory.ternary_quadratic(p, x,y,z).coeffs()
        (a20, a02, a00, a11, a10, a01)
        sage: invariant_theory.ternary_quadratic(p.subs(z=1), x, y).coeffs()
        (a20, a02, a00, a11, a10, a01)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, a20, a11, a02, a10, a01, a00']; (x, y, z, a20, a11, a02, a10, a01, a00,) = R._first_ngens(9)
        >>> p = ( a20*x**Integer(2) + a11*x*y + a02*y**Integer(2) +
        ...       a10*x*z + a01*y*z + a00*z**Integer(2) )
        >>> invariant_theory.ternary_quadratic(p, x,y,z).coeffs()
        (a20, a02, a00, a11, a10, a01)
        >>> invariant_theory.ternary_quadratic(p.subs(z=Integer(1)), x, y).coeffs()
        (a20, a02, a00, a11, a10, a01)

  covariant_conic(other)

    Return the ternary quadratic covariant to `self` and `other`.

    INPUT:

    - `other` – another ternary quadratic

    OUTPUT:

    The so-called covariant conic, a ternary quadratic. It is symmetric under exchange of `self` and `other`.

    EXAMPLES:

    Sage

        sage: ring.<x,y,z> = QQ[]
        sage: Q = invariant_theory.ternary_quadratic(x^2 + y^2 + z^2)
        sage: R = invariant_theory.ternary_quadratic(x*y + x*z + y*z)
        sage: Q.covariant_conic(R)
        -x*y - x*z - y*z
        sage: R.covariant_conic(Q)
        -x*y - x*z - y*z

    Python

        >>> from sage.all import *
        >>> ring = QQ['x, y, z']; (x, y, z,) = ring._first_ngens(3)
        >>> Q = invariant_theory.ternary_quadratic(x**Integer(2) + y**Integer(2) + z**Integer(2))
        >>> R = invariant_theory.ternary_quadratic(x*y + x*z + y*z)
        >>> Q.covariant_conic(R)
        -x*y - x*z - y*z
        >>> R.covariant_conic(Q)
        -x*y - x*z - y*z

  monomials()

    List the basis monomials of the form.

    OUTPUT:

    A tuple of monomials. They are in the same order as `coeffs()`.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: quadratic = invariant_theory.ternary_quadratic(x^2 + y*z)
        sage: quadratic.monomials()
        (x^2, y^2, z^2, x*y, x*z, y*z)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> quadratic = invariant_theory.ternary_quadratic(x**Integer(2) + y*z)
        >>> quadratic.monomials()
        (x^2, y^2, z^2, x*y, x*z, y*z)

  scaled_coeffs()

    Return the scaled coefficients of a quadratic.

    Given

    \[p(x,y) =&\; a_{20} x^{2} + a_{11} x y + a_{02} y^{2} + a_{10} x + a_{01} y + a_{00}\]

    this function returns \(a = (a_{20}, a_{02}, a_{00}, a_{11}/2, a_{10}/2, a_{01}/2, )\)

    EXAMPLES:

    Sage

        sage: R.<x,y,z,a20,a11,a02,a10,a01,a00> = QQ[]
        sage: p = ( a20*x^2 + a11*x*y + a02*y^2 +
        ....:       a10*x*z + a01*y*z + a00*z^2 )
        sage: invariant_theory.ternary_quadratic(p, x,y,z).scaled_coeffs()
        (a20, a02, a00, 1/2*a11, 1/2*a10, 1/2*a01)
        sage: invariant_theory.ternary_quadratic(p.subs(z=1), x, y).scaled_coeffs()
        (a20, a02, a00, 1/2*a11, 1/2*a10, 1/2*a01)

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, a20, a11, a02, a10, a01, a00']; (x, y, z, a20, a11, a02, a10, a01, a00,) = R._first_ngens(9)
        >>> p = ( a20*x**Integer(2) + a11*x*y + a02*y**Integer(2) +
        ...       a10*x*z + a01*y*z + a00*z**Integer(2) )
        >>> invariant_theory.ternary_quadratic(p, x,y,z).scaled_coeffs()
        (a20, a02, a00, 1/2*a11, 1/2*a10, 1/2*a01)
        >>> invariant_theory.ternary_quadratic(p.subs(z=Integer(1)), x, y).scaled_coeffs()
        (a20, a02, a00, 1/2*a11, 1/2*a10, 1/2*a01)

class sage.rings.invariants.invariant_theory.TwoAlgebraicForms(forms)

  Bases: `SeveralAlgebraicForms`

  first()

    Return the first of the two forms.

    OUTPUT: the first algebraic form used in the definition

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: q0 = invariant_theory.quadratic_form(x^2 + y^2)
        sage: q1 = invariant_theory.quadratic_form(x*y)
        sage: from sage.rings.invariants.invariant_theory import TwoAlgebraicForms
        sage: q = TwoAlgebraicForms([q0, q1])
        sage: q.first() is q0
        True
        sage: q.get_form(0) is q0
        True
        sage: q.first().polynomial()
        x^2 + y^2

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> q0 = invariant_theory.quadratic_form(x**Integer(2) + y**Integer(2))
        >>> q1 = invariant_theory.quadratic_form(x*y)
        >>> from sage.rings.invariants.invariant_theory import TwoAlgebraicForms
        >>> q = TwoAlgebraicForms([q0, q1])
        >>> q.first() is q0
        True
        >>> q.get_form(Integer(0)) is q0
        True
        >>> q.first().polynomial()
        x^2 + y^2

  second()

    Return the second of the two forms.

    OUTPUT: the second form used in the definition

    EXAMPLES:

    Sage

        sage: R.<x,y> = QQ[]
        sage: q0 = invariant_theory.quadratic_form(x^2 + y^2)
        sage: q1 = invariant_theory.quadratic_form(x*y)
        sage: from sage.rings.invariants.invariant_theory import TwoAlgebraicForms
        sage: q = TwoAlgebraicForms([q0, q1])
        sage: q.second() is q1
        True
        sage: q.get_form(1) is q1
        True
        sage: q.second().polynomial()
        x*y

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
        >>> q0 = invariant_theory.quadratic_form(x**Integer(2) + y**Integer(2))
        >>> q1 = invariant_theory.quadratic_form(x*y)
        >>> from sage.rings.invariants.invariant_theory import TwoAlgebraicForms
        >>> q = TwoAlgebraicForms([q0, q1])
        >>> q.second() is q1
        True
        >>> q.get_form(Integer(1)) is q1
        True
        >>> q.second().polynomial()
        x*y

class sage.rings.invariants.invariant_theory.TwoQuaternaryQuadratics(forms)

  Bases: `TwoAlgebraicForms`

  Invariant theory of two quaternary quadratics.

  You should use the `invariant_theory` factory object to construct instances of this class. See `quaternary_biquadratics()` for details.

  REFERENCES:

  - section on “Invariants and Covariants of Systems of Quadrics” in [Sal1958], [Sal1965]

  Delta_invariant()

    Return the \(\Delta\) invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Delta_invariant() == coeffs[4]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Delta_invariant() == coeffs[Integer(4)]
        True

  Delta_prime_invariant()

    Return the \(\Delta'\) invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Delta_prime_invariant() == coeffs[0]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Delta_prime_invariant() == coeffs[Integer(0)]
        True

  J_covariant()

    The \(J\)-covariant.

    This is the Jacobian determinant of the two biquadratics, the \(T\)-covariant, and the \(T'\)-covariant with respect to the four homogeneous variables.

    EXAMPLES:

    Sage

        sage: R.<w,x,y,z,a0,a1,a2,a3,A0,A1,A2,A3> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3*w^2
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3*w^2
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [w, x, y, z])
        sage: q.J_covariant().factor()
        z * y * x * w * (-a1*A0 + a0*A1) * (-a2*A0 + a0*A2) * (-a2*A1 + a1*A2)
        * (a3*A2 - a2*A3) * (a3*A1 - a1*A3) * (a3*A0 - a0*A3)

    Python

        >>> from sage.all import *
        >>> R = QQ['w, x, y, z, a0, a1, a2, a3, A0, A1, A2, A3']; (w, x, y, z, a0, a1, a2, a3, A0, A1, A2, A3,) = R._first_ngens(12)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3*w**Integer(2)
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3*w**Integer(2)
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [w, x, y, z])
        >>> q.J_covariant().factor()
        z * y * x * w * (-a1*A0 + a0*A1) * (-a2*A0 + a0*A2) * (-a2*A1 + a1*A2)
        * (a3*A2 - a2*A3) * (a3*A1 - a1*A3) * (a3*A0 - a0*A3)

  Phi_invariant()

    Return the \(\Phi'\) invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Phi_invariant() == coeffs[2]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Phi_invariant() == coeffs[Integer(2)]
        True

  T_covariant()

    The \(T\)-covariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: T = invariant_theory.quaternary_quadratic(q.T_covariant(), [x,y,z]).matrix()
        sage: M = q[0].matrix().adjugate() + t*q[1].matrix().adjugate()
        sage: M = M.adjugate().apply_map(             # long time (4s on my thinkpad W530)
        ....:         lambda m: m.coefficient(t))
        sage: M == q.Delta_invariant()*T             # long time
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> T = invariant_theory.quaternary_quadratic(q.T_covariant(), [x,y,z]).matrix()
        >>> M = q[Integer(0)].matrix().adjugate() + t*q[Integer(1)].matrix().adjugate()
        >>> M = M.adjugate().apply_map(             # long time (4s on my thinkpad W530)
        ...         lambda m: m.coefficient(t))
        >>> M == q.Delta_invariant()*T             # long time
        True

  T_prime_covariant()

    The \(T'\)-covariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: Tprime = invariant_theory.quaternary_quadratic(
        ....:     q.T_prime_covariant(), [x,y,z]).matrix()
        sage: M = q[0].matrix().adjugate() + t*q[1].matrix().adjugate()
        sage: M = M.adjugate().apply_map(                # long time (4s on my thinkpad W530)
        ....:         lambda m: m.coefficient(t^2))
        sage: M == q.Delta_prime_invariant() * Tprime   # long time
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> Tprime = invariant_theory.quaternary_quadratic(
        ...     q.T_prime_covariant(), [x,y,z]).matrix()
        >>> M = q[Integer(0)].matrix().adjugate() + t*q[Integer(1)].matrix().adjugate()
        >>> M = M.adjugate().apply_map(                # long time (4s on my thinkpad W530)
        ...         lambda m: m.coefficient(t**Integer(2)))
        >>> M == q.Delta_prime_invariant() * Tprime   # long time
        True

  Theta_invariant()

    Return the \(\Theta\) invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Theta_invariant() == coeffs[3]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Theta_invariant() == coeffs[Integer(3)]
        True

  Theta_prime_invariant()

    Return the \(\Theta'\) invariant.

    EXAMPLES:

    Sage

        sage: R.<x,y,z,t,a0,a1,a2,a3,b0,b1,b2,b3,b4,b5,A0,A1,A2,A3,B0,B1,B2,B3,B4,B5> = QQ[]
        sage: p1 = a0*x^2 + a1*y^2 + a2*z^2 + a3
        sage: p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        sage: p2 = A0*x^2 + A1*y^2 + A2*z^2 + A3
        sage: p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        sage: q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Theta_prime_invariant() == coeffs[1]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5']; (x, y, z, t, a0, a1, a2, a3, b0, b1, b2, b3, b4, b5, A0, A1, A2, A3, B0, B1, B2, B3, B4, B5,) = R._first_ngens(24)
        >>> p1 = a0*x**Integer(2) + a1*y**Integer(2) + a2*z**Integer(2) + a3
        >>> p1 += b0*x*y + b1*x*z + b2*x + b3*y*z + b4*y + b5*z
        >>> p2 = A0*x**Integer(2) + A1*y**Integer(2) + A2*z**Integer(2) + A3
        >>> p2 += B0*x*y + B1*x*z + B2*x + B3*y*z + B4*y + B5*z
        >>> q = invariant_theory.quaternary_biquadratic(p1, p2, [x, y, z])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Theta_prime_invariant() == coeffs[Integer(1)]
        True

  syzygy(Delta, Theta, Phi, Theta_prime, Delta_prime, U, V, T, T_prime, J)

    Return the syzygy evaluated on the invariants and covariants.

    INPUT:

    - `Delta`, `Theta`, `Phi`, `Theta_prime`, `Delta_prime`, `U`, `V`, `T`, `T_prime`, `J` – polynomials from the same polynomial ring.

    OUTPUT:

    Zero if the `U` is the first polynomial, `V` the second polynomial, and the remaining input are the invariants and covariants of a quaternary biquadratic.

    EXAMPLES:

    Sage

        sage: R.<w,x,y,z> = QQ[]
        sage: monomials = [x^2, x*y, y^2, x*z, y*z, z^2, x*w, y*w, z*w, w^2]
        sage: def q_rnd():  return sum(randint(-1000, 1000)*m for m in monomials)
        sage: biquadratic = invariant_theory.quaternary_biquadratic(q_rnd(), q_rnd())
        sage: Delta = biquadratic.Delta_invariant()
        sage: Theta = biquadratic.Theta_invariant()
        sage: Phi = biquadratic.Phi_invariant()
        sage: Theta_prime = biquadratic.Theta_prime_invariant()
        sage: Delta_prime = biquadratic.Delta_prime_invariant()
        sage: U = biquadratic.first().polynomial()
        sage: V  = biquadratic.second().polynomial()
        sage: T = biquadratic.T_covariant()
        sage: T_prime  = biquadratic.T_prime_covariant()
        sage: J = biquadratic.J_covariant()
        sage: biquadratic.syzygy(Delta, Theta, Phi, Theta_prime, Delta_prime, U, V, T, T_prime, J)
        0

    Python

        >>> from sage.all import *
        >>> R = QQ['w, x, y, z']; (w, x, y, z,) = R._first_ngens(4)
        >>> monomials = [x**Integer(2), x*y, y**Integer(2), x*z, y*z, z**Integer(2), x*w, y*w, z*w, w**Integer(2)]
        >>> def q_rnd():  return sum(randint(-Integer(1000), Integer(1000))*m for m in monomials)
        >>> biquadratic = invariant_theory.quaternary_biquadratic(q_rnd(), q_rnd())
        >>> Delta = biquadratic.Delta_invariant()
        >>> Theta = biquadratic.Theta_invariant()
        >>> Phi = biquadratic.Phi_invariant()
        >>> Theta_prime = biquadratic.Theta_prime_invariant()
        >>> Delta_prime = biquadratic.Delta_prime_invariant()
        >>> U = biquadratic.first().polynomial()
        >>> V  = biquadratic.second().polynomial()
        >>> T = biquadratic.T_covariant()
        >>> T_prime  = biquadratic.T_prime_covariant()
        >>> J = biquadratic.J_covariant()
        >>> biquadratic.syzygy(Delta, Theta, Phi, Theta_prime, Delta_prime, U, V, T, T_prime, J)
        0

    If the arguments are not the invariants and covariants then the output is some (generically nonzero) polynomial:

    Sage

        sage: biquadratic.syzygy(1, 1, 1, 1, 1, 1, 1, 1, 1, x)
        -x^2 + 1

    [Python]

        >>> from sage.all import *
        >>> biquadratic.syzygy(Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), x)
        -x^2 + 1

class sage.rings.invariants.invariant_theory.TwoTernaryQuadratics(forms)

  Bases: `TwoAlgebraicForms`

  Invariant theory of two ternary quadratics.

  You should use the `invariant_theory` factory object to construct instances of this class. See `ternary_biquadratics()` for details.

  REFERENCES:

  - Section on “Invariants and Covariants of Systems of Conics”, Art. 388 (a) in [Sal1954]

  Delta_invariant()

    Return the \(\Delta\) invariant.

    EXAMPLES:

    Sage

        sage: R.<a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t> = QQ[]
        sage: p1 = a00*y0^2 + 2*a01*y0*y1 + a11*y1^2 + 2*a02*y0*y2 + 2*a12*y1*y2 + a22*y2^2
        sage: p2 = b00*y0^2 + 2*b01*y0*y1 + b11*y1^2 + 2*b02*y0*y2 + 2*b12*y1*y2 + b22*y2^2
        sage: q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Delta_invariant() == coeffs[3]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t']; (a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t,) = R._first_ngens(16)
        >>> p1 = a00*y0**Integer(2) + Integer(2)*a01*y0*y1 + a11*y1**Integer(2) + Integer(2)*a02*y0*y2 + Integer(2)*a12*y1*y2 + a22*y2**Integer(2)
        >>> p2 = b00*y0**Integer(2) + Integer(2)*b01*y0*y1 + b11*y1**Integer(2) + Integer(2)*b02*y0*y2 + Integer(2)*b12*y1*y2 + b22*y2**Integer(2)
        >>> q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Delta_invariant() == coeffs[Integer(3)]
        True

  Delta_prime_invariant()

    Return the \(\Delta'\) invariant.

    EXAMPLES:

    Sage

        sage: R.<a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t> = QQ[]
        sage: p1 = a00*y0^2 + 2*a01*y0*y1 + a11*y1^2 + 2*a02*y0*y2 + 2*a12*y1*y2 + a22*y2^2
        sage: p2 = b00*y0^2 + 2*b01*y0*y1 + b11*y1^2 + 2*b02*y0*y2 + 2*b12*y1*y2 + b22*y2^2
        sage: q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Delta_prime_invariant() == coeffs[0]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t']; (a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t,) = R._first_ngens(16)
        >>> p1 = a00*y0**Integer(2) + Integer(2)*a01*y0*y1 + a11*y1**Integer(2) + Integer(2)*a02*y0*y2 + Integer(2)*a12*y1*y2 + a22*y2**Integer(2)
        >>> p2 = b00*y0**Integer(2) + Integer(2)*b01*y0*y1 + b11*y1**Integer(2) + Integer(2)*b02*y0*y2 + Integer(2)*b12*y1*y2 + b22*y2**Integer(2)
        >>> q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Delta_prime_invariant() == coeffs[Integer(0)]
        True

  F_covariant()

    Return the \(F\) covariant.

    EXAMPLES:

    Sage

        sage: R.<a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, x, y> = QQ[]
        sage: p1 = 73*x^2 + 96*x*y - 11*y^2 + 4*x + 63*y + 57
        sage: p2 = 61*x^2 - 100*x*y - 72*y^2 - 81*x + 39*y - 7
        sage: q = invariant_theory.ternary_biquadratic(p1, p2, [x, y])
        sage: q.F_covariant()
        -32566577*x^2 + 29060637/2*x*y + 20153633/4*y^2 -
        30250497/2*x - 241241273/4*y - 323820473/16

    Python

        >>> from sage.all import *
        >>> R = QQ['a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, x, y']; (a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, x, y,) = R._first_ngens(14)
        >>> p1 = Integer(73)*x**Integer(2) + Integer(96)*x*y - Integer(11)*y**Integer(2) + Integer(4)*x + Integer(63)*y + Integer(57)
        >>> p2 = Integer(61)*x**Integer(2) - Integer(100)*x*y - Integer(72)*y**Integer(2) - Integer(81)*x + Integer(39)*y - Integer(7)
        >>> q = invariant_theory.ternary_biquadratic(p1, p2, [x, y])
        >>> q.F_covariant()
        -32566577*x^2 + 29060637/2*x*y + 20153633/4*y^2 -
        30250497/2*x - 241241273/4*y - 323820473/16

  J_covariant()

    Return the \(J\) covariant.

    EXAMPLES:

    Sage

        sage: R.<a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, x, y> = QQ[]
        sage: p1 = 73*x^2 + 96*x*y - 11*y^2 + 4*x + 63*y + 57
        sage: p2 = 61*x^2 - 100*x*y - 72*y^2 - 81*x + 39*y - 7
        sage: q = invariant_theory.ternary_biquadratic(p1, p2, [x, y])
        sage: q.J_covariant()
        1057324024445*x^3 + 1209531088209*x^2*y + 942116599708*x*y^2 +
        984553030871*y^3 + 543715345505/2*x^2 - 3065093506021/2*x*y +
        755263948570*y^2 - 1118430692650*x - 509948695327/4*y + 3369951531745/8

    Python

        >>> from sage.all import *
        >>> R = QQ['a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, x, y']; (a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, x, y,) = R._first_ngens(14)
        >>> p1 = Integer(73)*x**Integer(2) + Integer(96)*x*y - Integer(11)*y**Integer(2) + Integer(4)*x + Integer(63)*y + Integer(57)
        >>> p2 = Integer(61)*x**Integer(2) - Integer(100)*x*y - Integer(72)*y**Integer(2) - Integer(81)*x + Integer(39)*y - Integer(7)
        >>> q = invariant_theory.ternary_biquadratic(p1, p2, [x, y])
        >>> q.J_covariant()
        1057324024445*x^3 + 1209531088209*x^2*y + 942116599708*x*y^2 +
        984553030871*y^3 + 543715345505/2*x^2 - 3065093506021/2*x*y +
        755263948570*y^2 - 1118430692650*x - 509948695327/4*y + 3369951531745/8

  Theta_invariant()

    Return the \(\Theta\) invariant.

    EXAMPLES:

    Sage

        sage: R.<a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t> = QQ[]
        sage: p1 = a00*y0^2 + 2*a01*y0*y1 + a11*y1^2 + 2*a02*y0*y2 + 2*a12*y1*y2 + a22*y2^2
        sage: p2 = b00*y0^2 + 2*b01*y0*y1 + b11*y1^2 + 2*b02*y0*y2 + 2*b12*y1*y2 + b22*y2^2
        sage: q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Theta_invariant() == coeffs[2]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t']; (a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t,) = R._first_ngens(16)
        >>> p1 = a00*y0**Integer(2) + Integer(2)*a01*y0*y1 + a11*y1**Integer(2) + Integer(2)*a02*y0*y2 + Integer(2)*a12*y1*y2 + a22*y2**Integer(2)
        >>> p2 = b00*y0**Integer(2) + Integer(2)*b01*y0*y1 + b11*y1**Integer(2) + Integer(2)*b02*y0*y2 + Integer(2)*b12*y1*y2 + b22*y2**Integer(2)
        >>> q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Theta_invariant() == coeffs[Integer(2)]
        True

  Theta_prime_invariant()

    Return the \(\Theta'\) invariant.

    EXAMPLES:

    Sage

        sage: R.<a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t> = QQ[]
        sage: p1 = a00*y0^2 + 2*a01*y0*y1 + a11*y1^2 + 2*a02*y0*y2 + 2*a12*y1*y2 + a22*y2^2
        sage: p2 = b00*y0^2 + 2*b01*y0*y1 + b11*y1^2 + 2*b02*y0*y2 + 2*b12*y1*y2 + b22*y2^2
        sage: q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        sage: coeffs = det(t * q[0].matrix() + q[1].matrix()).polynomial(t).coefficients(sparse=False)
        sage: q.Theta_prime_invariant() == coeffs[1]
        True

    Python

        >>> from sage.all import *
        >>> R = QQ['a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t']; (a00, a01, a11, a02, a12, a22, b00, b01, b11, b02, b12, b22, y0, y1, y2, t,) = R._first_ngens(16)
        >>> p1 = a00*y0**Integer(2) + Integer(2)*a01*y0*y1 + a11*y1**Integer(2) + Integer(2)*a02*y0*y2 + Integer(2)*a12*y1*y2 + a22*y2**Integer(2)
        >>> p2 = b00*y0**Integer(2) + Integer(2)*b01*y0*y1 + b11*y1**Integer(2) + Integer(2)*b02*y0*y2 + Integer(2)*b12*y1*y2 + b22*y2**Integer(2)
        >>> q = invariant_theory.ternary_biquadratic(p1, p2, [y0, y1, y2])
        >>> coeffs = det(t * q[Integer(0)].matrix() + q[Integer(1)].matrix()).polynomial(t).coefficients(sparse=False)
        >>> q.Theta_prime_invariant() == coeffs[Integer(1)]
        True

  syzygy(Delta, Theta, Theta_prime, Delta_prime, S, S_prime, F, J)

    Return the syzygy evaluated on the invariants and covariants.

    INPUT:

    - `Delta`, `Theta`, `Theta_prime`, `Delta_prime`, `S`, `S_prime`, `F`, `J` – polynomials from the same polynomial ring.

    OUTPUT:

    Zero if `S` is the first polynomial, `S_prime` the second polynomial, and the remaining input are the invariants and covariants of a ternary biquadratic.

    EXAMPLES:

    Sage

        sage: R.<x,y,z> = QQ[]
        sage: monomials = [x^2, x*y, y^2, x*z, y*z, z^2]
        sage: def q_rnd():  return sum(randint(-1000, 1000)*m for m in monomials)
        sage: biquadratic = invariant_theory.ternary_biquadratic(q_rnd(), q_rnd(), [x,y,z])
        sage: Delta = biquadratic.Delta_invariant()
        sage: Theta = biquadratic.Theta_invariant()
        sage: Theta_prime = biquadratic.Theta_prime_invariant()
        sage: Delta_prime = biquadratic.Delta_prime_invariant()
        sage: S = biquadratic.first().polynomial()
        sage: S_prime  = biquadratic.second().polynomial()
        sage: F = biquadratic.F_covariant()
        sage: J = biquadratic.J_covariant()
        sage: biquadratic.syzygy(Delta, Theta, Theta_prime, Delta_prime, S, S_prime, F, J)
        0

    Python

        >>> from sage.all import *
        >>> R = QQ['x, y, z']; (x, y, z,) = R._first_ngens(3)
        >>> monomials = [x**Integer(2), x*y, y**Integer(2), x*z, y*z, z**Integer(2)]
        >>> def q_rnd():  return sum(randint(-Integer(1000), Integer(1000))*m for m in monomials)
        >>> biquadratic = invariant_theory.ternary_biquadratic(q_rnd(), q_rnd(), [x,y,z])
        >>> Delta = biquadratic.Delta_invariant()
        >>> Theta = biquadratic.Theta_invariant()
        >>> Theta_prime = biquadratic.Theta_prime_invariant()
        >>> Delta_prime = biquadratic.Delta_prime_invariant()
        >>> S = biquadratic.first().polynomial()
        >>> S_prime  = biquadratic.second().polynomial()
        >>> F = biquadratic.F_covariant()
        >>> J = biquadratic.J_covariant()
        >>> biquadratic.syzygy(Delta, Theta, Theta_prime, Delta_prime, S, S_prime, F, J)
        0

    If the arguments are not the invariants and covariants then the output is some (generically nonzero) polynomial:

    Sage

        sage: biquadratic.syzygy(1, 1, 1, 1, 1, 1, 1, x)
        1/64*x^2 + 1

    [Python]

        >>> from sage.all import *
        >>> biquadratic.syzygy(Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), Integer(1), x)
        1/64*x^2 + 1

sage.rings.invariants.invariant_theory.transvectant(f, g, h=1, scale='default')

  Return the h-th transvectant of f and g.

  INPUT:

  - `f`, `g` – two homogeneous binary forms in the same polynomial ring

  - `h` – the order of the transvectant; if it is not specified, the first transvectant is returned

  - `scale` – the scaling factor applied to the result. Possible values are `'default'` and `'none'`. The `'default'` scaling factor is the one that appears in the output statement below, if the scaling factor is `'none'` the quotient of factorials is left out.

  OUTPUT:

  The h-th transvectant of the listed forms \(f\) and \(g\):

  \[(f,g)_h = \frac{(d_f-h)! \cdot (d_g-h)!}{d_f! \cdot d_g!}\left( \left(\frac{\partial}{\partial x}\frac{\partial}{\partial z'} - \frac{\partial}{\partial x'}\frac{\partial}{\partial z} \right)^h \left(f(x,z) \cdot g(x',z')\right) \right)_{(x',z')=(x,z)}\]

  EXAMPLES:

  Sage

      sage: from sage.rings.invariants.invariant_theory import AlgebraicForm, transvectant
      sage: R.<x,y> = QQ[]
      sage: f = AlgebraicForm(2, 5, x^5 + 5*x^4*y + 5*x*y^4 + y^5)
      sage: transvectant(f, f, 4)
      Binary quadratic given by 2*x^2 - 4*x*y + 2*y^2
      sage: transvectant(f, f, 8)
      Binary form of degree -6 given by 0

  Python

      >>> from sage.all import *
      >>> from sage.rings.invariants.invariant_theory import AlgebraicForm, transvectant
      >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
      >>> f = AlgebraicForm(Integer(2), Integer(5), x**Integer(5) + Integer(5)*x**Integer(4)*y + Integer(5)*x*y**Integer(4) + y**Integer(5))
      >>> transvectant(f, f, Integer(4))
      Binary quadratic given by 2*x^2 - 4*x*y + 2*y^2
      >>> transvectant(f, f, Integer(8))
      Binary form of degree -6 given by 0

  The default scaling will yield an error for fields of positive characteristic below \(d_f!\) or \(d_g!\) as the denominator of the scaling factor will not be invertible in that case. The scale argument `'none'` can be used to compute the transvectant in this case:

  Sage

      sage: R.<a0,a1,a2,a3,a4,a5,x0,x1> = GF(5)[]
      sage: f = AlgebraicForm(2, 5, a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2
      ....:                         + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5, x0, x1)
      sage: transvectant(f, f, 4)
      Traceback (most recent call last):
      ...
      ZeroDivisionError
      sage: transvectant(f, f, 4, scale='none')
      Binary quadratic given by -a3^2*x0^2 + a2*a4*x0^2 + a2*a3*x0*x1
      - a1*a4*x0*x1 - a2^2*x1^2 + a1*a3*x1^2

  [Python]

      >>> from sage.all import *
      >>> R = GF(Integer(5))['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
      >>> f = AlgebraicForm(Integer(2), Integer(5), a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2)
      ...                         + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5), x0, x1)
      >>> transvectant(f, f, Integer(4))
      Traceback (most recent call last):
      ...
      ZeroDivisionError
      >>> transvectant(f, f, Integer(4), scale='none')
      Binary quadratic given by -a3^2*x0^2 + a2*a4*x0^2 + a2*a3*x0*x1
      - a1*a4*x0*x1 - a2^2*x1^2 + a1*a3*x1^2

  The additional factors that appear when `scale='none'` is used can be seen if we consider the same transvectant over the rationals and compare it to the scaled version:

  Sage

      sage: R.<a0,a1,a2,a3,a4,a5,x0,x1> = QQ[]
      sage: f = AlgebraicForm(2, 5, a0*x1^5 + a1*x1^4*x0 + a2*x1^3*x0^2
      ....:                         + a3*x1^2*x0^3 + a4*x1*x0^4 + a5*x0^5, x0, x1)
      sage: transvectant(f, f, 4)
      Binary quadratic given by 3/50*a3^2*x0^2 - 4/25*a2*a4*x0^2
      + 2/5*a1*a5*x0^2 + 1/25*a2*a3*x0*x1 - 6/25*a1*a4*x0*x1 + 2*a0*a5*x0*x1
      + 3/50*a2^2*x1^2 - 4/25*a1*a3*x1^2 + 2/5*a0*a4*x1^2
      sage: transvectant(f, f, 4, scale='none')
      Binary quadratic given by 864*a3^2*x0^2 - 2304*a2*a4*x0^2
      + 5760*a1*a5*x0^2 + 576*a2*a3*x0*x1 - 3456*a1*a4*x0*x1
      + 28800*a0*a5*x0*x1 + 864*a2^2*x1^2 - 2304*a1*a3*x1^2 + 5760*a0*a4*x1^2

  Python

      >>> from sage.all import *
      >>> R = QQ['a0, a1, a2, a3, a4, a5, x0, x1']; (a0, a1, a2, a3, a4, a5, x0, x1,) = R._first_ngens(8)
      >>> f = AlgebraicForm(Integer(2), Integer(5), a0*x1**Integer(5) + a1*x1**Integer(4)*x0 + a2*x1**Integer(3)*x0**Integer(2)
      ...                         + a3*x1**Integer(2)*x0**Integer(3) + a4*x1*x0**Integer(4) + a5*x0**Integer(5), x0, x1)
      >>> transvectant(f, f, Integer(4))
      Binary quadratic given by 3/50*a3^2*x0^2 - 4/25*a2*a4*x0^2
      + 2/5*a1*a5*x0^2 + 1/25*a2*a3*x0*x1 - 6/25*a1*a4*x0*x1 + 2*a0*a5*x0*x1
      + 3/50*a2^2*x1^2 - 4/25*a1*a3*x1^2 + 2/5*a0*a4*x1^2
      >>> transvectant(f, f, Integer(4), scale='none')
      Binary quadratic given by 864*a3^2*x0^2 - 2304*a2*a4*x0^2
      + 5760*a1*a5*x0^2 + 576*a2*a3*x0*x1 - 3456*a1*a4*x0*x1
      + 28800*a0*a5*x0*x1 + 864*a2^2*x1^2 - 2304*a1*a3*x1^2 + 5760*a0*a4*x1^2

  If the forms are given as inhomogeneous polynomials, the homogenisation might fail if the polynomial ring has multiple variables. You can circumvent this by making sure the base ring of the polynomial has only one variable:

  Sage

      sage: R.<x,y> = QQ[]
      sage: quintic = invariant_theory.binary_quintic(x^5 + x^3 + 2*x^2 + y^5, x)
      sage: transvectant(quintic, quintic, 2)
      Traceback (most recent call last):
      ...
      ValueError: polynomial is not homogeneous
      sage: R.<y> = QQ[]
      sage: S.<x> = R[]
      sage: quintic = invariant_theory.binary_quintic(x^5 + x^3 + 2*x^2 + y^5, x)
      sage: transvectant(quintic, quintic, 2)
      Binary sextic given by 1/5*x^6 + 6/5*x^5*h - 3/25*x^4*h^2
      + (50*y^5 - 8)/25*x^3*h^3 - 12/25*x^2*h^4 + (3*y^5)/5*x*h^5
      + (2*y^5)/5*h^6

  [Python]

      >>> from sage.all import *
      >>> R = QQ['x, y']; (x, y,) = R._first_ngens(2)
      >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + x**Integer(3) + Integer(2)*x**Integer(2) + y**Integer(5), x)
      >>> transvectant(quintic, quintic, Integer(2))
      Traceback (most recent call last):
      ...
      ValueError: polynomial is not homogeneous
      >>> R = QQ['y']; (y,) = R._first_ngens(1)
      >>> S = R['x']; (x,) = S._first_ngens(1)
      >>> quintic = invariant_theory.binary_quintic(x**Integer(5) + x**Integer(3) + Integer(2)*x**Integer(2) + y**Integer(5), x)
      >>> transvectant(quintic, quintic, Integer(2))
      Binary sextic given by 1/5*x^6 + 6/5*x^5*h - 3/25*x^4*h^2
      + (50*y^5 - 8)/25*x^3*h^3 - 12/25*x^2*h^4 + (3*y^5)/5*x*h^5
      + (2*y^5)/5*h^6