MathAction SandboxDemoFreeMonoid/-Module



SandboxDemoFreeMonoid/-Module
last edited 5 years ago by pagani
fricas
(1) ->
FreeMonoid(S: SetCategory) -- S can be almost anything
X:=FreeMonoid(Symbol)
Type: Type
fricas
e:=[e[i]::X for i in 1..5]
Type: List(FreeMonoid(Symbol))
fricas
-- Some terms
t1:= e.1*e.2
Type: FreeMonoid(Symbol)
fricas
t2:= t1^3
Type: FreeMonoid(Symbol)
fricas
-- Equality
eq1:=t1=e.2*e.1
Type: Equation(FreeMonoid(Symbol))
fricas
test(eq1)
Type: Boolean
fricas
eq2:=t2=t1*t1*t1
Type: Equation(FreeMonoid(Symbol))
fricas
test(eq2)
Type: Boolean
fricas
-- Any symbol admissible ;)
s::X
Type: FreeMonoid(Symbol)
fricas
s*t1
Type: FreeMonoid(Symbol)
fricas
a*%
Type: FreeMonoid(Symbol)
fricas
first %
Type: Symbol
fricas
-- Methods
varList t1
Type: List(Symbol)
fricas
varList t2
Type: List(Symbol)
fricas
retractIfCan t1
Type: Union("failed",...)
fricas
retract e.1
Type: Symbol
fricas
length t1
Type: PositiveInteger?
fricas
length t2
Type: PositiveInteger?
fricas
size t2
Type: PositiveInteger?
fricas
factors t2
Type: List(Record(gen: Symbol,exp: NonNegativeInteger?))
fricas
-- etc.
-- Restrict to b_1, b_2, b_3. B:=OrderedVariableList [b[i] for i in 1..3]
Type: Type
fricas
Y:=FreeMonoid(B)
Type: Type
fricas
b:=[x::Y for x in enumerate()$B]
Type: List(FreeMonoid(OrderedVariableList([b[1],b[2],b[3]])))
fricas
t3:=b.1*b.2*b.3*b.1
Type: FreeMonoid(OrderedVariableList([b[1],b[2],b[3]]))
fricas
factors t3
Type: List(Record(gen: OrderedVariableList([b[1],b[2],b[3]]),exp: NonNegativeInteger?))
fricas
t3*b.1 -- note exps
Type: FreeMonoid(OrderedVariableList([b[1],b[2],b[3]]))
fricas
test(b.1*b.2=b.2*b.1)
Type: Boolean
fricas
-- FreeModule(R: Join(SemiRng,AbelianMonoid),S: SetCategory) 
-- combine
R:=Expression Integer
Type: Type
fricas
Z:=FreeModule(R,Y)
Type: Type
fricas
bb:=[x::Z for x in b]
Type: List(FreeModule(Expression(Integer),FreeMonoid(OrderedVariableList([b[1],b[2],b[3]]))))
fricas
t4:=bb.1 + t3::Z
Type: FreeModule(Expression(Integer),FreeMonoid(OrderedVariableList([b[1],b[2],b[3]])))
fricas
t5:=sin(x*y)*t4+z^k*bb.2
Type: FreeModule(Expression(Integer),FreeMonoid(OrderedVariableList([b[1],b[2],b[3]])))



Subject: Be Bold !!
( 15 subscribers )
Please rate this page:

AltStyle によって変換されたページ (->オリジナル) /