On Thu, Feb 21, 2008 at 4:50 PM, John Palmieri <[EMAIL PROTECTED]> wrote:
>
>
>
>
>  On Feb 21, 2:18 am, Simon King <[EMAIL PROTECTED]> wrote:
>  > 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
>
>  I'm having problems with this: if I call this tensorpower.spyx (or use
>  the one you emailed to me), I get this:
>
>  sage: attach tensorpower.spyx
>  Loading of file "/Users/palmieri/.sage/tensorpower.spy" has type not
>  implemented.
>
>  If I rename it to tensor.sage (not sure if this is a good idea),

Yes, that's a VERY GOOD idea.  It's really crazy to use a compiled
spyx for the purposes of interfacing with the Singular interpreter
via pexpect.

>  I get:
>
>  sage: attach tensor.sage
>   line 10
>     for nr from Integer(0)<=nr<n-Integer(1):
>
>  The same thing happens if I type the function definition directly into
>  Sage.

That's as it should be.  That's all that happens when you attached
a file.  It's supposed to be the same as typing in the code.

>
>  This is with Sage 2.10.1 on Mac OS X (although I can test it on a
>  linux machine tomorrow). I'm probably doing something stupid,
>  though...
>
>  I have one question about the results of your computation; see below.
>

One trivial thing occurred to me. Sage includes Maxima and has a very
interface to it.  Maybe Maxima can do the sort of noncommutative
calculations you want -- it's worth at least checking.    The main reason
I suggest this is: (1) you're not going to do something that pushes the
limits of computation, so speed isn't of the utmost importance,
and (2) you (John's) main programming background is in lisp,
so you might feel very comfortable with Maxima, given that it
is written in lisp.

http://maxima.sourceforge.net/

sage: maxima('2+2')
4


 -- William

>
>
>  > 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
>
>  Shouldn't this be 9?
>
>
>
>
>  > //        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
>  >
>



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

--~--~---------~--~----~------------~-------~--~----~
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