On Tue, May 09, 2023 at 09:32:10AM -0700, Sid Andal wrote:
>
> Problem defining the tensor product of two algebras A2 and A3
> as defined below:
>
> FN := PrimeField 11
>
> S2 ==> SQMATRIX(2, FN)
>
> M : S2 := [[10, 7], [3, 8]]
> N : S2 := [[9, 2], [5, 1]]
>
> A2 := ALGSC(FN, 2, ['E1, 'E2], [M, N])
>
<snip>
> using TensorProduct(R, B1, B2, M1, M2)
>
> with FN for R and A2 and A3 for M1 and M2, resp., but
> having trouble defining B1 and B2 in terms of V2 and V3.
Currently TensorProduct requires that M1 has FreeModuleCategory(R, B1)
and similarly for M2. But AlgebraGivenByStructuralConstants does
not have FreeModuleCategory. So one needs to modify
AlgebraGivenByStructuralConstants to add FreeModuleCategory
and implement needed functions. See attached (only lightly tested)
patch for how one can do this.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/20230509211219.duh7dddbj2mafnim%40fricas.math.uni.wroc.pl.
--- ../fr-build88/src/algebra/ALGSC.spad 2023-05-07 20:14:25.950120519 +0000
+++ ALGSC.spad 2023-05-09 19:17:05.034121551 +0000
@@ -25,10 +25,11 @@
M ==> Matrix
I ==> Integer
NNI ==> NonNegativeInteger
+ OV ==> OrderedVariableList(ls)
--public ==> FramedNonAssociativeAlgebra(R) with
- public ==> Join(FramedNonAssociativeAlgebra(R), _
- LeftModule(SquareMatrix(n, R)) ) with
+ public ==> Join(FramedNonAssociativeAlgebra(R), FreeModuleCategory(R, OV),
+ LeftModule(SquareMatrix(n, R)) ) with
coerce : Vector R -> %
++ coerce(v) converts a vector to a member of the algebra
@@ -46,6 +47,80 @@
dp : DirectProduct(n, R)
v : V R
+ Term ==> Record(k : OV, c : R)
+
+ -- Operation from FreeModuleCategory
+
+ listOfTerms(x : %) : List(Term) ==
+ res := []$List(Term)
+ for i in 1..n repeat
+ c := x(i)
+ if (c ~= 0) then
+ res := cons([index(qcoerce(i)@PositiveInteger), c]$Term, res)
+ res
+
+ numberOfMonomials(x : %) : NNI ==
+ res := 0$NNI
+ for i in 1..n repeat
+ c := x(i)
+ if (c ~= 0) then
+ res := res + 1
+ res
+
+ monomial?(X : %) : Boolean == numberOfMonomials(x) = 1
+
+ leadingTerm(x : %) : Term ==
+ for i in 1..n repeat
+ c := x(i)
+ if (c ~= 0) then
+ return [index(qcoerce(i)@PositiveInteger), c]$Term
+ error "can not take leadingTerm of zero element"
+
+ linearExtend(f : (OV -> R), x : %) : R ==
+ res := 0$R
+ for i in 1..n repeat
+ c := x(i)
+ if (c ~= 0) then
+ res := res + c*f(index(qcoerce(i)@PositiveInteger))
+ res
+
+ reductum(x : %) : % ==
+ v : Vector R := new(n, 0)
+ first := true
+ for i in 1..n repeat
+ c := x(i)
+ if (c ~= 0) then
+ if first then
+ first := false
+ else
+ v(i) := x(i)
+ directProduct(v)
+
+ construct(l : List(Term)) : % ==
+ v : Vector R := new(n, 0)
+ for el in l repeat
+ i := lookup(el.k)
+ v(i) := el.c
+ directProduct(v)
+
+ coefficient(x : %, v : OV) : R == x(lookup(v))
+
+ linearExtend(f : (OV -> R), x : %) : R ==
+ res := 0$R
+ for i in 1..n repeat
+ c := x(i)
+ if (c ~= 0) then
+ res := res + c*f(index(qcoerce(i)@PositiveInteger))
+ res
+
+ constructOrdered(l : List(Term)) : % == construct(l)
+
+ monomial(c : R, s : OV) : % ==
+ v : Vector R := new(n, 0)
+ v(lookup(s)) := c
+ directProduct(v)
+
+ -------------------
recip(x) == recip(x)$FiniteRankNonAssociativeAlgebra_&(%, R)