------------------------------------------------------------------- Time-stamp: <2000-09-05 19:32:41 apacetti> Description: Quadratics forms books: The Algebraic Theory of Quadratic Forms Author: Fernando Rodriguez-Villegas villegas@math.utexas.edu University of Texas at Austin ------------------------------------------------------------------- This file describes the PARI-GP routines in the file bforms.gp. To use: in a GP session issue the command \r bforms.gp (if that's the name you gave the file; you might need more of its path if you GP session is running with another default directory). We start with a quadratic form in 2 variables. We can express it as a symmetric matrix in Q^{2x2}, then we consider: q(x1,x2)= [x1,x2] [q1,q2/2;q2/2,q3] [x1;x2] So, we start defining the evaluation of the form in a vector v of Z^2 as: evalf ([1,1,2], [2,3]) what will output: 28 If we think a binary quadratic forms as a matrix, we can compute the discriminant of one form, that is b^2b-4*a*c: discrf([2,-1,3]) which will output: -23 One interesting thing is given integers d, and a, to find a quadratic form [a,b,c], such that it's discriminant is d. For example: fm(23,93) which will output: [23, 1, -1] In case there's no such form, it will answer some different of errors, so if the answer is no a quadratic form, it's because there is no such form. For example: fm(23,-47) will output: *** non quadratic residue in gsqrt We're interestes in quadratic forms with discriminant < 0. That's because given a quadratic form we can assign it an ideal, in the way: [a,b,c] ------ A = Z a + Z (b + sqrt (d))/2 which is in the ring of integers of Q(sqrt(d)). Note that if we have two forms with the same discriminant, they lie in the same ring of integers , so there is an easy way to compute their composition, just assigning to each form an ideal of the complex numbers, computing their product, and going back to another quadratic form. There is a command for computing this composition, called compf, for example: compf([34,23,7],[2, 1, 53]) which will output: [17, 23, 14] Note that it doesn't work if the forms don't have the same discriminant. Another important thing of this kind of forms, is that we have a form [a,b,c], it's associated to a polynomial q(x,y)= a*x^2+b*x*y+c*y^2. If we look at the polynomial q(x,1)= a*x^2+b*x+c , and we can pick a root of it, for example: -b + sqrt (d) z_q = -------------- 2 * a which is a complex number. We have an equivalence relation of quadratic forms given by a change of basis. We can assume that this matrix has determinant 1. This traduces in the action of PSL_2(Z) on H (via the previous identification), then we can assign it a unique number in D, the fundamental domain of the upper complex plane H module PSL_2(Z). So translating the action of S and T, the generators of PSL_2(Z), we get a unique reduced representation. For example: red1f([9, 25, 18]) which will output: [2, 1, 3] And there are some combinations of this methods, like compredf, which first compose both forms, and then reduces the result, for example: compredf([34,23,7],[2, 1, 53]) which will output: [8, -5, 14] (compare with the result of the compf method) Or, to compute in an inteligent way the composition of a form with itself. For example: powredf([9, 25, 18],13) which will output: [2, 1, 3] We can also start looking at the reduced powers of a quadratic form q, so as to see it's order for example. For this we use: powlistf([34,23,7],6) which will output: 1 [7, 5, 16] 2 [4, -3, 27] 3 [4, 3, 27] 4 [7, -5, 16] 5 [1, -1, 106] 6 [7, 5, 16] Note that all the forms in this list are reduced, so they're equivalent if and only if the forms that appear are the same. And with this, given a quadratic form, we can compute it's order, just using the unique representation in H / PSL_2(Z). For example: orderf([12,37,29]) which will output: 3 That means that the quadratic form [12,37,29] with the composition operation has order 3. If the discriminant of the quadratic form is congruent to 7 mod 8, there is a method (based on a paper from Fernando Rodriguez-Villegas) for computing a generator of the group of forms of this given discriminant in the case it's cyclic, using the routine: genf(-423,10) which will output: [2, 1, 53] Note that first one must know the class number, so it's better to use first the routine clnof (see below). Given a discriminant, the command hvecf gives all the different reduced forms woth this discriminant. For example: hvecf(-71) which will output: [[1, -1, 18], [2, -1, 9], [2, 1, 9], [3, -1, 6], [3, 1, 6], [4, -3, 5], [4, 3, 5]] And if we want just the number of classes (which is the same of the class number of ideals in the ring of integers of Q[sqrt(d)]), we can use: clnof(-71) which will output: 7 Another interesting thing is given a quadratic form, find another quadratic form, which has the same discrminant, but the norm of the ideal (which correspond to the first coefficient) is not divisible by a certain list of primes. For example: cqrf([2,1,6],[2,7]) which will output: [2,1,6] You can try the same without the number 7 to see what happens. And if you want a representatives of the classes, such that all of them satisfy the previous property, you can use: cprvecf((-47,[7])) which will output: [[1, -1, 12], [53, -177, 148], [53, 177, 148], [17, -53, 42], [17, 53, 42]] Compare this with hvecf, to check what happens adding the number 7 to the list.