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. 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 <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org