Compute xgcd over Gaussian integers

asked 6 years ago

Hilder Vitor Lima Pereira gravatar image

updated 6 years ago

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,vZ[i] such that uF+vG=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?

Preview: (hide)

Comments

1

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 with gaussian_quo).

rburing gravatar imagerburing ( 6 years ago )
1

@rburing I see. Thank you very for the comment. It was very useful!

Hilder Vitor Lima Pereira gravatar imageHilder Vitor Lima Pereira ( 6 years ago )