login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxTensorProduct revision 8 of 9

1 2 3 4 5 6 7 8 9
Editor: Bill Page
Time: 2009/11/02 07:23:07 GMT-8
Note: TensorProduct

added:

From BillPage Mon Nov 2 07:23:07 -0800 2009
From: Bill Page
Date: Mon, 02 Nov 2009 07:23:07 -0800
Subject: TensorProduct
Message-ID: <20091102072307-0800@axiom-wiki.newsynthesis.org>

TensorProduct is now included with FriCAS. Thank you Franz!

Date: Fri, 15 May 2009 21:03:00 +0200 Franz Lehner wrote:

Attached is a prototype for tensor products. It is free modules over commutative rings.

FreeModule? is defined in poly.spad. FreeModuleCategory? is defined in xpoly.spad.

spad
)abbrev category TENSORC TensorProductCategory
TensorProductCategory(R:CommutativeRing, M : Module(R), N : Module(R)):Category == Module(R) with
    product: (M, N) -> %
)abbrev category TENSORP TensorProductProperty
TensorProductProperty(R:CommutativeRing, M : Module(R), N : Module(R), _
      MxN : TensorProductCategory(R, M, N), S : Module(R)): Category == with
    eval: (MxN, (M, N) -> S) -> S
)abbrev package TENSORD TensorProduct
TensorProduct(R : CommutativeRing, B1 : OrderedSet, B2 : OrderedSet, _
    M1 : FreeModuleCategory(R, B1), M2 : FreeModuleCategory(R, B2)): TPcat == TPimp where
    TPcat == Join(TensorProductCategory(R,M1,M2),FreeModuleCategory(R,Product(B1,B2))) with
             if M1 has Algebra(R) and M2 has Algebra(R) then Algebra(R)
    TERM1 == Record(k: B1, c: R)
    TERM2 == Record(k: B2, c: R)
    B1xB2 == Product(B1,B2)
    TERM  == Record(k: B1xB2, c: R)
    TPimp == FreeModule(R, Product(B1, B2)) add
       import Rep, TERM1, TERM2, TERM, B1xB2
       product(x1:M1,x2:M2):% ==
           zero? x1 or zero? x2 => return 0
           ltx1:List TERM1 := listOfTerms x1
           ltx2:List TERM2 := listOfTerms x2
           res : List TERM := []
           for s1 in ltx1 repeat
               for s2 in ltx2 repeat
                   res := concat!(res,[makeprod(s1.k, s2.k), s1.c*s2.c]$TERM)
           res pretend %
       if M1 has Algebra(R) and M2 has Algebra(R) then 
         (x1:% * x2:%):% ==
              res : % := 0
              for t1 in listOfTerms x1 repeat
                 for t2 in listOfTerms x2 repeat 
                    -- the coefficients
                    t1c:R := t1.c
                    t2c:R := t2.c
                    -- the basis elements
                    t1k:B1xB2 := t1.k
                    t2k:B1xB2 := t2.k
                    t1a: M1 := monom(selectfirst t1k,1)
                    t1b: M2 := monom(selectsecond t1k,1)
                    t2a: M1 := monom(selectfirst t2k,1)
                    t2b: M2 := monom(selectsecond t2k,1)
                    res:= res +  t1.c*t2.c *product(t1a*t2a,t1b*t2b)
              res
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/6037869360649691585-25px001.spad using 
      old system compiler.
   TENSORC abbreviates category TensorProductCategory 
------------------------------------------------------------------------
   initializing NRLIB TENSORC for TensorProductCategory 
   compiling into NRLIB TENSORC 
