# 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


TESTS:

sage: K = FractionField(PolynomialRing(QQ, 't'))
sage: Conic([K(1), 1, -1])._test_pickling()

base_extend(S)

Returns 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
Projective Conic Curve over Number Field in i with defining polynomial x^2 + 1 defined by x^2 + y^2 + z^2
sage: d.rational_point(algorithm = 'rnfisnorm')
(i : 1 : 0)

cache_point(p)

Replace the point in the cache of self by p for use by self.rational_point() and self.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)[]
sage: a = Conic(x^2+5*x*y+y^2+z^2).coefficients(); a
[1, 5, 0, 1, 0, 1]
sage: Conic(a)
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)[]
sage: c = Conic([t, 1, t^2, 1, 1, 0]); c
Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 2 (using NTL) defined by t*x^2 + x*y + y^2 + t^2*x*z + y*z
sage: c.is_smooth()
True
sage: c.derivative_matrix()
[  0   1 t^2]
[  1   0   1]
[t^2   1   0]

determinant()

Returns 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])
sage: C.is_smooth()
True
sage: C.determinant()
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()

Returns 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])
sage: c.is_smooth()
True
sage: c.diagonal_matrix()
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)

Returns 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()
(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()
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

gens()

Returns 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])
sage: C
Projective Conic Curve over Finite Field of size 3 defined by a^2 + b^2 + c^2


Returns 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 not be solved yet without Magma:

sage: R.<t> = QQ[]
sage: C = Conic([-2,t^2+1,t^2-1])
sage: C.has_rational_point()
Traceback (most recent call last):
...
NotImplementedError: has_rational_point not implemented for conics over base field Fraction Field of Univariate Polynomial Ring in t over Rational Field


But they can 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


TESTS:

One of the following fields comes with an embedding into the complex numbers, one does not. Check that they are both handled correctly by the Magma interface.

sage: K.<i> = QuadraticField(-1)
sage: K.coerce_embedding()
Generic morphism:
From: Number Field in i with defining polynomial x^2 + 1
To:   Complex Lazy Field
Defn: i -> 1*I
sage: Conic(K, [1,1,1]).rational_point(algorithm='magma') # optional - magma
(-i : 1 : 0)

sage: x = QQ['x'].gen()
sage: L.<i> = NumberField(x^2+1, embedding=None)
sage: Conic(L, [1,1,1]).rational_point(algorithm='magma') # optional - magma
(-i : 1 : 0)
sage: L == K
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)[]
sage: e = Conic((x+y+z)*(x-y+2*z)); e
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)
(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)
sage: Conic([a, a+1, 1]).has_singular_point(point = True)
(True, (a + 1 : 0 : 1))

sage: P.<t> = GF(2)[]
sage: C = Conic(P, [t,t,1]); C
Projective Conic Curve over Fraction Field of Univariate Polynomial Ring in t over Finite Field of size 2 (using NTL) defined by t*x^2 + t*y^2 + z^2
sage: C.has_singular_point(point = False)
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)

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()[0].is_diagonal()
True

is_smooth()

Returns 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()
True

matrix()

Returns 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)[]
sage: C = Conic(x^2 + x*y + y^2 + x*z + z^2)
sage: C.matrix()
[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 self.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])
sage: c.parametrization()
(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
(x*y + y^2 : x^2 + x*y : x^2 + x*y + y^2),
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
(y : x))


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, 7*x^2 + y^2, -2*y^2], [-1/2*x, -1/2*z])
sage: C.defining_polynomial()(p)
0
sage: i[0](p) / i[1](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 self.rational_point() and self.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 self.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])
sage: [c.random_rational_point() for i in range(10)] # output is random
[(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) # output is 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)
sage: C = Conic(L, [3, 2, -5])
sage: p = C.rational_point(algorithm = 'rnfisnorm')
sage: p                                         # output is random
(60*b^2 - 196*b + 161 : -120*b^2 - 6*b + 361 : 1)
sage: C.defining_polynomial()(list(p))
0

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

sage: Conic(QQ, [1, 1, -3]).has_rational_point()
False
sage: E = Conic(L, [1, 1, -3])
sage: E.rational_point()                        # output is random
(-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', read_cache=False) # optional - magma
sage: q                       # output is random, optional - magma
(-1 : -1 : 1)
sage: C.defining_polynomial()(list(p))          # optional - magma
0
sage: len(str(p)) / len(str(q)) > 2             # optional - magma
True

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

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

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

sage: Conic([L.gen(), 30, -21]).has_rational_point(algorithm='magma') # optional - magma
False


Examples over finite fields

sage: F.<a> = FiniteField(7^20)
sage: C = Conic([1, a, -5]); C
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
(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()
(0 : 1.22474487139159*I : 1)

sage: Conic(RR, [1, 1, 1]).rational_point()
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()

Returns a singular rational point of self

EXAMPLES:

sage: Conic(GF(2), [1,1,1,1,1,1]).singular_point()
(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()

Returns 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


#### Previous topic

Plane conic constructor

#### Next topic

Projective plane conics over a number field