Bill Allombert on Mon, 18 Dec 2023 18:39:03 +0100


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

Re: Question on "qfminim()" for quadratic form


On Mon, Dec 18, 2023 at 04:05:39PM +0100, hermann@stamm-wilbrandt.de wrote:
> pi@raspberrypi5:~ $ n=101 gp -q < m2.gp
> 101=[1, 6, 8]
> all asserts OK
> 528979 [711, -153, -7]~ [2, 9, 4]~
> 10232019 [3127, -673, -31]~ [2, 9, -4]~
> ...
> 97549123438 [305322, -65715, -3023]~ [10, 0, -1]~
> 101592175419 [311585, -67063, -3085]~ [10, -1, 0]~
> #S2=168
> 12*h(-4*n)=168
> pi@raspberrypi5:~ $
> 
> 
> Because "S2=vecsort(concat(S,-S),norml2)", it has 12*h(-4*n) members for
> n!=3 (mod 4):
> https://en.wikipedia.org/wiki/Sum_of_squares_function#k_=_3
> 
> S2.gp output is sorted wrt L2 norm of vectors. Is there a method to
> determine either
> minimal norm vector or maximal norm vector in S2 efficiently/"more efficient
> than to
> compute all 12*h(-4*n) elements" ?

I am not sure what you mean by 'maximal norm vector", but it you just want one
solution, you can try this

forqfvec(v,M,n,if(qfeval(M,v)==n,V=v;break()))

Cheers,
Bill.