;;; *** |TensorProductCategory| REDEFINED Time: 0.06 SEC.
finalizing NRLIB TENSORC Processing TensorProductCategory for Browser database: --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSCAT.spad-->TensorProductCategory((product (% M N))): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSCAT.spad-->TensorProductCategory(constructor): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSCAT.spad-->TensorProductCategory(): Missing Description ; compiling file "/var/zope2/var/LatexWiki/TENSORC.NRLIB/TENSORC.lsp" (written 25 MAR 2011 06:19:31 AM):
; /var/zope2/var/LatexWiki/TENSORC.NRLIB/TENSORC.fasl written ; compilation finished in 0:00:00.083 ------------------------------------------------------------------------ TensorProductCategory is now explicitly exposed in frame initial TensorProductCategory will be automatically loaded when needed from /var/zope2/var/LatexWiki/TENSORC.NRLIB/TENSORC
TENSORP abbreviates category TensorProductProperty ------------------------------------------------------------------------ initializing NRLIB TENSORP for TensorProductProperty compiling into NRLIB TENSORP
;;; *** |TensorProductProperty| REDEFINED Time: 0.02 SEC.
finalizing NRLIB TENSORP Processing TensorProductProperty for Browser database: --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSPRP.spad-->TensorProductProperty((eval (S MxN (Mapping S M N)))): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSPRP.spad-->TensorProductProperty(constructor): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSPRP.spad-->TensorProductProperty(): Missing Description ; compiling file "/var/zope2/var/LatexWiki/TENSORP.NRLIB/TENSORP.lsp" (written 25 MAR 2011 06:19:32 AM):
; /var/zope2/var/LatexWiki/TENSORP.NRLIB/TENSORP.fasl written ; compilation finished in 0:00:00.019 ------------------------------------------------------------------------ TensorProductProperty is now explicitly exposed in frame initial TensorProductProperty will be automatically loaded when needed from /var/zope2/var/LatexWiki/TENSORP.NRLIB/TENSORP
TENSORD abbreviates package TensorProduct ------------------------------------------------------------------------ initializing NRLIB TENSORD for TensorProduct compiling into NRLIB TENSORD importing Rep importing Record(k: B1,c: R) importing Record(k: B2,c: R) importing Record(k: Product(B1,B2),c: R) importing Product(B1,B2) compiling exported product : (M1,M2) -> $ Time: 0.19 SEC.
****** Domain: M1 already in scope augmenting M1: (Algebra R) ****** Domain: M2 already in scope augmenting M2: (Algebra R) compiling exported * : ($,$) -> $ Time: 0.05 SEC.
****** Domain: M1 already in scope augmenting M1: (Algebra R) ****** Domain: M2 already in scope augmenting M2: (Algebra R) ****** Domain: R already in scope augmenting R: (Comparable) ****** Domain: R already in scope augmenting R: (Field) (time taken in buildFunctor: 30)
;;; *** |TensorProduct| REDEFINED
;;; *** |TensorProduct| REDEFINED Time: 0.15 SEC.
Warnings: [1] not known that (OrderedSet) is of mode (CATEGORY domain (IF (has B1 (Finite)) (IF (has B2 (Finite)) (ATTRIBUTE (Finite)) noBranch) noBranch) (IF (has B1 (Monoid)) (IF (has B2 (Monoid)) (ATTRIBUTE (Monoid)) noBranch) noBranch) (IF (has B1 (AbelianMonoid)) (IF (has B2 (AbelianMonoid)) (ATTRIBUTE (AbelianMonoid)) noBranch) noBranch) (IF (has B1 (CancellationAbelianMonoid)) (IF (has B2 (CancellationAbelianMonoid)) (ATTRIBUTE (CancellationAbelianMonoid)) noBranch) noBranch) (IF (has B1 (Group)) (IF (has B2 (Group)) (ATTRIBUTE (Group)) noBranch) noBranch) (IF (has B1 (AbelianGroup)) (IF (has B2 (AbelianGroup)) (ATTRIBUTE (AbelianGroup)) noBranch) noBranch) (IF (has B1 (OrderedAbelianMonoidSup)) (IF (has B2 (OrderedAbelianMonoidSup)) (ATTRIBUTE (OrderedAbelianMonoidSup)) noBranch) noBranch) (IF (has B1 (OrderedSet)) (IF (has B2 (OrderedSet)) (ATTRIBUTE (OrderedSet)) noBranch) noBranch) (SIGNATURE makeprod ($ B1 B2)) (SIGNATURE selectfirst (B1 $)) (SIGNATURE selectsecond (B2 $)))
Cumulative Statistics for Constructor TensorProduct Time: 0.39 seconds
--------------non extending category---------------------- .. TensorProduct(#1,#2,#3,#4,#5) of cat (|Join| (|TensorProductCategory| |#1| |#4| |#5|) (|FreeModuleCategory| |#1| (|Product| |#2| |#3|)) (CATEGORY |package| (IF (|has| |#4| (|Algebra| |#1|)) (IF (|has| |#5| (|Algebra| |#1|)) (ATTRIBUTE (|Algebra| |#1|)) |noBranch|) |noBranch|))) has no (IF (|has| |#1| (|CommutativeRing|)) (ATTRIBUTE (|Module| |#1|)) |noBranch|) finalizing NRLIB TENSORD Processing TensorProduct for Browser database: --->/usr/local/lib/fricas/target/x86_64-unknown-linux/../../src/algebra/TENSOR.spad-->TensorProduct(): Missing Description ; compiling file "/var/zope2/var/LatexWiki/TENSORD.NRLIB/TENSORD.lsp" (written 25 MAR 2011 06:19:33 AM):
; /var/zope2/var/LatexWiki/TENSORD.NRLIB/TENSORD.fasl written ; compilation finished in 0:00:00.146 ------------------------------------------------------------------------ TensorProduct is now explicitly exposed in frame initial TensorProduct will be automatically loaded when needed from /var/zope2/var/LatexWiki/TENSORD.NRLIB/TENSORD
>> System error: The bounding indices 163 and 162 are bad for a sequence of length 162. See also: The ANSI Standard, Glossary entry for "bounding index designator" The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR

axiom
M:=FreeModule(Integer,Symbol)

\label{eq1}\hbox{\axiomType{FreeModule}\ } (\hbox{\axiomType{Integer}\ } , \hbox{\axiomType{Symbol}\ })(1)
Type: Type
axiom
N:=FreeModule(Integer,Symbol)

\label{eq2}\hbox{\axiomType{FreeModule}\ } (\hbox{\axiomType{Integer}\ } , \hbox{\axiomType{Symbol}\ })(2)
Type: Type
axiom
a1:='a1::M

\label{eq3}a 1(3)
Type: FreeModule?(Integer,Symbol)
axiom
a2:='a2::M

\label{eq4}a 2(4)
Type: FreeModule?(Integer,Symbol)
axiom
b1:='b1::N

\label{eq5}b 1(5)
Type: FreeModule?(Integer,Symbol)
axiom
b2:='b2::N

\label{eq6}b 2(6)
Type: FreeModule?(Integer,Symbol)
axiom
MxN:=TensorProduct(Integer,Symbol,Symbol,M,N);
Type: Type
axiom
t:=product(a1+a2,b1+b2)$MxN;
Type: TensorProduct?(Integer,Symbol,Symbol,FreeModule?(Integer,Symbol),FreeModule?(Integer,Symbol))
axiom
t

\label{eq7}{\left(a 2, \: b 2 \right)}+{\left(a 2, \: b 1 \right)}+{\left(a 1, \: b 2 \right)}+{\left(a 1, \: b 1 \right)}(7)
Type: TensorProduct?(Integer,Symbol,Symbol,FreeModule?(Integer,Symbol),FreeModule?(Integer,Symbol))
axiom
leadingMonomial t

\label{eq8}\left(a 2, \: b 2 \right)(8)
Type: Product(Symbol,Symbol)
axiom
numberOfMonomials t

\label{eq9}4(9)
Type: PositiveInteger?

Demonstrating the axioms of the tensor product:

axiom
x:M
Type: Void
axiom
y:M
Type: Void
axiom
u:M
Type: Void
axiom
p:=2*x+3*u

\label{eq10}{2 \  x}+{3 \  u}(10)
Type: FreeModule?(Integer,Symbol)
axiom
q:=5*x+7*y+11*u

\label{eq11}{7 \  y}+{5 \  x}+{{11}\  u}(11)
Type: FreeModule?(Integer,Symbol)
axiom
MxM:=TensorProduct(Integer,Symbol,Symbol,M,M);
Type: Type
axiom
r:=product(p,q)$MxM

\label{eq12}\begin{array}{@{}l}
\displaystyle
{{14}\ {\left(x , \: y \right)}}+{{10}\ {\left(x , \: x \right)}}+{{22}\ {\left(x , \: u \right)}}+{{21}\ {\left(u , \: y \right)}}+{{15}\ {\left(u , \: x \right)}}+ 
\
\
\displaystyle
{{33}\ {\left(u , \: u \right)}}
(12)
Type: TensorProduct?(Integer,Symbol,Symbol,FreeModule?(Integer,Symbol),FreeModule?(Integer,Symbol))
axiom
w:= 13*y+17*y+19*u

\label{eq13}{{30}\  y}+{{19}\  u}(13)
Type: FreeModule?(Integer,Symbol)
axiom
test( product(p+q,w)$MxM = product(p,w)$MxM + product(q,w)$MxM )

\label{eq14} \mbox{\rm true} (14)
Type: Boolean
axiom
test( product(p,q+w)$MxM = product(p,q)$MxM + product(p,w)$MxM )

\label{eq15} \mbox{\rm true} (15)
Type: Boolean
axiom
test( product(p,23*w)$MxM = 23*product(p,w)$MxM )

\label{eq16} \mbox{\rm true} (16)
Type: Boolean
axiom
test( product(23*p,w)$MxM = 23*product(p,w)$MxM )

\label{eq17} \mbox{\rm true} (17)
Type: Boolean

first example of a bialgebra --Bill Page, Wed, 13 May 2009 08:06:57 -0700 reply
SandBoxHopfAlgebra?

TensorProduct? --Bill Page, Mon, 02 Nov 2009 07:23:07 -0800 reply
TensorProduct? is now included with FriCAS?. Thank you Franz!