|
fricas (1) -> <spad>
fricas )abbrev domain TENSALG TensorAlgebra
TensorAlgebra(M,R,B) : Exports == Implementation where
M:FreeModuleCategory(R, B)
R:CommutativeRing
B:OrderedSet
OF ==> OutputForm
NNI ==> NonNegativeInteger
FMB ==> FreeMonoid B
CTOF ==> CoercibleTo OutputForm
FMCRB ==> FreeModuleCategory(R,FMB)
GRALR ==> GradedAlgebra(R,NNI)
XFABR ==> XFreeAlgebra(B,R)
XDPBR ==> XDistributedPolynomial(B,R)
TERM ==> Record(k:FMB,c:R)
Exports == Join(FMCRB, XFABR, GRALR) with
coerce : B -> %
convert : FMB -> OutputForm
Implementation == XDPBR add
Rep := XDPBR
product(x,y) == x*y -- GradedAlgebra, pro forma
convert(x:FMB):OutputForm ==
x=1$FMB => empty()$OF
length(x)$FMB = 1 => x::OF
length(x)$FMB = 2 => tensor(first(x)::OF,rest(x)::OF)$OF
tensor(first(x)::OF, convert(rest x))
coerce(x:%):OutputForm ==
zero? x => empty()$OF
x=1$% => outputForm(1)$OF
c:R:=leadingCoefficient(x)
if c=1 then cof:=empty()$OF else cof:=c::OF
kof:OF:=cof * convert(leadingSupport(x))
zero? reductum(x) => kof
kof + reductum(x)::OF</spad>
fricas Compiling FriCAS source code from file
/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/579490114000940455-25px001.spad
using old system compiler.
TENSALG abbreviates domain TensorAlgebra
------------------------------------------------------------------------
initializing NRLIB TENSALG for TensorAlgebra
compiling into NRLIB TENSALG
compiling exported product : (%,%) -> %
Time: 0.02 SEC.
compiling exported convert : FreeMonoid B -> OutputForm
Time: 0 SEC.
compiling exported coerce : % -> OutputForm
Time: 0 SEC.
****** Domain: R already in scope
augmenting R: (Comparable)
(time taken in buildFunctor: 2378)
;;; *** |TensorAlgebra| REDEFINED
;;; *** |TensorAlgebra| REDEFINED
Time: 0 SEC.
Cumulative Statistics for Constructor TensorAlgebra
Time: 0.03 seconds
--------------non extending category----------------------
.. TensorAlgebra(#1,#2,#3) of cat
(|Join| (|FreeModuleCategory| |#2| (|FreeMonoid| |#3|))
(|XFreeAlgebra| |#3| |#2|)
(|GradedAlgebra| |#2| (|NonNegativeInteger|))
(CATEGORY |domain| (SIGNATURE |coerce| (% |#3|))
(SIGNATURE |convert| ((|OutputForm|) (|FreeMonoid| |#3|))))) has no
(|XPolynomialsCat| |#3| |#2|) finalizing NRLIB TENSALG
Processing TensorAlgebra for Browser database:
--->-->TensorAlgebra(constructor): Not documented!!!!
--->-->TensorAlgebra((coerce (% B))): Not documented!!!!
--->-->TensorAlgebra((convert ((OutputForm) (FreeMonoid B)))): Not documented!!!!
--->-->TensorAlgebra(): Missing Description
; compiling file "/var/aw/var/LatexWiki/TENSALG.NRLIB/TENSALG.lsp" (written 07 DEC 2024 06:18:53 AM):
; wrote /var/aw/var/LatexWiki/TENSALG.NRLIB/TENSALG.fasl
; compilation finished in 0:00:00.024
------------------------------------------------------------------------
TensorAlgebra is now explicitly exposed in frame initial
TensorAlgebra will be automatically loaded when needed from
/var/aw/var/LatexWiki/TENSALG.NRLIB/TENSALG
fricas B:=OrderedVariableList [e[i] for i in 1..5]
Type: Type
fricas e:=enumerate()$B
fricas R:=Expression Integer
Type: Type
fricas R has CommutativeRing
Type: Boolean
fricas M:=FreeModule(R, B)
Type: Type
fricas -- This is the object of interest
TA:=TensorAlgebra(M,R,B)
Type: Type
fricas -- coerce basis to TA
b:=[a::TA for a in e]
Type: List(TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])))
fricas v1:=x*b.1+y*b.2-z*b.3
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas v2:=y^n*b.1-cos(x)*b.2
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas v3:=sin(x+y+z)*b.3
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas t0:=exp(-x-y-z)*1$TA
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas t1:=b.1*b.2*b.3*b.4+v1
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas t2:=v1*v2+v1*v3*b.5+t0*b.4*b.3
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas -- product(x,y) same as x*y
p1:=product(v1,v2)
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas p2:=product(product(v1,v3),t1)
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas p3:=tan(x)*1$TA
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas s1:=p1+p2+p3
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas ---
degree(v1*v2*v3*t1)
fricas listOfTerms (v1*v1*v2*v3)
fricas degree (1$TA)
Type: NonNegativeInteger ?
fricas v1+1$TA
Type: TensorAlgebra ?( FreeModule(Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]])), Expression(Integer), OrderedVariableList([e[1], e[2], e[3], e[4], e[5]]))
fricas listOfTerms %
fricas -- degree (0$TA) ---> err in XDP ??
-- projection to TensorPower(n...) easy : filter degree = n
fricas )show TENSALG
TensorAlgebra(M: FreeModuleCategory(R,B),R: CommutativeRing,B: OrderedSet) is a domain constructor
Abbreviation for TensorAlgebra is TENSALG
This constructor is exposed in this frame.
------------------------------- Operations --------------------------------
?*? : (%, %) -> % ?*? : (Integer, %) -> %
?*? : (B, %) -> % ?*? : (%, R) -> %
?*? : (R, %) -> % ?*? : (PositiveInteger, %) -> %
?+? : (%, %) -> % ?-? : (%, %) -> %
-? : % -> % ?=? : (%, %) -> Boolean
1 : () -> % 0 : () -> %
?^? : (%, PositiveInteger) -> % annihilate? : (%, %) -> Boolean
antiCommutator : (%, %) -> % associator : (%, %, %) -> %
coef : (%, FreeMonoid(B)) -> R coef : (%, %) -> R
coefficients : % -> List(R) coerce : Integer -> %
coerce : R -> % coerce : FreeMonoid(B) -> %
coerce : B -> % coerce : % -> OutputForm
commutator : (%, %) -> % constant : % -> R
constant? : % -> Boolean degree : % -> NonNegativeInteger
latex : % -> String lquo : (%, B) -> %
lquo : (%, FreeMonoid(B)) -> % lquo : (%, %) -> %
map : ((R -> R), %) -> % mindeg : % -> FreeMonoid(B)
mirror : % -> % monomial? : % -> Boolean
monomials : % -> List(%) one? : % -> Boolean
opposite? : (%, %) -> Boolean product : (%, %) -> %
quasiRegular : % -> % quasiRegular? : % -> Boolean
recip : % -> Union(%,"failed") retract : % -> R
retract : % -> FreeMonoid(B) rquo : (%, B) -> %
rquo : (%, FreeMonoid(B)) -> % rquo : (%, %) -> %
sample : () -> % varList : % -> List(B)
zero? : % -> Boolean ?~=? : (%, %) -> Boolean
?*? : (NonNegativeInteger, %) -> %
?^? : (%, NonNegativeInteger) -> %
characteristic : () -> NonNegativeInteger
coefficient : (%, FreeMonoid(B)) -> R
construct : List(Record(k: FreeMonoid(B),c: R)) -> %
constructOrdered : List(Record(k: FreeMonoid(B),c: R)) -> % if FreeMonoid(B) has COMPAR
convert : FreeMonoid(B) -> OutputForm
leadingCoefficient : % -> R if FreeMonoid(B) has COMPAR
leadingMonomial : % -> % if FreeMonoid(B) has COMPAR
leadingSupport : % -> FreeMonoid(B) if FreeMonoid(B) has COMPAR
leadingTerm : % -> Record(k: FreeMonoid(B),c: R) if FreeMonoid(B) has COMPAR
leftPower : (%, PositiveInteger) -> %
leftPower : (%, NonNegativeInteger) -> %
leftRecip : % -> Union(%,"failed")
linearExtend : ((FreeMonoid(B) -> R), %) -> R if R has COMRING
listOfTerms : % -> List(Record(k: FreeMonoid(B),c: R))
mindegTerm : % -> Record(k: FreeMonoid(B),c: R)
monomial : (R, FreeMonoid(B)) -> %
numberOfMonomials : % -> NonNegativeInteger
plenaryPower : (%, PositiveInteger) -> % if R has COMRING
reductum : % -> % if FreeMonoid(B) has COMPAR
retractIfCan : % -> Union(R,"failed")
retractIfCan : % -> Union(FreeMonoid(B),"failed")
rightPower : (%, PositiveInteger) -> %
rightPower : (%, NonNegativeInteger) -> %
rightRecip : % -> Union(%,"failed")
sh : (%, %) -> % if R has COMRING
sh : (%, NonNegativeInteger) -> % if R has COMRING
smaller? : (%, %) -> Boolean if R has COMPAR and FreeMonoid(B) has COMPAR
subtractIfCan : (%, %) -> Union(%,"failed")
support : % -> List(FreeMonoid(B))
|