Algebraic gcd? (Was Re: Rothstein-Trager algorithm)



On 5/5/10 1:05 AM, Leo Butler wrote:
> I also see that cvs Maxima gives the correct answer for your problem,
> too.
> 
> (%i1) declare(a,integer)$ assume(a>0)$
> 
> (%i3) gcd(a,0);
> (%o3)                                  a
> (%i4) gcd(x,0);
> (%o4)                                  x
> (%i5) tellrat(t-1)$
> 
> (%i6) gcd(x,1-t),algebraic:true,gcd:subres;
> (%o6)                                  x

Yes, I get these results too.  I defined

algebraic_gcd(a,b,r,v) :=
  block([algebraic:true, gcd:subres, result],
    tellrat(r),
    result : gcd(a,b),
    untellrat(v),
    result);

This works nicely from the repl.  But when called from
int_rational_function which calls int_rational_log_part that calls
algebraic_gcd, trace says algebraic_gcd returns 1.

Something is messed up, but I don't know what.  (The code has changed
somewhat since I posted it, but these routines haven't really changed.)

Ray