Ejemplo n.º 1
0
    def _element_constructor_(self, x):
        r"""
        Coerce x into an element of this function field, possibly not canonically.

        INPUT:
        
            - ``x`` - the element
         
        OUTPUT:
        
            ``x``, as an element of this function field

        EXAMPLES::
        
            sage: K.<t> = FunctionField(QQ)
            sage: a = K._element_constructor_(K.maximal_order().gen()); a
            t
            sage: a.parent()
            Rational function field in t over Rational Field
        """
        if x.parent() is self._field:
            return function_field_element.FunctionFieldElement_rational(self, x)
        if isinstance(x, function_field_element.FunctionFieldElement):
            return function_field_element.FunctionFieldElement_rational(self, self._field(x.element()))
        if x.parent() is self.polynomial_ring():
            return x[0]
        return function_field_element.FunctionFieldElement_rational(self, self._field(x))
Ejemplo n.º 2
0
    def _element_constructor_(self, f):
        """
        EXAMPLES::

            sage: R.<y> = FunctionField(QQ)
            sage: R.maximal_order()._element_constructor_(y)
            y
        """
        # HUGE TODO: have to check that f is really in self!!
        if f.parent() is self.fraction_field():
            f = f.element()
        elif f.parent() is self._ring:
            return function_field_element.FunctionFieldElement_rational(
                self, f)
        return function_field_element.FunctionFieldElement_rational(
            self, self._ring(f))