Exemplo n.º 1
0
def test_modgcd_func_field():
    D, t = ring('t', ZZ)
    R, x, z = ring('x, z', D)

    minpoly = (z**2 * t**2 + z**2 * t - 1).drop(0)
    f, g = x + 1, x - 1

    assert _func_field_modgcd_m(f, g, minpoly) == R.one

    # First example from Monagan2004algebraic.
    m = z**2 - t
    f = 3 * t * x**2 - (2 * t**2 - 3 * t) * x * z + 15 * x + 15 * z - 2 * t**3
    g = 3 * t * x**2 * z + 15 * x * z + (-2 * t**3 +
                                         3 * t) * x - 2 * t**2 * z + 15

    assert _func_field_modgcd_m(f, g,
                                m.drop(0)) == 3 * t * x - 2 * t**2 * z + 15

    g = 3 * t * x - 2 * t**2 * z + 15
    a = x + z
    b = x * z + 1

    assert _func_field_modgcd_m(a * g, b * g, m.drop(0)) == g % m
    assert _func_field_modgcd_m(a * g**2, b * g**2, m.drop(0)) == g**2 % m

    # issue diofant/diofant#850
    assert _func_field_modgcd_m(a * g**3, b * g**3, m.drop(0)) == g**3 % m
Exemplo n.º 2
0
def test_modgcd_func_field():
    D, t = ring("t", ZZ)
    R, x, z = ring("x, z", D)

    minpoly = (z**2 * t**2 + z**2 * t - 1).drop(0)
    f, g = x + 1, x - 1

    assert _func_field_modgcd_m(f, g, minpoly) == R.one
Exemplo n.º 3
0
def test_modgcd_func_field():
    D, t = ring("t", ZZ)
    R, x, z = ring("x, z", D)

    minpoly = (z**2*t**2 + z**2*t - 1).drop(0)
    f, g = x + 1, x - 1

    assert _func_field_modgcd_m(f, g, minpoly) == R.one