# Projective plane conics over a field#

AUTHORS:

• Marco Streng (2010-07-20)

• Nick Alexander (2008-01-08)

class sage.schemes.plane_conics.con_field.ProjectiveConic_field(A, f)#

Create a projective plane conic curve over a field. See Conic for full documentation.

EXAMPLES:

sage: K = FractionField(PolynomialRing(QQ, 't'))
sage: P.<X, Y, Z> = K[]
sage: Conic(X^2 + Y^2 - Z^2)
Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t
over Rational Field defined by X^2 + Y^2 - Z^2

base_extend(S)#

Return the conic over S given by the same equation as self.

EXAMPLES:

sage: c = Conic([1, 1, 1]); c
Projective Conic Curve over Rational Field defined by x^2 + y^2 + z^2
sage: c.has_rational_point()
False
sage: d = c.base_extend(QuadraticField(-1, 'i')); d                         # optional - sage.rings.number_field
Projective Conic Curve over Number Field in i
with defining polynomial x^2 + 1 with i = 1*I defined by x^2 + y^2 + z^2
sage: d.rational_point(algorithm='rnfisnorm')                               # optional - sage.rings.number_field
(i : 1 : 0)

cache_point(p)#

Replace the point in the cache of self by p for use by rational_point() and parametrization().

EXAMPLES:

sage: c = Conic([1, -1, 1])
sage: c.point([15, 17, 8])
(15/8 : 17/8 : 1)
sage: c.rational_point()
(15/8 : 17/8 : 1)
sage: c.rational_point()
(-1 : 1 : 0)

coefficients()#

Gives a the $$6$$ coefficients of the conic self in lexicographic order.

EXAMPLES:

sage: Conic(QQ, [1,2,3,4,5,6]).coefficients()
[1, 2, 3, 4, 5, 6]

sage: P.<x,y,z> = GF(13)[]                                                  # optional - sage.rings.finite_rings
sage: a = Conic(x^2 + 5*x*y + y^2 + z^2).coefficients(); a                  # optional - sage.rings.finite_rings
[1, 5, 0, 1, 0, 1]
sage: Conic(a)                                                              # optional - sage.rings.finite_rings
Projective Conic Curve over Finite Field of size 13
defined by x^2 + 5*x*y + y^2 + z^2

derivative_matrix()#

Gives the derivative of the defining polynomial of the conic self, which is a linear map, as a $$3 \times 3$$ matrix.

EXAMPLES:

In characteristic different from $$2$$, the derivative matrix is twice the symmetric matrix:

sage: c = Conic(QQ, [1,1,1,1,1,0])
sage: c.symmetric_matrix()
[  1 1/2 1/2]
[1/2   1 1/2]
[1/2 1/2   0]
sage: c.derivative_matrix()
[2 1 1]
[1 2 1]
[1 1 0]


An example in characteristic $$2$$:

sage: P.<t> = GF(2)[]                                                       # optional - sage.rings.finite_rings
sage: c = Conic([t, 1, t^2, 1, 1, 0]); c                                    # optional - sage.rings.finite_rings
Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Finite Field of size 2 (using GF2X)
defined by t*x^2 + x*y + y^2 + (t^2)*x*z + y*z
sage: c.is_smooth()                                                         # optional - sage.rings.finite_rings
True
sage: c.derivative_matrix()                                                 # optional - sage.rings.finite_rings
[  0   1 t^2]
[  1   0   1]
[t^2   1   0]

determinant()#

Return the determinant of the symmetric matrix that defines the conic self.

This is defined only if the base field has characteristic different from $$2$$.

EXAMPLES:

sage: C = Conic([1,2,3,4,5,6])
sage: C.determinant()
41/4
sage: C.symmetric_matrix().determinant()
41/4


Determinants are only defined in characteristic different from $$2$$:

