def vector_space(self): """ Return a vector space V and isomorphisms self --> V and V --> self. OUTPUT: - ``V`` -- a vector space over the rational numbers - ``from_V`` -- an isomorphism from V to self - ``to_V`` -- an isomorphism from self to V EXAMPLES:: sage: K.<x> = FunctionField(QQ) sage: K.vector_space() (Vector space of dimension 1 over Rational function field in x over Rational Field, Isomorphism morphism: From: Vector space of dimension 1 over Rational function field in x over Rational Field To: Rational function field in x over Rational Field, Isomorphism morphism: From: Rational function field in x over Rational Field To: Vector space of dimension 1 over Rational function field in x over Rational Field) """ V = self.base_field()**1 from maps import MapVectorSpaceToFunctionField, MapFunctionFieldToVectorSpace from_V = MapVectorSpaceToFunctionField(V, self) to_V = MapFunctionFieldToVectorSpace(self, V) return (V, from_V, to_V)
def vector_space(self): """ Return a vector space V and isomorphisms self --> V and V --> self. This function allows us to identify the elements of self with elements of a vector space over the base field, which is useful for representation and arithmetic with orders, ideals, etc. OUTPUT: - ``V`` -- a vector space over base field - ``from_V`` -- an isomorphism from V to self - ``to_V`` -- an isomorphism from self to V EXAMPLES: We define a function field:: sage: K.<x> = FunctionField(QQ); R.<y> = K[] sage: L.<y> = K.extension(y^5 - (x^3 + 2*x*y + 1/x)); L Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x We get the vector spaces, and maps back and forth:: sage: V, from_V, to_V = L.vector_space() sage: V Vector space of dimension 5 over Rational function field in x over Rational Field sage: from_V Isomorphism morphism: From: Vector space of dimension 5 over Rational function field in x over Rational Field To: Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x sage: to_V Isomorphism morphism: From: Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x To: Vector space of dimension 5 over Rational function field in x over Rational Field We convert an element of the vector space back to the function field:: sage: from_V(V.1) y We define an interesting element of the function field:: sage: a = 1/L.0; a (-x/(-x^4 - 1))*y^4 + 2*x^2/(-x^4 - 1) We convert it to the vector space, and get a vector over the base field:: sage: to_V(a) (2*x^2/(-x^4 - 1), 0, 0, 0, -x/(-x^4 - 1)) We convert to and back, and get the same element:: sage: from_V(to_V(a)) == a True In the other direction:: sage: v = x*V.0 + (1/x)*V.1 sage: to_V(from_V(v)) == v True And we show how it works over an extension of an extension field:: sage: R2.<z> = L[]; M.<z> = L.extension(z^2 -y) sage: M.vector_space() (Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x, Isomorphism morphism: From: Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x To: Function field in z defined by z^2 - y, Isomorphism morphism: From: Function field in z defined by z^2 - y To: Vector space of dimension 2 over Function field in y defined by y^5 - 2*x*y + (-x^4 - 1)/x) """ V = self.base_field()**self.degree() from maps import MapVectorSpaceToFunctionField, MapFunctionFieldToVectorSpace from_V = MapVectorSpaceToFunctionField(V, self) to_V = MapFunctionFieldToVectorSpace(self, V) return (V, from_V, to_V)