On Fri, Nov 19, 2010 at 9:55 AM, BFJ <benjaminfjo...@gmail.com> wrote:
> It seems to me that the issue might be that Sage doesn't understand
> how Hom(ZZ^3, ZZ^1) is a (free) module over ZZ.

Correct.  H=Hom(ZZ^3, ZZ^1) is a homset in the category of "modules
with basis over ZZ".  In Sage, H simply doesn't also have the
structure of object in this category.

sage: H = Hom(ZZ^3, ZZ^1)
sage: H.category()
Category of hom sets in Category of modules with basis over Integer Ring
sage: type(H)
<class 'sage.modules.free_module_homspace.FreeModuleHomspace_with_category'>

There is also no possible way to make H an object in that category.

You could create a new type of free module that models the dual of a
free module, if you want.
You would likely write the code for this and put it in

   sage-x.y.z/devel/sage/sage/modules

modeling it on the code in free_module.py.

This is a nontrivial project, which might take a few days for an
experienced developer.

Why precisely do you want to do this?  Is it entirely so you can write
f(v), where f is in the dual and v is the space?  If so, you could
make a new type called "DualFreeModuleElement" (say), which derives
from FreeModuleElement (defined in free_module_element.pyx), and give
it a different __call__ method, but leave everything else the same.

 -- William

>  If you could coerce it
> into that category, then the object H = Hom(ZZ^3, ZZ^1) would have
> generators induced by those of ZZ^3 and ZZ^1 and then specifying a map
> in Hom( ZZ^3, Hom( ZZ^3, ZZ^1 ) ) would go something like:
>
> {{{
> H = Hom( ZZ^3, ZZ^1 )
> HH = Hom( ZZ^3, H )
> f = H(0)
>
> phi = HH( [f, f, f] )
> }}}
>
> but this doesn't work, I get:
> AttributeError: 'FreeModuleHomspace_with_category' object has no
> attribute 'coordinates'
>
> I tried some other things.. one would like to define an isomorphism
> between ZZ^3 and Hom( ZZ^3, ZZ^1 ), but the obvious thing (to me)
> doesn't work:
>
> {{{
> M = ZZ^3
> H = Hom( ZZ^3, ZZ^1 )
> phi = M.hom( [ H([1,0,0]), H([0,1,0]), H([0,0,1]) ], H )
> }}}
>
> raises: AttributeError: 'FreeModuleHomspace_with_category' object has
> no attribute 'coordinates'
>
> Again, I guess the ZZ-module structure on H is necessary in order to
> define a morphism by specifying where the generators of M go.
>
>
> On Nov 18, 5:29 pm, Johannes <dajo.m...@web.de> wrote:
>> Hi,
>> I'm looking for a way to create a map from ZZ^3 to Hom(ZZ^3,Z) mapping
>> an element x to x :-> <x,-> where <-,-> is the default scalarproduct.
>> i know i could do this by vertormultiplikation, but i want to know if
>> it's possible to do with the Hom function.
>>
>> I tried this one:
>> H = Hom(ZZ^3,Hom(ZZ^3,ZZ)) #this works
>> #creating a very simple homom. fails:
>> f = H([0,0,0])
>> ---------------------------------------------------------------------------
>> AttributeError                            Traceback (most recent call last)
>>
>> /home/j_schn14/<ipython console> in <module>()
>>
>> /opt/sage-4.6/local/lib/python2.6/site-packages/sage/modules/free_module_ho 
>> mspace.pyc
>> in __call__(self, A, check)
>>     126             C = self.codomain()
>>     127             try:
>> --> 128                 v = [C(a) for a in A]
>>     129                 A = matrix.matrix([C.coordinates(a) for a in v])
>>
>>     130             except TypeError:
>>
>> /opt/sage-4.6/local/lib/python2.6/site-packages/sage/modules/free_module_ho 
>> mspace.pyc
>> in __call__(self, A, check)
>>     130             except TypeError:
>>     131                 pass
>> --> 132         return free_module_morphism.FreeModuleMorphism(self, A)
>>     133
>>     134     def _matrix_space(self):
>>
>> /opt/sage-4.6/local/lib/python2.6/site-packages/sage/modules/free_module_mo 
>> rphism.pyc
>> in __init__(self, parent, A)
>>      81         if isinstance(A, matrix_morphism.MatrixMorphism):
>>      82             A = A.matrix()
>> ---> 83         A = parent._matrix_space()(A)
>>      84         matrix_morphism.MatrixMorphism.__init__(self, parent, A)
>>      85
>>
>> /opt/sage-4.6/local/lib/python2.6/site-packages/sage/modules/free_module_ho 
>> mspace.pyc
>> in _matrix_space(self)
>>     150         except AttributeError:
>>     151             R = self.domain().base_ring()
>> --> 152             M = matrix.MatrixSpace(R, self.domain().rank(),
>> self.codomain().rank())
>>     153             self.__matrix_space = M
>>     154             return M
>>
>> is this a bug, or something which is just not implemented?
>> It fails if i use QQ instead of ZZ too.
>>
>> greatz Johannes
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to