sage: C = Conic(GF(2), [1, 1, 1, 1, 1, 0])                                  # optional - sage.rings.finite_rings
sage: C.is_smooth()                                                         # optional - sage.rings.finite_rings
True
sage: C.determinant()                                                       # optional - sage.rings.finite_rings
Traceback (most recent call last):
...
ValueError: The conic self (= Projective Conic Curve over Finite Field
of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix
because the base field has characteristic 2

diagonal_matrix()#

Return a diagonal matrix $$D$$ and a matrix $$T$$ such that $$T^t A T = D$$ holds, where $$(x, y, z) A (x, y, z)^t$$ is the defining polynomial of the conic self.

EXAMPLES:

sage: c = Conic(QQ, [1,2,3,4,5,6])
sage: d, t = c.diagonal_matrix(); d, t
(
[    1     0     0]  [   1   -1 -7/6]
[    0     3     0]  [   0    1 -1/3]
[    0     0 41/12], [   0    0    1]
)
sage: t.transpose()*c.symmetric_matrix()*t
[    1     0     0]
[    0     3     0]
[    0     0 41/12]


Diagonal matrices are only defined in characteristic different from $$2$$:

sage: c = Conic(GF(4, 'a'), [0, 1, 1, 1, 1, 1])                             # optional - sage.rings.finite_rings
sage: c.is_smooth()                                                         # optional - sage.rings.finite_rings
True
sage: c.diagonal_matrix()                                                   # optional - sage.rings.finite_rings
Traceback (most recent call last):
...
ValueError: The conic self (= Projective Conic Curve over Finite Field
in a of size 2^2 defined by x*y + y^2 + x*z + y*z + z^2) has
no symmetric matrix because the base field has characteristic 2

diagonalization(names=None)#

Return a diagonal conic $$C$$, an isomorphism of schemes $$M: C$$ -> self and the inverse $$N$$ of $$M$$.

EXAMPLES:

sage: Conic(GF(5), [1,0,1,1,0,1]).diagonalization()                         # optional - sage.rings.finite_rings
(Projective Conic Curve over Finite Field of size 5
defined by x^2 + y^2 + 2*z^2,
Scheme morphism:
From: Projective Conic Curve over Finite Field of size 5
defined by x^2 + y^2 + 2*z^2
To:   Projective Conic Curve over Finite Field of size 5
defined by x^2 + y^2 + x*z + z^2
Defn: Defined on coordinates by sending (x : y : z) to (x + 2*z : y : z),
Scheme morphism:
From: Projective Conic Curve over Finite Field of size 5
defined by x^2 + y^2 + x*z + z^2
To:   Projective Conic Curve over Finite Field of size 5
defined by x^2 + y^2 + 2*z^2
Defn: Defined on coordinates by sending (x : y : z) to (x - 2*z : y : z))


The diagonalization is only defined in characteristic different from 2:

sage: Conic(GF(2), [1,1,1,1,1,0]).diagonalization()                         # optional - sage.rings.finite_rings
Traceback (most recent call last):
...
ValueError: The conic self (= Projective Conic Curve over Finite Field
of size 2 defined by x^2 + x*y + y^2 + x*z + y*z) has no symmetric matrix
because the base field has characteristic 2


An example over a global function field:

sage: K = FractionField(PolynomialRing(GF(7), 't'))                         # optional - sage.rings.finite_rings
sage: (t,) = K.gens()                                                       # optional - sage.rings.finite_rings
sage: C = Conic(K, [t/2,0, 1, 2, 0, 3])                                     # optional - sage.rings.finite_rings
sage: C.diagonalization()                                                   # optional - sage.rings.finite_rings
(Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Finite Field of size 7
defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2,
Scheme morphism:
From: Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Finite Field of size 7
defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2
To:   Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Finite Field of size 7
defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2
Defn: Defined on coordinates by sending (x : y : z) to (x - 1/t*z : y : z),
Scheme morphism:
From: Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Finite Field of size 7
defined by (-3*t)*x^2 + 2*y^2 + x*z + 3*z^2
To:   Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Finite Field of size 7
defined by (-3*t)*x^2 + 2*y^2 + (3*t + 3)/t*z^2
Defn: Defined on coordinates by sending (x : y : z) to (x + 1/t*z : y : z))

gens()#

Return the generators of the coordinate ring of self.

EXAMPLES:

sage: P.<x,y,z> = QQ[]
sage: c = Conic(x^2 + y^2 + z^2)
sage: c.gens()
(xbar, ybar, zbar)
sage: c.defining_polynomial()(c.gens())
0


The function gens() is required for the following construction:

sage: C.<a,b,c> = Conic(GF(3), [1, 1, 1])                                   # optional - sage.rings.finite_rings
sage: C                                                                     # optional - sage.rings.finite_rings
Projective Conic Curve over
Finite Field of size 3 defined by a^2 + b^2 + c^2


Return True if and only if the conic self has a point over its base field $$B$$.

If point is True, then returns a second output, which is a rational point if one exists.

Points are cached whenever they are found. Cached information is used if and only if read_cache is True.

ALGORITHM:

The parameter algorithm specifies the algorithm to be used:

• 'default' – If the base field is real or complex, use an elementary native Sage implementation.

• 'magma' (requires Magma to be installed) – delegates the task to the Magma computer algebra system.

EXAMPLES:

sage: Conic(RR, [1, 1, 1]).has_rational_point()
False
sage: Conic(CC, [1, 1, 1]).has_rational_point()
True

sage: Conic(RR, [1, 2, -3]).has_rational_point(point = True)
(True, (1.73205080756888 : 0.000000000000000 : 1.00000000000000))


Conics over polynomial rings can be solved internally:

sage: R.<t> = QQ[]
sage: C = Conic([-2,t^2+1,t^2-1])
sage: C.has_rational_point()
True


And they can also be solved with Magma:

sage: C.has_rational_point(algorithm='magma')               # optional - magma
True
sage: C.has_rational_point(algorithm='magma', point=True)   # optional - magma
(True, (-t : 1 : 1))

sage: D = Conic([t,1,t^2])
sage: D.has_rational_point(algorithm='magma')               # optional - magma
False

has_singular_point(point=False)#

Return True if and only if the conic self has a rational singular point.

If point is True, then also return a rational singular point (or None if no such point exists).

EXAMPLES:

sage: c = Conic(QQ, [1,0,1]); c
Projective Conic Curve over Rational Field defined by x^2 + z^2
sage: c.has_singular_point(point = True)
(True, (0 : 1 : 0))

sage: P.<x,y,z> = GF(7)[]                                                   # optional - sage.rings.finite_rings
sage: e = Conic((x+y+z)*(x-y+2*z)); e                                       # optional - sage.rings.finite_rings
Projective Conic Curve over Finite Field of size 7
defined by x^2 - y^2 + 3*x*z + y*z + 2*z^2
sage: e.has_singular_point(point = True)                                    # optional - sage.rings.finite_rings
(True, (2 : 4 : 1))

sage: Conic([1, 1, -1]).has_singular_point()
False
sage: Conic([1, 1, -1]).has_singular_point(point=True)
(False, None)


has_singular_point is not implemented over all fields of characteristic $$2$$. It is implemented over finite fields.

sage: F.<a> = FiniteField(8)                                                # optional - sage.rings.finite_rings
sage: Conic([a, a + 1, 1]).has_singular_point(point=True)                   # optional - sage.rings.finite_rings
(True, (a + 1 : 0 : 1))

sage: P.<t> = GF(2)[]                                                       # optional - sage.rings.finite_rings
sage: C = Conic(P, [t,t,1]); C                                              # optional - sage.rings.finite_rings
Projective Conic Curve over Fraction Field of Univariate Polynomial Ring
in t over Finite Field of size 2 (using GF2X) defined by t*x^2 + t*y^2 + z^2
sage: C.has_singular_point(point = False)                                   # optional - sage.rings.finite_rings
Traceback (most recent call last):
...
NotImplementedError: Sorry, find singular point on conics not implemented
over all fields of characteristic 2.

hom(x, Y=None)#

Return the scheme morphism from self to Y defined by x. Here x can be a matrix or a sequence of polynomials. If Y is omitted, then a natural image is found if possible.

EXAMPLES:

Here are a few morphisms given by matrices. In the first example, Y is omitted, in the second example, Y is specified.

sage: c = Conic([-1, 1, 1])
sage: h = c.hom(Matrix([[1,1,0],[0,1,0],[0,0,1]])); h
Scheme morphism:
From: Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2
To:   Projective Conic Curve over Rational Field defined by -x^2 + 2*x*y + z^2
Defn: Defined on coordinates by sending (x : y : z) to (x + y : y : z)
sage: h([-1, 1, 0])
(0 : 1 : 0)

sage: c = Conic([-1, 1, 1])
sage: d = Conic([4, 1, -1])
sage: c.hom(Matrix([[0, 0, 1/2], [0, 1, 0], [1, 0, 0]]), d)
Scheme morphism:
From: Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2
To:   Projective Conic Curve over Rational Field defined by 4*x^2 + y^2 - z^2
Defn: Defined on coordinates by sending (x : y : z) to (1/2*z : y : x)


ValueError is raised if the wrong codomain Y is specified:

sage: c = Conic([-1, 1, 1])
sage: c.hom(Matrix([[0, 0, 1/2], [0, 1, 0], [1, 0, 0]]), c)
Traceback (most recent call last):
...
ValueError: The matrix x (= [  0   0 1/2]
[  0   1   0]
[  1   0   0]) does not define a map
from self (= Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2)
to Y (= Projective Conic Curve over Rational Field defined by -x^2 + y^2 + z^2)


The identity map between two representations of the same conic:

sage: C = Conic([1,2,3,4,5,6])
sage: D = Conic([2,4,6,8,10,12])
sage: C.hom(identity_matrix(3), D)
Scheme morphism:
From: Projective Conic Curve over Rational Field
defined by x^2 + 2*x*y + 4*y^2 + 3*x*z + 5*y*z + 6*z^2
To:   Projective Conic Curve over Rational Field
defined by 2*x^2 + 4*x*y + 8*y^2 + 6*x*z + 10*y*z + 12*z^2
Defn: Defined on coordinates by sending (x : y : z) to (x : y : z)


An example not over the rational numbers:

sage: P.<t> = QQ[]
sage: C = Conic([1,0,0,t,0,1/t])
sage: D = Conic([1/t^2, 0, -2/t^2, t, 0, (t + 1)/t^2])
sage: T = Matrix([[t,0,1], [0,1,0], [0,0,1]])
sage: C.hom(T, D)
Scheme morphism:
From: Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Rational Field defined by x^2 + t*y^2 + 1/t*z^2
To:   Projective Conic Curve over Fraction Field of Univariate
Polynomial Ring in t over Rational Field defined by
1/(t^2)*x^2 + t*y^2 - 2/(t^2)*x*z + (t + 1)/(t^2)*z^2
Defn: Defined on coordinates by sending (x : y : z) to (t*x + z : y : z)

is_diagonal()#

Return True if and only if the conic has the form $$a x^2 + b y^2 + c z^2$$.

EXAMPLES:

sage: c = Conic([1,1,0,1,0,1]); c
Projective Conic Curve over Rational Field defined by x^2 + x*y + y^2 + z^2
sage: d, t = c.diagonal_matrix()
sage: c.is_diagonal()
False
sage: c.diagonalization().is_diagonal()
True

is_smooth()#

Return True if and only if self is smooth.

EXAMPLES:

sage: Conic([1,-1,0]).is_smooth()
False
sage: Conic(GF(2),[1,1,1,1,1,0]).is_smooth()                                # optional - sage.rings.finite_rings
True

matrix()#

Return a matrix $$M$$ such that $$(x, y, z) M (x, y, z)^t$$ is the defining equation of self.

The matrix $$M$$ is upper triangular if the base field has characteristic $$2$$ and symmetric otherwise.

EXAMPLES:

sage: R.<x, y, z> = QQ[]
sage: C = Conic(x^2 + x*y + y^2 + z^2)
sage: C.matrix()
[  1 1/2   0]
[1/2   1   0]
[  0   0   1]

sage: R.<x, y, z> = GF(2)[]                                                 # optional - sage.rings.finite_rings
sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2)                                # optional - sage.rings.finite_rings
sage: C.matrix()                                                            # optional - sage.rings.finite_rings
[1 1 1]
[0 1 0]
[0 0 1]

