Let p = (z+%i-1)^2. Then gcd(p, diff(p,z)) = z+%i-1. Using the four gcd methods and
the two values for algebraic, compute gcd(p, diff(p,z)):
(%i1) p : z^2 + (2*%i - 2)*z - 2*%i$
(%i2) g : ['ez, 'subres, 'red, 'spmod]$
(%i3) a : [true,false]$
(%i4) m : []$
(%i5) for gx in g do (
for ax in a do (
gcd : gx,
algebraic : ax,
m : cons([gx,ax,gcd(p,diff(p,z))],m)))$
(%i6) funmake('matrix, cons(['gcd, 'algebraic, 'xxx],m));
(%o6) matrix([gcd,algebraic,xxx],
[spmod,false,1],
[spmod,true,1],
[red,false,1],
[red,true,z+%i-1],
[subres,false,1],
[subres,true,z+%i-1],
[ez,false,1],
[ez,true,1])
Try again, but first gfactor p:
(%i7) p : gfactor(p);
(%o7) (z+%i-1)^2
(%i8) m : []$
(%i9) for gx in g do (
for ax in a do (
gcd : gx,
algebraic : ax,
m : cons([gx,ax,gcd(p,diff(p,z))],m)))$
(%i10) funmake('matrix, cons(['gcd, 'algebraic, 'xxx],m));
(%o10) matrix([gcd,algebraic,xxx],
[spmod,false,z+%i-1],
[spmod,true,1],
[red,false,z+%i-1],
[red,true,z+%i-1],
[subres,false,z+%i-1],
[subres,true,z+%i-1],
[ez,false,z+%i-1],
[ez,true,1])
It's disappointing that *any* implementation of gcd would give different
results for a factored / expanded input. And look at the spmod (default)
results: The value is correct only for a factored input with algebraic
equal *false*. I would have guessed that algebraic would need to be true.
--Barton