|
fricas -- FreeMonoid(S: SetCategory)
- S can be almost anything
X:=FreeMonoid(Symbol)
Type: Type
fricas e:=[e[i]::X for i in 1..5]
fricas -- Some terms
t1:= e.1*e.2
fricas t2:= t1^3
fricas -- Equality
eq1:=t1=e.2*e.1
fricas test(eq1)
Type: Boolean
fricas eq2:=t2=t1*t1*t1
fricas test(eq2)
Type: Boolean
fricas -- Any symbol admissible ;)
s::X
fricas s*t1
fricas a*%
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
fricas length t2
fricas size t2
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]
fricas t3:=b.1*b.2*b.3*b.1
fricas factors t3
fricas t3*b.1 -- note exps
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]
fricas t4:=bb.1 + t3::Z
fricas t5:=sin(x*y)*t4+z^k*bb.2
|