Ask Your Question

Revision history [back]

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 \in \mathbf{Z}[i]$ such that $u\cdot F + v\cdot G = 1$ in $\mathbf{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$?

Compute xgcd over Gaussian integers

As you can see below, I can create the ring of Gaussian integers 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 \in \mathbf{Z}[i]$ such that $u\cdot F + v\cdot G = 1$ in $\mathbf{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$?