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.

fricas
(1) -> <spad>
fricas
)abbrev category TENSORC TensorProductCategory
TensorProductCategory(R:CommutativeRing, M : Module(R), N : Module(R)):Category == Module(R) with
    product: (M, N) -> %
fricas
)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
fricas
)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>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/6037869360649691585-25px001.spad
      using system compiler.
   TENSORC abbreviates category TensorProductCategory 
------------------------------------------------------------------------
   initializing NRLIB TENSORC for TensorProductCategory 
   compiling into NRLIB TENSORC 
;;; *** |TensorProductCategory| REDEFINED Time: 0 SEC.
finalizing NRLIB TENSORC Processing TensorProductCategory for Browser database: --->/usr/local/lib/fricas/target/x86_64-linux-gnu/../../src/algebra/TENSCAT.spad-->TensorProductCategory(constructor): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-linux-gnu/../../src/algebra/TENSCAT.spad-->TensorProductCategory((product (% M N))): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-linux-gnu/../../src/algebra/TENSCAT.spad-->TensorProductCategory: Missing Description ; compiling file "/var/aw/var/LatexWiki/TENSORC.NRLIB/TENSORC.lsp" (written 20 OCT 2026 05:04:48 PM):
; wrote /var/aw/var/LatexWiki/TENSORC.NRLIB/TENSORC.fasl ; compilation finished in 0:00:00.008 ------------------------------------------------------------------------ TensorProductCategory is now explicitly exposed in frame initial TensorProductCategory will be automatically loaded when needed from /var/aw/var/LatexWiki/TENSORC.NRLIB/TENSORC
TENSORP abbreviates category TensorProductProperty ------------------------------------------------------------------------ initializing NRLIB TENSORP for TensorProductProperty compiling into NRLIB TENSORP
;;; *** |TensorProductProperty| REDEFINED Time: 0 SEC.
finalizing NRLIB TENSORP Processing TensorProductProperty for Browser database: --->/usr/local/lib/fricas/target/x86_64-linux-gnu/../../src/algebra/TENSPRP.spad-->TensorProductProperty(constructor): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-linux-gnu/../../src/algebra/TENSPRP.spad-->TensorProductProperty((eval (S MxN (Mapping S M N)))): Not documented!!!! --->/usr/local/lib/fricas/target/x86_64-linux-gnu/../../src/algebra/TENSPRP.spad-->TensorProductProperty: Missing Description ; compiling file "/var/aw/var/LatexWiki/TENSORP.NRLIB/TENSORP.lsp" (written 20 OCT 2026 05:04:48 PM):
; wrote /var/aw/var/LatexWiki/TENSORP.NRLIB/TENSORP.fasl ; compilation finished in 0:00:00.004 ------------------------------------------------------------------------ TensorProductProperty is now explicitly exposed in frame initial TensorProductProperty will be automatically loaded when needed from /var/aw/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) -> % ****** comp fails at level 7 with expression: ****** error in function product
(SEQ (SEQ (|:=| (|:| #1=#:G12 (|Boolean|)) (|zero?| |x1|)) (|exit| 1 (IF #1# (|exit| 2 (|return| 0)) (SEQ (|:=| (|:| #2=#:G13 (|Boolean|)) (|zero?| |x2|)) (|exit| 1 (IF #2# (|exit| 3 (|return| 0)) |noBranch|)))))) (|:=| (|:| |ltx1| (|List| (|Record| (|:| |k| B1) (|:| |c| R)))) (|listOfTerms| |x1|)) (|:=| (|:| |ltx2| (|List| (|Record| (|:| |k| B2) (|:| |c| R)))) (|listOfTerms| |x2|)) (|:=| (|:| |res| (|List| (|Record| (|:| |k| (|Product| B1 B2)) (|:| |c| R)))) (|construct|)) (REPEAT (IN |s1| |ltx1|) (REPEAT (IN |s2| |ltx2|) (|:=| |res| (|concat!| |res| ((|Sel| (|Record| (|:| |k| (|Product| B1 B2)) (|:| |c| R)) |construct|) | << | (|makeprod| (|s1| |k|) (|s2| |k|)) | >> | (* (|s1| |c|) (|s2| |c|))))))) (|exit| 1 (|pretend| |res| %))) ****** level 7 ****** x:= (makeprod (s1 k) (s2 k)) m:= $EmptyMode f:= ((((|s2| # #) (|s1| # #) (|res| # #) (|ltx2| # #) ...)))
>> Apparent user error: Cannot coerce res of mode (List (Record (: k (Product B1 B2)) (: c R))) to mode (List (Record (: k B2) (: c R)))

fricas
M:=FreeModule(Integer,Symbol)

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

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

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

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

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

\label{eq6}b 2(6)
Type: FreeModule?(Integer,Symbol)
fricas
MxN:=TensorProduct(Integer,Symbol,Symbol,M,N);
Type: Type
fricas
t:=product(a1+a2,b1+b2)$MxN;
The function product is not implemented in TensorProduct(Integer, Symbol,Symbol,FreeModule(Integer,Symbol),FreeModule(Integer, Symbol))

Demonstrating the axioms of the tensor product:

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

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

\label{eq8}{7 \  y}+{5 \  x}+{{11}\  u}(8)
Type: FreeModule?(Integer,Symbol)
fricas
MxM:=TensorProduct(Integer,Symbol,Symbol,M,M);
Type: Type
fricas
r:=product(p,q)$MxM
The function product is not implemented in TensorProduct(Integer, Symbol,Symbol,FreeModule(Integer,Symbol),FreeModule(Integer, Symbol))

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!