Bill Allombert on Wed, 11 Oct 2023 23:27:41 +0200


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

Re: efficient foursquare() and/or threesquare1m4() functions


On Sun, Oct 08, 2023 at 12:30:18PM +0200, Bill Allombert wrote:
> On Sun, Oct 08, 2023 at 12:01:16PM +0200, hermann@stamm-wilbrandt.de wrote:
> > On 2023-10-08 10:19, Bill Allombert wrote:
> > > On Sun, Oct 08, 2023 at 01:25:07AM +0200, hermann@stamm-wilbrandt.de
> > > wrote:
> > > > Because I already implemented generation of ternary quadratic form Q
> > > > for n
> > > > - that represents n
> > > > - and has determinant 1.
> > > 
> > > > Now I need to figure out how to determine matrix M, such that
> > > > M~*Q*M is diagonal matrix. The diagonal entries of M~*Q*M
> > > > are three square representation of n.
> > > 
> > > See qfgaussred
> > > 
> > > Cheers,
> > > Bill.
> > > 
> > Thanks, but that matrix is not the matrix M I search for.
> 
> Yes, you need to read the documentation...
> 
> ? Q=[41,50,1;50,61,0;1,0,62]
> %1 = [41,50,1;50,61,0;1,0,62]
> ? M=qfgaussred(Q)
> %2 = [41,50/41,1/41;0,1/41,-50;0,0,1]
> ? D=matrix(#M,#M,i,j,if(i==j,M[i,j]))
> %3 = [41,0,0;0,1/41,0;0,0,1]
> ? R=matrix(#M,#M,i,j,if(i==j,1,M[i,j]))
> %4 = [1,50/41,1/41;0,1,-50;0,0,1]
> ? R~*D*R == Q
> %5 = 1
> ? R~^-1*Q*R^-1
> %6 = [41,0,0;0,1/41,0;0,0,1]

Since it was convoluted, I added a flag to qfgaussred in the master branch, so now we can do

? Q=[41,50,1;50,61,0;1,0,62]
%1 = [41,50,1;50,61,0;1,0,62]
? [U,V] = qfgaussred(Q,1); D = matdiagonal(V)
%2 = [41,0,0;0,1/41,0;0,0,1]
? U~*D*U
%3 = [41,50,1;50,61,0;1,0,62]
? U~^-1*Q*U^-1
%4 = [41,0,0;0,1/41,0;0,0,1]

Cheers,
Bill