parametrization(point=None, morphism=True)#

Return a parametrization $$f$$ of self together with the inverse of $$f$$.

If point is specified, then that point is used for the parametrization. Otherwise, use rational_point() to find a point.

If morphism is True, then $$f$$ is returned in the form of a Scheme morphism. Otherwise, it is a tuple of polynomials that gives the parametrization.

EXAMPLES:

An example over a finite field

sage: c = Conic(GF(2), [1,1,1,1,1,0])                                       # optional - sage.rings.finite_rings
sage: f, g = c.parametrization(); f, g                                      # optional - sage.rings.finite_rings
(Scheme morphism:
From: Projective Space of dimension 1 over Finite Field of size 2
To:   Projective Conic Curve over Finite Field of size 2
defined by x^2 + x*y + y^2 + x*z + y*z
Defn: Defined on coordinates by sending (x : y) to ...,
Scheme morphism:
From: Projective Conic Curve over Finite Field of size 2
defined by x^2 + x*y + y^2 + x*z + y*z
To:   Projective Space of dimension 1 over Finite Field of size 2
Defn: Defined on coordinates by sending (x : y : z) to ...)
sage: set(f(p) for p in f.domain())                                         # optional - sage.rings.finite_rings
{(0 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1)}


Verfication of the example

sage: h = g*f; h                                                            # optional - sage.rings.finite_rings
Scheme endomorphism of Projective Space of dimension 1
over Finite Field of size 2
Defn: Defined on coordinates by sending (x : y) to ...
sage: h/h                                                             # optional - sage.rings.finite_rings
x/y
sage: h.is_one()  # known bug  (see :trac:31892)                          # optional - sage.rings.finite_rings
True
sage: (x,y,z) = c.gens()                                                    # optional - sage.rings.finite_rings
sage: x.parent()                                                            # optional - sage.rings.finite_rings
Quotient of Multivariate Polynomial Ring in x, y, z
over Finite Field of size 2 by the ideal (x^2 + x*y + y^2 + x*z + y*z)
sage: k = f*g                                                               # optional - sage.rings.finite_rings
sage: k*z-k*x                                                         # optional - sage.rings.finite_rings
0
sage: k*z-k*y                                                         # optional - sage.rings.finite_rings
0


