def test_modgcd_algebraic_field_random(): A = QQ.algebraic_field(sqrt(2), sqrt(3)) R, x, y, z = ring("x, y, z", A) h = x**2 * y**3 + 1111 * sqrt(6) / 12 * z a, b = 11 * y**3 + 2, (y + x - 1) * h assert func_field_modgcd(h * a, h * b) == (h, a, b) a, b = 12 * y + 2 * x - 1, (y + x - 1) * h assert func_field_modgcd(h * a, h * b) == (h, a, b)
def test_modgcd_algebraic_field(): A = AlgebraicField(QQ, sqrt(2)) R, x = ring("x", A) one = A.one f, g = 2 * x, R(2) assert func_field_modgcd(f, g) == (one, f, g) f, g = 2 * x, R(sqrt(2)) assert func_field_modgcd(f, g) == (one, f, g) f, g = 2 * x + 2, 6 * x**2 - 6 assert func_field_modgcd(f, g) == (x + 1, R(2), 6 * x - 6) R, x, y = ring("x, y", A) f, g = x + sqrt(2) * y, x + y assert func_field_modgcd(f, g) == (one, f, g) f, g = x * y + sqrt(2) * y**2, R(sqrt(2)) * y assert func_field_modgcd(f, g) == (y, x + sqrt(2) * y, R(sqrt(2))) f, g = x**2 + 2 * sqrt(2) * x * y + 2 * y**2, x + sqrt(2) * y assert func_field_modgcd(f, g) == (g, g, one) A = AlgebraicField(QQ, sqrt(2), sqrt(3)) R, x, y, z = ring("x, y, z", A) h = x**2 * y**7 + sqrt(6) / 21 * z f, g = h * (27 * y**3 + 1), h * (y + x) assert func_field_modgcd(f, g) == (h, 27 * y**3 + 1, y + x) h = x**13 * y**3 + 1 / 2 * x**10 + 1 / sqrt(2) f, g = h * (x + 1), h * sqrt(2) / sqrt(3) assert func_field_modgcd(f, g) == (h, x + 1, R(sqrt(2) / sqrt(3))) A = AlgebraicField(QQ, sqrt(2)**(-1) * sqrt(3)) R, x = ring("x", A) f, g = x + 1, x - 1 assert func_field_modgcd(f, g) == (A.one, f, g)
def test_modgcd_algebraic_field_random(): A = QQ.algebraic_field(sqrt(2), sqrt(3)) R, x, y, z = ring("x, y, z", A) h = x**2*y**3 + 1111*sqrt(6)/12*z f, g = h*(11*y**3 + 2), h**2*(y + x - 1) assert func_field_modgcd(f, g) == (h, 11*y**3 + 2, h*(y + x - 1))
def test_modgcd_algebraic_field(): A = QQ.algebraic_field(sqrt(2)) R, x = ring("x", A) one = A.one f, g = 2*x, R(2) assert func_field_modgcd(f, g) == (one, f, g) f, g = 2*x, R(sqrt(2)) assert func_field_modgcd(f, g) == (one, f, g) f, g = 2*x + 2, 6*x**2 - 6 assert func_field_modgcd(f, g) == (x + 1, R(2), 6*x - 6) R, x, y = ring("x, y", A) f, g = x + sqrt(2)*y, x + y assert func_field_modgcd(f, g) == (one, f, g) f, g = x*y + sqrt(2)*y**2, R(sqrt(2))*y assert func_field_modgcd(f, g) == (y, x + sqrt(2)*y, R(sqrt(2))) f, g = x**2 + 2*sqrt(2)*x*y + 2*y**2, x + sqrt(2)*y assert func_field_modgcd(f, g) == (g, g, one) A = QQ.algebraic_field(sqrt(2), sqrt(3)) R, x, y, z = ring("x, y, z", A) h = x**2*y**7 + sqrt(6)/21*z f, g = h*(27*y**3 + 1), h*(y + x) assert func_field_modgcd(f, g) == (h, 27*y**3+1, y+x) h = x**13*y**3 + 1/2*x**10 + 1/sqrt(2) f, g = h*(x + 1), h*sqrt(2)/sqrt(3) assert func_field_modgcd(f, g) == (h, x + 1, R(sqrt(2)/sqrt(3))) h = x**4*y**9 + sqrt(6)/22*z f, g = h*(21*y**3 + 1), h*(y + x) assert func_field_modgcd(f, g) == (x**4*y**9 + sqrt(6)/22*z, 21*y**3 + 1, x + y) h = x**4*y**3 + sqrt(6)/22*z f, g = h*(11*y**3 + 1), h*(y + x) assert func_field_modgcd(f, g) == (x**4*y**3 + sqrt(6)/22*z, 11*y**3 + 1, x + y) A = QQ.algebraic_field(sqrt(2)**(-1)*sqrt(3)) R, x = ring("x", A) f, g = x + 1, x - 1 assert func_field_modgcd(f, g) == (A.one, f, g)