On 11/10/2008 10:31 PM, koffie wrote: >> sage: C = VectorSpaces(GF(5)) >> sage: C >> Category of vector spaces over Finite Field of size 5 >> sage: W = (ZZ^3).span([[1,2,3],[4,5,3]]) >> sage: W >> >> Free module of degree 3 and rank 2 over Integer Ring >> Echelon basis matrix: >> [1 2 3] >> [0 3 9] >> sage: C(W) >> >> Vector space of degree 3 and dimension 2 over Finite Field of size 5 >> Basis matrix: >> [1 0 2] >> [0 1 3] >> >> That looks to me as if C is like a coercion function. > >> Ralf > > Wel looking at it mathematically, you would like C to be some functor > from free modules over Z to vectorspases over Finite Fields of size 5.
I have nothing against functors. However, as I understand, C is a >> Category of vector spaces over Finite Field of size 5 and that does not sound like a "functor". > And taking this in mind I think this is a good behaviour of C(W), > since this behaviour is for example similar to that of F5(x) in the > example below: > sage: F5=GF(5) > sage: F5 > Finite Field of size 5 > sage: x=ZZ(102) > sage: F5(x) > 2 > That is F5() tries to make an element in F5() of 102 as C tries to > make a vectorfield over GF(5) out of W. So maybe it is also not bad to > have coercion functions defined for categories. In in the above form "ZZ(102)" and "F5(x)" you basically use ZZ and F5 to denote a type cast. That is what I called "coercion" (which is basically a function ZZ -> F5). My question now (still being a bit unfamiliar with python) would be, where can I find the documentation of what is allowed for x in something like F5(x). I guess F5("some string") does not work. I'd like to be sure that code I write does not break at runtime. A pointer to the documentation is highly appreciated. Thank you Ralf --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---