The morphisms are mathematically defined in all points, but don’t work completely in SageMath (see github issue #31892)

sage: f, g = c.parametrization([0,0,1])                                     # optional - sage.rings.finite_rings
sage: g([0,1,1])                                                            # optional - sage.rings.finite_rings
(1 : 0)
sage: f([1,0])                                                              # optional - sage.rings.finite_rings
(0 : 1 : 1)
sage: f([1,1])                                                              # optional - sage.rings.finite_rings
(0 : 0 : 1)
sage: g([0,0,1])                                                            # optional - sage.rings.finite_rings
(1 : 1)


An example with morphism = False

sage: R.<x,y,z> = QQ[]
sage: C = Curve(7*x^2 + 2*y*z + z^2)
sage: (p, i) = C.parametrization(morphism=False); (p, i)
([-2*x*y, x^2 + 7*y^2, -2*x^2], [-1/2*x, 1/7*y + 1/14*z])
sage: C.defining_polynomial()(p)
0
sage: i(p) / i(p)
x/y


A ValueError is raised if self has no rational point

sage: C = Conic(x^2 + y^2 + 7*z^2)
sage: C.parametrization()
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Rational Field defined by
x^2 + y^2 + 7*z^2 has no rational points over Rational Field!


A ValueError is raised if self is not smooth

sage: C = Conic(x^2 + y^2)
sage: C.parametrization()
Traceback (most recent call last):
...
ValueError: The conic self (=Projective Conic Curve over Rational Field
defined by x^2 + y^2) is not smooth, hence does not have a parametrization.

point(v, check=True)#

Constructs a point on self corresponding to the input v.

If check is True, then checks if v defines a valid point on self.

If no rational point on self is known yet, then also caches the point for use by rational_point() and parametrization().

EXAMPLES:

sage: c = Conic([1, -1, 1])
sage: c.point([15, 17, 8])
(15/8 : 17/8 : 1)
sage: c.rational_point()
(15/8 : 17/8 : 1)
sage: d = Conic([1, -1, 1])
sage: d.rational_point()
(-1 : 1 : 0)

random_rational_point(*args1, **args2)#

Return a random rational point of the conic self.

ALGORITHM:

1. Compute a parametrization $$f$$ of self using parametrization().

2. Computes a random point $$(x:y)$$ on the projective line.

3. Output $$f(x:y)$$.

The coordinates $$x$$ and $$y$$ are computed using B.random_element, where B is the base field of self and additional arguments to random_rational_point are passed to random_element.

If the base field is a finite field, then the output is uniformly distributed over the points of self.

EXAMPLES:

sage: c = Conic(GF(2), [1,1,1,1,1,0])                                       # optional - sage.rings.finite_rings
sage: [c.random_rational_point() for i in range(10)]              # random  # optional - sage.rings.finite_rings
[(1 : 0 : 1), (1 : 0 : 1), (1 : 0 : 1), (0 : 1 : 1), (1 : 0 : 1),
(0 : 0 : 1), (1 : 0 : 1), (1 : 0 : 1), (0 : 0 : 1), (1 : 0 : 1)]

sage: d = Conic(QQ, [1, 1, -1])
sage: d.random_rational_point(den_bound=1, num_bound=5)           # random
(-24/25 : 7/25 : 1)

sage: Conic(QQ, [1, 1, 1]).random_rational_point()
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Rational Field defined by
x^2 + y^2 + z^2 has no rational points over Rational Field!


Return a point on self defined over the base field.

Raises ValueError if no rational point exists.

See self.has_rational_point for the algorithm used and for the use of the parameters algorithm and read_cache.

EXAMPLES:

Examples over $$\QQ$$

sage: R.<x,y,z> = QQ[]
sage: C = Conic(7*x^2 + 2*y*z + z^2)
sage: C.rational_point()
(0 : 1 : 0)

sage: C = Conic(x^2 + 2*y^2 + z^2)
sage: C.rational_point()
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Rational Field defined by
x^2 + 2*y^2 + z^2 has no rational points over Rational Field!

sage: C = Conic(x^2 + y^2 + 7*z^2)
sage: C.rational_point(algorithm = 'rnfisnorm')
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Rational Field defined by
x^2 + y^2 + 7*z^2 has no rational points over Rational Field!


Examples over number fields

sage: P.<x> = QQ[]
sage: L.<b> = NumberField(x^3 - 5)                                          # optional - sage.rings.number_field
sage: C = Conic(L, [3, 2, -b])                                              # optional - sage.rings.number_field
sage: p = C.rational_point(algorithm = 'rnfisnorm')                         # optional - sage.rings.number_field
sage: p                                         # output is random          # optional - sage.rings.number_field
(1/3*b^2 - 4/3*b + 4/3 : b^2 - 2 : 1)
sage: C.defining_polynomial()(list(p))                                      # optional - sage.rings.number_field
0

sage: K.<i> = QuadraticField(-1)                                            # optional - sage.rings.number_field
sage: D = Conic(K, [3, 2, 5])                                               # optional - sage.rings.number_field
sage: D.rational_point(algorithm = 'rnfisnorm') # output is random          # optional - sage.rings.number_field
(-3 : 4*i : 1)

sage: L.<s> = QuadraticField(2)                                             # optional - sage.rings.number_field
sage: Conic(QQ, [1, 1, -3]).has_rational_point()                            # optional - sage.rings.number_field
False
sage: E = Conic(L, [1, 1, -3])                                              # optional - sage.rings.number_field
sage: E.rational_point()                        # output is random          # optional - sage.rings.number_field
(-1 : -s : 1)


Currently Magma is better at solving conics over number fields than Sage, so it helps to use the algorithm ‘magma’ if Magma is installed:

sage: q = C.rational_point(algorithm='magma',           # optional - magma  # optional - sage.rings.number_field
sage: q                       # output is random,       # optional - magma  # optional - sage.rings.number_field
(1/5*b^2 : 1/5*b^2 : 1)
sage: C.defining_polynomial()(list(q))                  # optional - magma  # optional - sage.rings.number_field
0
sage: len(str(p)) > 1.5*len(str(q))                     # optional - magma  # optional - sage.rings.number_field
True

sage: D.rational_point(algorithm='magma',       # random, optional - magma  # optional - sage.rings.number_field
(1 : 2*i : 1)

sage: E.rational_point(algorithm='magma',       # random, optional - magma  # optional - sage.rings.number_field
(-s : 1 : 1)

sage: F = Conic([L.gen(), 30, -20])                                         # optional - sage.rings.number_field
sage: q = F.rational_point(algorithm='magma')           # optional - magma  # optional - sage.rings.number_field
sage: q                                         # random, optional - magma  # optional - sage.rings.number_field
(-10/7*s + 40/7 : 5/7*s - 6/7 : 1)
sage: p = F.rational_point(read_cache=False)                                # optional - sage.rings.number_field
sage: p                                         # random                    # optional - sage.rings.number_field
(788210*s - 1114700 : -171135*s + 242022 : 1)
sage: len(str(p)) > len(str(q))                         # optional - magma  # optional - sage.rings.number_field
True

sage: G = Conic([L.gen(), 30, -21])                                         # optional - sage.rings.number_field
sage: G.has_rational_point(algorithm='magma')           # optional - magma  # optional - sage.rings.number_field
False
sage: G.has_rational_point(read_cache=False)                                # optional - sage.rings.number_field
False
sage: G.has_rational_point(algorithm='local', read_cache=False)             # optional - sage.rings.number_field
False
sage: G.rational_point(algorithm='magma')               # optional - magma  # optional - sage.rings.number_field
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Number Field in s
with defining polynomial x^2 - 2 with s = 1.414213562373095?
defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over
Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?!
sage: G.rational_point(algorithm='magma',               # optional - magma  # optional - sage.rings.number_field
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Number Field in s
with defining polynomial x^2 - 2 with s = 1.414213562373095?
defined by s*x^2 + 30*y^2 - 21*z^2 has no rational points over
Number Field in s with defining polynomial x^2 - 2 with s = 1.414213562373095?!


Examples over finite fields

sage: F.<a> = FiniteField(7^20)                                             # optional - sage.rings.finite_rings
sage: C = Conic([1, a, -5]); C                                              # optional - sage.rings.finite_rings
Projective Conic Curve over Finite Field in a of size 7^20
defined by x^2 + a*y^2 + 2*z^2
sage: C.rational_point()  # output is random                                # optional - sage.rings.finite_rings
(4*a^19 + 5*a^18 + 4*a^17 + a^16 + 6*a^15 + 3*a^13 + 6*a^11 + a^9
+ 3*a^8 + 2*a^7 + 4*a^6 + 3*a^5 + 3*a^4 + a^3 + a + 6
: 5*a^18 + a^17 + a^16 + 6*a^15 + 4*a^14 + a^13 + 5*a^12 + 5*a^10
+ 2*a^9 + 6*a^8 + 6*a^7 + 6*a^6 + 2*a^4 + 3
: 1)


Examples over $$\RR$$ and $$\CC$$

sage: Conic(CC, [1, 2, 3]).rational_point()                                 # optional - sage.rings.finite_rings
(0 : 1.22474487139159*I : 1)

sage: Conic(RR, [1, 1, 1]).rational_point()                                 # optional - sage.rings.finite_rings
Traceback (most recent call last):
...
ValueError: Conic Projective Conic Curve over Real Field
with 53 bits of precision defined by x^2 + y^2 + z^2 has
no rational points over Real Field with 53 bits of precision!

singular_point()#

Return a singular rational point of self.

EXAMPLES:

sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point()                          # optional - sage.rings.finite_rings
(1 : 1 : 1)


ValueError is raised if the conic has no rational singular point

sage: Conic(QQ, [1,1,1,1,1,1]).singular_point()
Traceback (most recent call last):
...
ValueError: The conic self (= Projective Conic Curve over Rational Field
defined by x^2 + x*y + y^2 + x*z + y*z + z^2) has no rational singular point

symmetric_matrix()#

The symmetric matrix $$M$$ such that $$(x y z) M (x y z)^t$$ is the defining equation of self.

EXAMPLES:

sage: R.<x, y, z> = QQ[]
sage: C = Conic(x^2 + x*y/2 + y^2 + z^2)
sage: C.symmetric_matrix()
[  1 1/4   0]
[1/4   1   0]
[  0   0   1]

sage: C = Conic(x^2 + 2*x*y + y^2 + 3*x*z + z^2)
sage: v = vector([x, y, z])
sage: v * C.symmetric_matrix() * v
x^2 + 2*x*y + y^2 + 3*x*z + z^2

upper_triangular_matrix()#

The upper-triangular matrix $$M$$ such that $$(x y z) M (x y z)^t$$ is the defining equation of self.

EXAMPLES:

sage: R.<x, y, z> = QQ[]
sage: C = Conic(x^2 + x*y + y^2 + z^2)
sage: C.upper_triangular_matrix()
[1 1 0]
[0 1 0]
[0 0 1]

sage: C = Conic(x^2 + 2*x*y + y^2 + 3*x*z + z^2)
sage: v = vector([x, y, z])
sage: v * C.upper_triangular_matrix() * v
x^2 + 2*x*y + y^2 + 3*x*z + z^2

variable_names()#

Return the variable names of the defining polynomial of self.

EXAMPLES:

sage: c = Conic([1,1,0,1,0,1], 'x,y,z')
sage: c.variable_names()
('x', 'y', 'z')
sage: c.variable_name()
'x'


The function variable_names() is required for the following construction:

sage: C.<p,q,r> = Conic(QQ, [1, 1, 1])
sage: C
Projective Conic Curve over Rational Field defined by p^2 + q^2 + r^2