def _call_(self, x):
        r"""
        Convert ``x`` to the codomain.

        EXAMPLES::

            sage: from pyeantic import RealEmbeddedNumberField
            sage: K = NumberField(x**2 - 2, 'a', embedding=sqrt(AA(2)))
            sage: KK = RealEmbeddedNumberField(K)
            sage: a = KK.an_element()
            sage: K(a)
            a

            sage: K = NumberField(x**2 - 2, 'b', embedding=sqrt(AA(2)))
            sage: KK = RealEmbeddedNumberField(K)
            sage: b = KK.an_element()
            sage: K(b)
            b
        """
        rational_coefficients = [
            ZZ(c.get_str()) / ZZ(x.renf_elem.den().get_str())
            for c in x.renf_elem.num_vector()
        ]
        while len(rational_coefficients) < self.domain().number_field.degree():
            rational_coefficients.append(QQ.zero())
        return self.codomain()(rational_coefficients)
Esempio n. 2
0
def is_contained_in_dual(C, D):
    """
    Test if the cone C is contained in the dual of the cone D.
    """
    for v, w in itertools.product(C.rays(), D.rays()):
        if vector(QQ, v) * vector(QQ, w) < QQ.zero():
            return False
    return True
Esempio n. 3
0
def mittag_leffler_e(alpha, beta=1):
    alpha = QQ.coerce(alpha)
    if alpha <= QQ.zero():
        raise ValueError
    num, den = alpha.numerator(), alpha.denominator()
    dop0 = prod(alpha * x * Dx + beta - num + t for t in range(num)) - x**den
    expo = dop0.indicial_polynomial(x).roots(QQ, multiplicities=False)
    pre = prod((x * Dx - k) for k in range(den) if QQ(k) not in expo)
    dop = pre * dop0  # homogenize
    dop = dop.numerator().primitive_part()
    expo = sorted(dop.indicial_polynomial(x).roots(QQ, multiplicities=False))
    assert len(expo) == dop.order()
    ini = [(1 / funs.gamma(alpha * k + beta) if k in ZZ else 0) for k in expo]
    return IVP(0, dop, ini)