Compute xgcd over Gaussian integers
As you can see below, I can create the ring of Gaussian integers and compute the greatest common divisor of two elements:
sage: ZZ[I]
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
sage: F = ZZ[I].random_element()
sage: G = ZZ[I].random_element()
sage: F
-I - 4
sage: G
-I + 1
sage: gcd(F, G)
1
However, when I try to find u,v∈Z[i] such that u⋅F+v⋅G=1 in Z[i] (that is, to run the extended GCD), I get the following error:
sage: xgcd(F, G)
. . .
TypeError: Unable to coerce -I - 4 to an integer
Do you know how I can find such u and v?
I don't think this is built in yet, but see this question for an implementation: Solving systems of congruences with Gaussian integers (the
extended_euclides
withgaussian_quo
).@rburing I see. Thank you very for the comment. It was very useful!