hermann on Thu, 16 Nov 2023 00:48:24 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Question on ternary quadratic form


Thanks Bill, Denis and Markus for the answers.

I worked on determining sum of three squares for integer n
using ternary quadratic form as described in chapter 4 of
E. Grosswald. Representations of Integers as Sums of Squares. SpringerVerlag, New York, 1985, in my tqf.gp gist:
https://gist.github.com/Hermann-SW/f13b8adf7d7e3094f0b6db0bce29a7b8

qflllgram() is my favorite solution, better qflllgram(_, flag=1) to ensure integer solution.

The two transformations that I did are not needed when using
qflllgram(), it does the complete transformation to identity form!

In the gist initial ternary quadratic for Q for n=46 is
created as, with det=1 and representing n:

? Q

[ 6  37  1]

[37 229  0]

[ 1   0 46]

? matdet(Q)
1
? qfeval(Q,[0,0,1]~)
46
?

Now one call to qflllgram to determine G:

? G=qflllgram(Q,flag=1)

[-6 -43  93]

[ 1   7 -15]

[ 0   1  -2]

?

And a representation of n=46 as sum of 3 squares is ...

? G^-1*[0,0,1]~
[-6, 3, 1]~
?

... wow!

Now I need to eliminate all the stuff that did not work and
make tqf.gp gist compute sum of three squares for all n.

Regards,

Hermann.

On 2023-11-15 23:15, Denis Simon wrote:
Hi Hermann,

More generally, if you have a quadratic form that you suspect to be
highly reducible,
you shoud try to reduce it with qflllgram:

? M=[1,0,0;0,5,28;0,28,157];
? G=qflllgram(M)
%2 =
[1  0   0]

[0 -6 -11]

[0  1   2]

? G~*M*G
%3 =
[1 0 0]

[0 1 0]

[0 0 1]

In your situation, you can do the same thing with the 2x2 block [5,28;28,157].

Cheers,
Denis SIMON.

----- Mail original -----
De: "Bill Allombert" <Bill.Allombert@math.u-bordeaux.fr>
À: "pari-users" <pari-users@pari.math.u-bordeaux.fr>
Envoyé: Mercredi 15 Novembre 2023 23:00:39
Objet: Re: Question on ternary quadratic form

On Wed, Nov 15, 2023 at 10:28:25PM +0100, hermann@stamm-wilbrandt.de wrote:
After two modifications I got this ternary quadratic form:

? Qt

[1  0   0]

[0  5  28]

[0 28 157]

?

I know it can be transformed to ternary identity form.

You can use qfisom (if the form is positive definite):

? M=[1,0,0;0,5,28;0,28,157];
? qfisom(M,matid(3))
%17 =
[0  1   6]

[0 -2 -11]

[1  0   0]

Of course, if you look for solution of the form
1 0 0
0 a b
0 c d

Then you should do
? qfbredsl2(Qfb(5,28+28,157))
%20 = [Qfb(1, 0, 1), [-6, 11; 1, -2]]

which will be much faster.

Cheers,
Bill.