login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Test the different Series defined for Species

fricas
(1) -> )cd ~/combinat/src
The current FriCAS default directory is /var/aw/var/LatexWiki
fricas
)re ../lib/combinat.input
The file ../lib/combinat.input is needed but does not exist.

Composition of Species:

aldor
#includeDir "/var/lib/zope/combinat/include"
#libraryDir "/var/lib/zope/combinat/lib"
#include "combinat"
macro { E == EmptySetSpecies; X == SingletonSpecies; + == Plus; * == Times; } import from ACInteger; kSet(L:ACLabelType, k:Integer): CombinatorialSpecies L == RestrictedSpecies(SetSpecies, k)(L) add; kSubset(L:ACLabelType, k:Integer): CombinatorialSpecies L == (RestrictedSpecies(SetSpecies, k)*SetSpecies)(L) add; TwoSet(L:ACLabelType): CombinatorialSpecies L == kSet(L,2) add; Graph(L: ACLabelType): CombinatorialSpecies L == FunctorialCompose(Subset, SetSpecies*TwoSet)(L) add;
aldor
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/328803476490765780-25px002.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/328803476490765780-25px002.as", line 3: 
#include "combinat"
^
[L3 C1] #1 (Error) Could not open file `combinat'.
The )library system command was not called after compilation.

These are the definitions of Cycle and LinearOrder? see SandBoxSpeciesAldor

aldor
#includeDir "/var/lib/zope/combinat/include"
#libraryDir "/var/lib/zope/combinat/lib"
#assert MacrosCombinat
#assert Axiom
#include "combinat"
macro {
        SPECIES == (L: LabelType) -> CombinatorialSpecies L;
        V == CycleIndexVariable;
        NonNegativeMachineInteger == I;
        T == SparseIndexedPowerProduct(V, NonNegativeMachineInteger);
        P == SparseDistributedPolynomial(Q, V, T);
}
LinearOrder(L: LabelType): with {
CombinatorialSpecies L;
coerce: % -> List L;
} == List L add {
        Rep == List L;
        import from Rep;
coerce(x: %): List L == rep x;
local lists(l: List L): Generator List L == generate {
        empty? l => yield l;
        current := l;
        c := first current;
        for u in lists(rest l) repeat yield cons(c, u);
        assert(not empty? current);
        while not empty?(tmp := rest current) repeat {
                c := first tmp;
                setrest!(current, rest tmp); -- remove c from l
                for u in lists l repeat yield cons(c, u);
                setrest!(current, tmp); -- put c back into l
                current := tmp;
        }
}
structures(s: SetSpecies L): Generator % == generate {
        for l in lists(s :: List L) repeat yield per l;
}
local LinearOrderIsomorphismType: IsomorphismTypeCategory L 
== add {
        isomorphismTypes(s: MultiSet L): Generator % == never;
        (x:%) = (y:%): Boolean == never;
        (tw: TextWriter) << (x: %): TextWriter == never;
}
IsomorphismType: IsomorphismTypeCategory L == LinearOrderIsomorphismType;
generatingSeries: ExponentialGeneratingSeries == {
        (stream(1$Q)$DataStream(Q)) :: ExponentialGeneratingSeries;
}
isomorphismTypeGeneratingSeries: OrdinaryGeneratingSeries == {
        (stream(1$Z)$DataStream(Z)) :: OrdinaryGeneratingSeries;
}
local cisGenerator: Generator P == generate {
        import from I, T, P;
        x1: V := 1::V;
        for n: I in 0.. repeat yield power(x1, n) :: P;
}
cycleIndexSeries: CycleIndexSeries == cisGenerator :: CycleIndexSeries;
import from String;
expression: SpeciesExpression == leaf("LinearOrder");
}
Cycle(L: LabelType): with {
CombinatorialSpecies L;
coerce: % -> List L;
cycle: List L -> %;
} == List L add {
        Rep == List L;
        import from I, Rep;
local cisCycle(ao: I): Generator P == generate {
        macro PrimePowerProduct == SparseIndexedPowerProduct(I, I);
local multiply(k: PrimePowerProduct): I == {
        r: I := 1;
        for ep in k repeat {(e, p) := ep; r := r * p^e}
        r;
}
local eulerPhi(t: SparseIndexedPowerProduct(I, I)): I == {
        phi: I := 1;
        for ep in t repeat {
                (e, p) := ep;
                phi := phi * p^(e-1) * (p-1)
        }
        phi;
}
local cisCoefficient(n: I): P == BugWorkaround(
    PrimePowerProduct has with {
            divisors: % -> Generator %;
            /: (%, %) -> %;
    }
){
        import from Z, V, SmallIntegerTools;
        nn: PrimePowerProduct := factor n;
        p: P := 0;
        for m in divisors nn repeat {
                k: PrimePowerProduct := nn/m;
                q: Q := (eulerPhi(k) :: Z) / (n :: Z);
                xk: V := multiply(k) :: V;
                t: T := power(xk, multiply m);
                p := [q, t]$P + p;
        }
        p;
}
        yield 0$P;
        for n:I in 1.. repeat yield cisCoefficient(n);
}
coerce(x: %): List L == rep x;
cycle(l: List L): % == per l;
structures(s: SetSpecies L): Generator % == generate {
        import from LinearOrder L;
        if not empty? s then {
                l: List L := s :: List L;
                u := first l;
                for t in structures(set rest l)$LinearOrder(L) repeat {
                        yield per cons(u, t :: List L);
                }
        }
}
local CycleIsomorphismType: IsomorphismTypeCategory L 
== add {
        isomorphismTypes(s: MultiSet L): Generator % == never;
        (x:%) = (y:%): Boolean == never;
        (tw: TextWriter) << (x: %): TextWriter == never;
}
IsomorphismType: IsomorphismTypeCategory L == CycleIsomorphismType;
local cycleOrder(): SeriesOrder == 1 :: SeriesOrder;
egsCycle(ao: I): Generator Q == generate {
        import from Z, Q;
        yield 0;
        for n:I in 1.. repeat yield inv(n :: Z);
}
generatingSeries: ExponentialGeneratingSeries == new(egsCycle, cycleOrder);
ogsCycle(ao: I): Generator Z == generate {yield 0$Z; yield 1$Z};
isomorphismTypeGeneratingSeries: OrdinaryGeneratingSeries == {
        new(ogsCycle, cycleOrder);
}
cycleIndexSeries: CycleIndexSeries == new(cisCycle, cycleOrder);
import from String;
expression: SpeciesExpression == leaf("Cycle");
}
Perm(L: ACLabelType): CombinatorialSpecies L == Compose(SetSpecies,Cycle)(L) add;
aldor
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1726705911677297462-25px003.as
      using Aldor compiler and options 
