Hello,
Le 25/01/2015 21:04, Vincent Delecroix a écrit :
Hello,
On sage-support somebody reported the following strange behavior
sage: gcd(6/1,2/1)
2
sage: xgcd(6/1,2/1)
(1, 1/6, 0)
I opened #17671 for that and it comes from the fact that there is a
custom gcd for QuotientFields but no associated xgcd. I did it and it
work fine.
But, in order to get this behavior fixed once for all I introduced a
test "_test_gcd_vs_xgcd" in the category CommutativeRings to check
compatibility between gcd and xgcd if they are implemented. But it
appear that some polynomial ring just fail:
sage: TestSuite(Zmod(10)['a']).run()
Failure in _test_gcd_vs_xgcd:
...
AssertionError: The methods gcd and xgcd disagree:
gcd(a,2*a^2 + 2) = 1
xgcd(a,2*a^2 + 2) = (2, 8*a, 1)
------------------------------------------------------------
The following tests failed: _test_gcd_vs_xgcd
My question is: do we have a use case where gcd and xgcd should disagree?
To me, xgcd returns the GCD together with Bézout coefficients, so it
should always be the case that xgcd(m,n)[0] == gcd(m,n).
Vincent
PS: On a related note, the following looks very wrong to me
{{{
sage: x = polygen(ZZ)
sage: (x+2).gcd(x+4)
1
}}}
Why does it look wrong to you? In ZZ[x], (x+2) and (x+4) are two
irreducible monic polynomials, so their GCD is 1. Or I am missing
something...
Best
Bruno
--
You received this message because you are subscribed to the Google Groups
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.