| Home | Trees | Indices | Help |
|---|
|
|
object --+
|
structure.sage_object.SageObject --+
|
BinaryQF
BinaryQF([a,b,c])
INPUT:
v -- a list of 3 entries: [a,b,c]
OUTPUT:
the binary quadratic form a*x^2 + b*x*y + c*y^2.
EXAMPLES:
sage: b = BinaryQF([1,2,3])
sage: b.discriminant()
-8
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from Inherited from |
|||
|
|||
|
Inherited from |
|||
|
|||
Creates the binary quadratic form $ax^2 + bxy + cy^2$ from the
triple [a,b,c] over IntegerRing().
EXAMPLES:
sage: Q = BinaryQF([1,2,3])
sage: Q
x^2 + 2*x*y + 3*y^2
sage: Q = BinaryQF([1,2])
Traceback (most recent call last):
...
ValueError: Binary quadratic form must be given by a list of three coefficients
|
Return the n-th component of this quadratic form.
If this form is $a x^2 + b x y + c y^2$, the 0-th component is $a$,
the 1-st component is $b$, and $2$-nd component is $c$.
Indexing is like lists -- negative indices and slices are allowed.
EXAMPLES:
sage: Q = BinaryQF([2,3,4])
sage: Q[0]
2
sage: Q[2]
4
sage: Q[:2]
(2, 3)
sage: tuple(Q)
(2, 3, 4)
sage: list(Q)
[2, 3, 4]
|
Evaluate this quadratic form at a point.
INPUT:
args -- x and y values, often as a pair x, y or a list [x, y]
EXAMPLES:
sage: Q = BinaryQF([2,3,4])
sage: Q(1, 2)
24
|
Returns True if self and right are identical: the same coefficients.
EXAMPLES:
sage: P = BinaryQF([2,2,3])
sage: Q = BinaryQF([2,2,3])
sage: R = BinaryQF([1,2,3])
sage: P == Q # indirect doctest
True
sage: P == R # indirect doctest
False
TESTS:
sage: P == P
True
sage: Q == P
True
sage: R == P
False
sage: P == 2
False
|
Returns the component-wise sum of two forms.
That is, given $a_1 x^2 + b_1 x y + c_1 y^2$ and $a_2 x^2 + b_2 x y +
c_2 y^2$, returns the form
$$(a_1 + a_2) x^2 + (b_1 + b_2) x y + (c_1 + c_2) y^2 .$$
EXAMPLES:
sage: P = BinaryQF([2,2,3]); P
2*x^2 + 2*x*y + 3*y^2
sage: Q = BinaryQF([-1,2,2]); Q
-x^2 + 2*x*y + 2*y^2
sage: P + Q
x^2 + 4*x*y + 5*y^2
sage: P + Q == BinaryQF([1,4,5]) # indirect doctest
True
TESTS:
sage: Q + P == BinaryQF([1,4,5]) # indirect doctest
True
|
Returns the component-wise difference of two forms.
That is, given $a_1 x^2 + b_1 x y + c_1 y^2$ and $a_2 x^2 + b_2 x y +
c_2 y^2$, returns the form
$$(a_1 - a_2) x^2 + (b_1 - b_2) x y + (c_1 - c_2) y^2 .$$
EXAMPLES:
sage: P = BinaryQF([2,2,3]); P
2*x^2 + 2*x*y + 3*y^2
sage: Q = BinaryQF([-1,2,2]); Q
-x^2 + 2*x*y + 2*y^2
sage: P - Q
3*x^2 + y^2
sage: P - Q == BinaryQF([3,0,1]) # indirect doctest
True
TESTS:
sage: Q - P == BinaryQF([3,0,1]) # indirect doctest
False
sage: Q - P != BinaryQF([3,0,1]) # indirect doctest
True
|
Display the quadratic form.
EXAMPLES:
sage: Q = BinaryQF([1,2,3]); Q # indirect doctest
x^2 + 2*x*y + 3*y^2
sage: Q = BinaryQF([-1,2,3]); Q
-x^2 + 2*x*y + 3*y^2
sage: Q = BinaryQF([0,0,0]); Q
0
|
Returns the binary quadratic form as a homogeneous 2-variable
polynomial.
EXAMPLES:
sage: Q = BinaryQF([1,2,3])
sage: Q.polynomial()
x^2 + 2*x*y + 3*y^2
sage: Q = BinaryQF([-1,-2,3])
sage: Q.polynomial()
-x^2 - 2*x*y + 3*y^2
sage: Q = BinaryQF([0,0,0])
sage: Q.polynomial()
0
|
Returns the discriminant $b^2 - 4ac$ of the binary
form $ax^2 + bxy + cy^2$.
EXAMPLES:
sage: Q = BinaryQF([1,2,3])
sage: Q.discriminant()
-8
|
Checks if the discriminant D of this form is a fundamantal
discriminant (i.e. D is the smallest element of its
squareclass with D = 0 or 1 mod 4).
EXAMPLES:
sage: Q = BinaryQF([1,0,1])
sage: Q.discriminant()
-4
sage: Q.has_fundamental_discriminant()
True
sage: Q = BinaryQF([2,0,2])
sage: Q.discriminant()
-16
sage: Q.has_fundamental_discriminant()
False
|
Checks if the form $ax^2 + bxy + cy^2$ satisfies
$|b| \leq a \leq c$, i.e., is weakly reduced.
EXAMPLES:
sage: Q = BinaryQF([1,2,3])
sage: Q.is_weakly_reduced()
False
sage: Q = BinaryQF([2,1,3])
sage: Q.is_weakly_reduced()
True
sage: Q = BinaryQF([1,-1,1])
sage: Q.is_weakly_reduced()
True
|
EXAMPLES:
sage: a = BinaryQF([37,17,2])
sage: a.is_reduced()
False
sage: b = a.reduce(); b
x^2 + x*y + 2*y^2
sage: b.is_reduced()
True
|
Checks if the quadratic form is reduced, i.e., if the form
$ax^2 + bxy + cy^2$ satisfies $|b|\leq a \leq c$, and
that $b\geq 0$ if either $a = b$ or $a = c$.
EXAMPLES:
sage: Q = BinaryQF([1,2,3])
sage: Q.is_reduced()
False
sage: Q = BinaryQF([2,1,3])
sage: Q.is_reduced()
True
sage: Q = BinaryQF([1,-1,1])
sage: Q.is_reduced()
False
sage: Q = BinaryQF([1,1,1])
sage: Q.is_reduced()
True
|
Returns the point in the complex upper half-plane associated
to this (positive definite) quadratic form).
For positive definite forms with negative discriminants, this is a
root $ au$ of $a x^2 + b x + c$ with the imaginary part of $ au$
greater than 0.
EXAMPLES:
sage: Q = BinaryQF([1,0,1])
sage: Q.complex_point()
1.00000000000000*I
|
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0beta1 on Thu Jul 17 04:23:50 2008 | http://epydoc.sourceforge.net |