Carl R. Witty on 15 Oct 2002 11:42:33 -0700


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

Re: bug in polredabs?


Bill Allombert <allomber@math.u-bordeaux.fr> writes:

> On Mon, Oct 14, 2002 at 10:32:25AM -0700, Carl R. Witty wrote:
> > Version: Debian packages version 2.1.4-1 (x86 linux).
> > 
> > I'm trying to do exactly the same thing, except with different
> > polynomials.  Here's my example:
> > 
>  
> > I was hoping, based on the polcompositum example, that the last line
> > would return 0; this would have worked if the second element returned
> > by polredabs were 7/6*x instead of 7*x.
> 
> You are right this is a bug, and it is fixed in the development release.
> This come from the fact that your polynomial is not monic and so
> polredabs need to convert it to a monic one (definining the same field)
> internaly but forget to fix the output.
> 
> > Should this work?  And if not, is there a way to do what I want?
> 
> 
> > ? z = polcompositum(x^2-3, 12*x^2-1, 1)[1];
> 
> What is it meant for ?
> x^2-3 and 12*x^2-1 define the same field (Q(sqrt(3)))

I have some code that generates several number fields and then merges
them together into a single combined number field.  These initial
number fields may not all be different; rather than check whether they
are different before I do the combination, I just merge them together
regardless.  (I realize that this may not be the most efficient way to
do this.  I haven't done any profiling yet, but I'm pretty sure that
the Pari code in general is not the bottleneck in my application.)

When I tried to run my code, it failed because of the bug in
polredabs.  It happens that in my first test case, the failure I found
was when merging number fields that are the same.

> > ? pol = z[1]
> > %2 = 12*x^2 - 49
> You get a third definition of the same field...
> 
> > ? a = z[2]; a^2-3
> > %3 = 0
> > ? z = polredabs(pol, 1);
> > ? pol = z[1]
> > %5 = x^2 - 3
> You get the definition you had at the start!
> > ? a = subst(a.pol, x, z[2])
> 
> OK polredabs(,1) is buggy so a is wrong here.
> 
> Maybe what you want to do is 
> ? z = factornf(12*x^2-1,y^2-3)
> %1 =
> [Mod(1, y^2 - 3)*x + Mod(-1/6*y, y^2 - 3) 1]
> 
> [Mod(1, y^2 - 3)*x + Mod(1/6*y, y^2 - 3) 1]
> ? a=lift(-subst(z[1,1],x,0))
> %2 = 1/6*y

I did end up working around the polredabs bug by using factornf after
doing the polredabs; it just seems inelegant to do so when polredabs
should give me the information I need.  I'll stick with my current
code for now, and switch back to my original code when the next
version of Pari comes out.

Thanks for your help!

Carl Witty