An n-dimensional algebra is represented by a tensor viewed as an operator with two inputs i,j
and one output k
.
axiom
n:=2
axiom
T:=CartesianTensor(1,n,EXPR INT)
Type: Domain
axiom
Yijk:=unravel(concat concat
[[[script(y,[[i,j],[k]])
for k in 1..n]
for j in 1..n]
for i in 1..n]
)$T
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
reindex(Yijk,[3,1,2])
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
Yijk[1,1,2]
Type: Expression(Integer)
axiom
Yijk[1,2,1]
Type: Expression(Integer)
axiom
Yijk[2,1,1]
Type: Expression(Integer)
Given two vectors U
and V
axiom
Ui:=unravel([script(u,[[],[i]]) for i in
1..n])$T
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
Vj:=unravel([script(v,[[],[i]]) for i in
1..n])$T
Type: CartesianTensor
?(1,
2,
Expression(Integer))
the tensor Y
operates on their tensor product to yield a vector W
axiom
UVij:=product(Ui,Vj)
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
UVij[1,2]
Type: Expression(Integer)
axiom
UVij[2,1]
Type: Expression(Integer)
axiom
YUV:=product(Yijk,UVij)
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
YUV[1,1,1,1,2]
Type: Expression(Integer)
axiom
YUV[1,1,1,2,1]
Type: Expression(Integer)
axiom
YUV[1,1,2,1,1]
Type: Expression(Integer)
axiom
YUV[1,2,1,1,1]
Type: Expression(Integer)
axiom
YUV[2,1,1,1,1]
Type: Expression(Integer)
axiom
contract(contract(YUV,1,4),1,3)
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
contract(contract(Yijk,1,UVij,1),1,3)
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
Wk:=(reindex(Yijk,[3,2,1])*Ui)*Vj
Type: CartesianTensor
?(1,
2,
Expression(Integer))
Take 2
An n-dimensional algebra is represented by a tensor viewed as an operator with two inputs i,j
and one output k
.
axiom
Ykji:=unravel(concat concat
[[[script(y,[[k],[j,i]])
for i in 1..n]
for j in 1..n]
for k in 1..n]
)$T
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
Ui:=unravel([script(u,[[i]]) for i in 1..n])$T
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
Vj:=unravel([script(v,[[i]]) for i in 1..n])$T
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
contract(contract(Ykji,3,product(Ui,Vj),1),2,3)
Type: CartesianTensor
?(1,
2,
Expression(Integer))
axiom
Wk:=(Ykji*Ui)*Vj
Type: CartesianTensor
?(1,
2,
Expression(Integer))