Bill Allombert on Thu, 02 Mar 2017 11:26:46 +0100

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

 Re: Mathematica "Reduce" function

• To: pari-users@pari.math.u-bordeaux.fr
• Subject: Re: Mathematica "Reduce" function
• From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
• Date: Thu, 2 Mar 2017 11:26:35 +0100
• Delivery-date: Thu, 02 Mar 2017 11:26:46 +0100
• In-reply-to: <20170302090048.GM1825@MBP-pfortuny.local>
• Mail-followup-to: pari-users@pari.math.u-bordeaux.fr
• References: <20170301164507.GK1825@MBP-pfortuny.local> <20170301170514.GA23217@yellowpig> <20170301180155.GE23217@yellowpig> <20170302090048.GM1825@MBP-pfortuny.local>
• User-agent: Mutt/1.5.23 (2014-03-12)

```On Thu, Mar 02, 2017 at 10:00:48AM +0100, Pedro Fortuny Ayuso wrote:
> Thanks to all.
>
> My specific problem is trying to solve equations like
>
> 6x^2 + 12y^2 +20z^2 = 0
>
> over Z/(2^k)Z. That is, finding the points of that surface
> over that ring.

Solutions of homogenous degree-2 equation in three variables can be
parametrized as soon as one solution is known using qfparam:
For example [0,1,1] is a (primitive) solution mod 2^5 so set

? M=qfparam(matdiagonal([6,12,20]),[0,1,1])
%9 = [0,-20,0;3,0,10;3,0,-10]
? v = y^2 * M*[1,x/y,(x/y)^2]~
%10 = [-20*y*x,10*x^2+3*y^2,-10*x^2+3*y^2]~

so for all x,y, (-20*y*x,10*x^2+3*y^2,-10*x^2+3*y^2) is a solution mod
2^5:

? content(6*(-20*y*x)^2+12*(10*x^2+3*y^2)^2+20*(-10*x^2+3*y^2)^2)
%12 = 32

> Bill's reply of counting
>
> length([[x,y,z]|x<-[0..2^k-1];y<-[0..2^k-1];z<-[0..2^k-1],6*x^2+12*y^2+20*z^2==0])

You are missing a reduction mod 2^k at the end.

> is the fastest but it ***looks like*** a lot slower than
> Mathematica (but please notice I am working on a system
> with pari/gp and my colleague on a different one with Mathematica,
> so that it may have nothing to do with pari/Mathematica).

This is quite possible, I do not know what Mathematica is doing.
what you can do is to check whether (6*x^2+12*y^2)/-20 is a square
instead of iterating over z:

[[x,y,z]|x<-2*[0..2^(k-1)-1];y<-[0..2^k-1],issquare((6*x^2+12*y^2)/-20*Mod(1,2^k),&z)]

Cheers,
Bill.

```