Dear John,

i think i figured out how to form a tensor product of several copies
of a (non-commutative) ring with itself...

On Feb 20, 9:47 pm, "William Stein" <[EMAIL PROTECTED]> wrote:
<snip>
> No, that would not be reasonable. [[woah, John Palmieri just appeared
> in my office... chat for a while...] Anyway, copy should return an exact
> copy since that's the semantics of __copy__ in Python.  However,
> I strongly encourage you to write  a method like you describe and
> just call it something slightly different, e.g.,
>      def change_names(self, ...):
<snip>

... and i can also demonstrate how "change_names" could work.

The idea is as follows.
Singular describes a ring by means of a "ringlist". It provides the
variable names, the characteristic, the ordering, and also (if it
applies) the non-commutative relations or quotients by an ideal.

Now, we simply change the variable names in the ringlist and form a
new ring by the altered ringlist. Eventually, we sum up the copies of
the ring.
I've put the following into a file tensorpower.spyx:

import sage
import sage.all
from sage.interfaces.singular import singular

def tensorpower(R,n):
    R.set_ring()
    L=R.ringlist()
    OutR=R
    for nr from 0<=nr<n-1:
        R.set_ring()
        for i from 1<=i<=len(L[2]):
            singular.eval('%s[2][%d] = "%s"'%(L.name(),i,"'"+str(L[2]
[i])))
        OutR=OutR+L.ring()
    return OutR

Now, i get the following sage session:

sage: attach tensorpower.spyx
Compiling /home/king/Projekte/Plural/tensorpower.spyx...
sage: R=singular.ring(0,'(x1,x12,x2)','dp')
sage: C=singular.matrix(3,3,'1,-1,-1, -1,1,-1, -1,-1,1')
sage: D=singular.matrix(3,3,'0,0,-x12, 0,0,0, 0,0,0')
sage: singular.LIB('ncall.lib')
sage: S=C.nc_algebra(D)
sage: X=tensorpower(S,3)
sage: X.set_ring()
sage: X

//   characteristic : 0
//   number of vars : 6
//        block   1 : ordering dp
//                  : names    x1 x12 x2
//        block   2 : ordering dp
//                  : names    'x1 'x12 'x2
//        block   3 : ordering dp
//                  : names    ''x1 ''x12 ''x2
//        block   4 : ordering C
//   noncommutative relations:
//    x12x1=-x1*x12
//    x2x1=-x1*x2-x12
//    x2x12=-x12*x2
//    'x12'x1=-'x1*'x12
//    'x2'x1=-'x1*'x2-'x12
//    'x2'x12=-'x12*'x2
//    ''x12''x1=-''x1*''x12
//    ''x2''x1=-''x1*''x2-''x12
//    ''x2''x12=-''x12*''x2

So, after tax declaration and adding a doc-string and doc-tests, i
think this might be a patch.

Yours
     Simon

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to