|
1
2
3
4
5
6
7
8
9
|
|
Editor: test1
Time: 2013/04/25 20:25:03 GMT+0
|
Note:
|
changed:
-FreeModule is defined in poly.spad.
-FreeModuleCategory is defined in xpoly.spad.
-
-\begin{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
-\end{spad}
TensorProduct is now included with FriCAS. Thank you Franz!
changed:
-t:=product(a1+a2,b1+b2)$MxN;
t := tensor(a1 + a2, b1 + b2)$MxN;
changed:
-r:=product(p,q)$MxM
r := tensor(p, q)$MxM
changed:
-test( product(p+q,w)$MxM = product(p,w)$MxM + product(q,w)$MxM )
-test( product(p,q+w)$MxM = product(p,q)$MxM + product(p,w)$MxM )
-test( product(p,23*w)$MxM = 23*product(p,w)$MxM )
-test( product(23*p,w)$MxM = 23*product(p,w)$MxM )
test( tensor(p + q, w)$MxM = tensor(p, w)$MxM + tensor(q, w)$MxM )
test( tensor(p, q + w)$MxM = tensor(p, q)$MxM + tensor(p, w)$MxM )
test( tensor(p, 23*w)$MxM = 23*tensor(p, w)$MxM )
test( tensor(23*p, w)$MxM = 23*tensor(p, w)$MxM )
removed:
-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>
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.
TensorProduct? is now included with FriCAS. Thank you Franz!
fricas
M:=FreeModule(Integer,Symbol)
Type: Type
fricas
N:=FreeModule(Integer,Symbol)
Type: Type
fricas
a1:='a1::M
fricas
a2:='a2::M
fricas
b1:='b1::N
fricas
b2:='b2::N
fricas
MxN:=TensorProduct(Integer,Symbol,Symbol,M,N);
Type: Type
fricas
t := tensor(a1 + a2, b1 + b2)$MxN;
fricas
t
fricas
leadingMonomial t
fricas
numberOfMonomials t
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
fricas
q:=5*x+7*y+11*u
fricas
MxM:=TensorProduct(Integer,Symbol,Symbol,M,M);
Type: Type
fricas
r := tensor(p, q)$MxM
fricas
w:= 13*y+17*y+19*u
fricas
test( tensor(p + q, w)$MxM = tensor(p, w)$MxM + tensor(q, w)$MxM )
Type: Boolean
fricas
test( tensor(p, q + w)$MxM = tensor(p, q)$MxM + tensor(p, w)$MxM )
Type: Boolean
fricas
test( tensor(p, 23*w)$MxM = 23*tensor(p, w)$MxM )
Type: Boolean
fricas
test( tensor(23*p, w)$MxM = 23*tensor(p, w)$MxM )
Type: Boolean
SandBoxHopfAlgebra
TensorProduct? is now included with FriCAS. Thank you Franz!