コード例 #1
0
def are_projectively_equivalent(P, Q, base_ring):
    """
    Test whether ``P`` and ``Q`` are projectively equivalent.

    INPUT:

    - ``P``, ``Q`` -- list/tuple of projective coordinates.

    - ``base_ring`` -- the base ring.

    OUTPUT:

    Boolean.

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.constructor import are_projectively_equivalent
        sage: are_projectively_equivalent([0,1,2,3], [0,1,2,2], base_ring=QQ)
        False
        sage: are_projectively_equivalent([0,1,2,3], [0,2,4,6], base_ring=QQ)
        True
    """
    from sage.matrix.constructor import matrix
    return matrix(base_ring, [P, Q]).rank() & lt
    2
コード例 #2
0
ファイル: constructor.py プロジェクト: Etn40ff/sage
def are_projectively_equivalent(P, Q, base_ring):
    """
    Test whether ``P`` and ``Q`` are projectively equivalent.

    INPUT:

    - ``P``, ``Q`` -- list/tuple of projective coordinates.

    - ``base_ring`` -- the base ring.

    OUTPUT:

    Boolean.

    EXAMPLES::

        sage: from sage.schemes.elliptic_curves.constructor import are_projectively_equivalent
        sage: are_projectively_equivalent([0,1,2,3], [0,1,2,2], base_ring=QQ)
        False
        sage: are_projectively_equivalent([0,1,2,3], [0,2,4,6], base_ring=QQ)
        True
    """
    from sage.matrix.constructor import matrix
    return matrix(base_ring, [P, Q]).rank() < 2
コード例 #3
0
ファイル: monodromy.py プロジェクト: a-goyer/ore_algebra
def _test_monodromy_matrices():
    r"""
    TESTS::

        sage: from ore_algebra.analytic.monodromy import _test_monodromy_matrices
        sage: _test_monodromy_matrices()
    """
    from sage.all import matrix
    from ore_algebra import DifferentialOperators
    Dops, x, Dx = DifferentialOperators()

    h = QQ(1) / 2
    i = QQi.gen()

    def norm(m):
        return sum(c.abs()**2 for c in m.list()).sqrtpos()

    mon = monodromy_matrices((x**2 + 1) * Dx - 1, QQ(1000000))
    assert norm(mon[0] - CBF(pi).exp()) < RBF(1e-10)
    assert norm(mon[1] - CBF(-pi).exp()) < RBF(1e-10)

    mon = monodromy_matrices((x**2 - 1) * Dx - 1, QQ(0))
    assert all(m == -1 for m in mon)

    dop = (x**2 + 1) * Dx**2 + 2 * x * Dx
    mon = monodromy_matrices(dop, QQbar(i + 1))  # mon[0] <--> i
    assert norm(mon[0] - matrix(CBF, [[1, pi *
                                       (1 + 2 * i)], [0, 1]])) < RBF(1e-10)
    assert norm(mon[1] - matrix(CBF, [[1, -pi *
                                       (1 + 2 * i)], [0, 1]])) < RBF(1e-10)
    mon = monodromy_matrices(dop, QQbar(-i + 1))  # mon[0] <--> -i
    assert norm(mon[0] - matrix(CBF, [[1, pi *
                                       (-1 + 2 * i)], [0, 1]])) < RBF(1e-10)
    assert norm(mon[1] - matrix(CBF, [[1, pi *
                                       (1 - 2 * i)], [0, 1]])) < RBF(1e-10)
    mon = monodromy_matrices(dop, QQbar(i))  # mon[0] <--> i
    assert norm(mon[0] - matrix(CBF, [[1, 0], [2 * pi * i, 1]])) < RBF(1e-10)
    assert norm(mon[1] - matrix(CBF, [[1, 0], [-2 * pi * i, 1]])) < RBF(1e-10)
    mon = monodromy_matrices(dop, QQbar(i), sing=[QQbar(i)])
    assert len(mon) == 1
    assert norm(mon[0] - matrix(CBF, [[1, 0], [2 * pi * i, 1]])) < RBF(1e-10)
    mon = monodromy_matrices(dop, QQbar(i), sing=[QQbar(-i)])
    assert len(mon) == 1
    assert norm(mon[0] - matrix(CBF, [[1, 0], [-2 * pi * i, 1]])) < RBF(1e-10)
    mon = monodromy_matrices(dop, QQbar(-i), sing=[QQbar(i)])
    assert len(mon) == 1
    assert norm(mon[0] - matrix(CBF, [[1, 0], [-2 * pi * i, 1]])) < RBF(1e-10)
    mon = monodromy_matrices(dop, QQbar(i), sing=[])
    assert mon == []

    dop = (x**2 + 1) * (x**2 - 1) * Dx**2 + 1
    mon = monodromy_matrices(dop, QQ(0), sing=[QQ(1), QQbar(i)])
    m0 = dop.numerical_transition_matrix([0, i + 1, 2 * i, i - 1, 0])
    assert norm(m0 - mon[0]) < RBF(1e-10)
    m1 = dop.numerical_transition_matrix([0, 1 - i, 2, 1 + i, 0])
    assert norm(m1 - mon[1]) < RBF(1e-10)

    dop = x * (x - 3) * (x - 4) * (x**2 - 6 * x + 10) * Dx**2 - 1
    mon = monodromy_matrices(dop, QQ(-1))
    m0 = dop.numerical_transition_matrix([-1, -i, 1, i, -1])
    assert norm(m0 - mon[0]) < RBF(1e-10)
    m1 = dop.numerical_transition_matrix(
        [-1, i / 2, 3 - i / 2, 3 + h, 3 + i / 2, i / 2, -1])
    assert norm(m1 - mon[1]) < RBF(1e-10)
    m2 = dop.numerical_transition_matrix(
        [-1, i / 2, 3 + i / 2, 4 - i / 2, 4 + h, 4 + i / 2, i / 2, -1])
    assert norm(m2 - mon[2]) < RBF(1e-10)
    m3 = dop.numerical_transition_matrix([-1, 3 + i + h, 3 + 2 * i, -1])
    assert norm(m3 - mon[3]) < RBF(1e-10)
    m4 = dop.numerical_transition_matrix(
        [-1, 3 - 2 * i, 3 - i + h, 3 - i / 2, -1])
    assert norm(m4 - mon[4]) < RBF(1e-10)

    dop = (x - i)**2 * (x + i) * Dx - 1
    mon = monodromy_matrices(dop, 0)
    assert norm(mon[0] + i) < RBF(1e-10)
    assert norm(mon[1] - i) < RBF(1e-10)

    dop = (x - i)**2 * (x + i) * Dx**2 - 1
    mon = monodromy_matrices(dop, 0)
    m0 = dop.numerical_transition_matrix([0, i + 1, 2 * i, i - 1, 0])
    assert norm(m0 - mon[0]) < RBF(1e-10)
    m1 = dop.numerical_transition_matrix([0, -i - 1, -2 * i, -i + 1, 0])
    assert norm(m1 - mon[1]) < RBF(1e-10)