Ask Your Question
0

how to get two modules tensor_prduct()

asked 2014-07-16 09:05:27 +0200

cjsh gravatar image

updated 2014-07-18 03:16:10 +0200

u = vector(QQ, [1/2, 1/3, 1/4, 1/5])
v = vector(ZZ, [60, 180, 600])
u.outer_product(v),v.outer_product(u),u.tensor_product(v),v.tensor_product(u)

(
[ 30  90 300]                     [ 30  90 300]                   
[ 20  60 200]  [ 30  20  15  12]  [ 20  60 200]  [ 30  20  15  12]
[ 15  45 150]  [ 90  60  45  36]  [ 15  45 150]  [ 90  60  45  36]
[ 12  36 120], [300 200 150 120], [ 12  36 120], [300 200 150 120]
)

above are two vectors'tensor_product,but when use two mudules,cannot run....

M=FreeModule(ZZ,3);M
N=FreeModule(ZZ,7);N
M.outer_product(N),M.tensor_product(N)

AttributeError                            Traceback (most recent call last)
<ipython-input-1-ad4483c60043> in <module>()
      1 M=FreeModule(ZZ,Integer(3));M
      2 N=FreeModule(ZZ,Integer(7));N
----> 3 M.outer_product(N),M.tensor_product(N)

/home/sageserver/sage/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__getattr__ (build/cythonized/sage/structure/parent.c:7367)()

/home/sageserver/sage/local/lib/python2.7/site-packages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (build/cythonized/sage/structure/misc.c:1687)()

AttributeError: 'FreeModule_ambient_pid_with_category' object has no attribute 'outer_product'
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-07-18 03:18:43 +0200

Objects constructed using FreeModule don't seem to have a tensor product implemented. If you use CombinatorialFreeModule instead, it will work. This second version of free modules requires you to specify a basis.

sage: M = CombinatorialFreeModule(ZZ, ('a', 'b', 'c'))
sage: N = CombinatorialFreeModule(ZZ, ('w', 'x', 'y', 'z'))
sage: tensor([M,N])
Free module generated by {'a', 'b', 'c'} over Integer Ring # Free module generated by {'w', 'x', 'y', 'z'} over Integer Ring

(The symbol # is used to denoted the tensor product.)

edit flag offensive delete link more

Comments

thank you very much! modules tensor_prduct'meanings puzzle me all a along,now I know more. it is in Documentation-Combinatorial Algebras,do you write it yesterday? http://sagemath.org/doc/reference/combinat/sage/combinat/free_module.htmlhttp://sagemath.org/doc/reference/modules/index.html

cjsh gravatar imagecjsh ( 2014-07-18 13:36:37 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-07-16 09:05:27 +0200

Seen: 259 times

Last updated: Jul 18 '14