-O -Fasy -Fao -Flsp -lfricas -Mno-ALDOR_W_WillObsolete -DFriCAS -Y $FRICAS/algebra -I $FRICAS/algebra
      Use the system command )set compiler args to change these 
      options.
"/var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/1726705911677297462-25px003.as", line 5: 
#include "combinat"
^
[L5 C1] #1 (Error) Could not open file `combinat'.
The )library system command was not called after compilation.

fricas
Z := ACInteger;
Type: Variable(ACInteger?)
fricas
labels: SetSpecies Z := set [1::Z,2::Z, 3::Z, 4::Z, 5::Z]
There are no library operations named SetSpecies Use HyperDoc Browse or issue )what op SetSpecies to learn if there is any operation containing " SetSpecies " in its name.
Cannot find a definition or applicable library operation named SetSpecies with argument type(s) Variable(ACInteger)
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

Some problems are appearing, calling:

  [structures(labels3)$Graph(Z)]$ACLIST(Graph(Z))

fricas
es: ExponentialGeneratingSeries := generatingSeries()$Perm(Z);
ExponentialGeneratingSeries is not a valid type.

These are the binomial coefficients of 2 and 4, respectively.

fricas
es: ExponentialGeneratingSeries := generatingSeries()$kSubset(Z,2);
ExponentialGeneratingSeries is not a valid type.

???

fricas
os: OrdinaryGeneratingSeries := isomorphismTypeGeneratingSeries()$Graph(Z);
OrdinaryGeneratingSeries is not a valid type.

The identity in S_5 fixes every graph, so the coefficient of x_1^5 must be equal to coefficient(es, 5). This is the background to the equation "es = cs(1,0,0,0...)"

fricas
coefficient(es, 5)
There are 4 exposed and 6 unexposed library operations named coefficient having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op coefficient to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named coefficient with argument type(s) Variable(es) PositiveInteger
Perhaps you should use "@" to indicate the required return type, or "$" to specify which version of the function you need.

Each transposition \tau \in S_5 fixes the same number of graphs, because of symmetry. We want to know how many graphs are fixed by transposition. Therefore we have to multiplicate the coefficient of x_1^3x_2^1 by factorial(n) and divide by the number of transposition in S_5:

fricas
32/3*factorial(5)/(5*4/2)

\label{eq1}128(1)
Type: Fraction(Integer)




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