Mathematica and Form
Next page is Hilbert series computation.
In VS code, install Python.
https://blog.naver.com/chojjong/221228053941
Install WSL, connect to VS code.
Form
git clone https://github.com/vermaseren/form.git
xdg-open INSTALL
sudo apt-get install gcc
sudo apt install autoconf
(if something wrong, starts from here)
autoreconf -i
./configure
sudo apt-get install libgmp-dev
sudo apt-get install libmpfr-dev
웹기반 데이터 압축 라이브러리 zlib설치 > 강좌 | 클라우드포털 (linux.co.kr)
c++ - How to install GNU MP (GMP) in Codeblocks on Linux mint - Stack Overflow
cd sources
make clean
make
sudo make install
pip install python-form
LiE
tar zxvf conLiE.tar.gz
sudo apt install bison
sudo apt install libreadline-dev
sudo apt install lie
Keyword:
5.8. Computing and decomposing characters
5.8.1. The character polynomial
Combination
PE code (only use form)
This is slow than Mathematica.
We have to inset cutting in E^P, but it is hard.
We can use another method.
In "P = Sum[(2*Nf*Fun(z^n)*t^n+Adj(z^n)*s^n)/n, {n,1,ord}]",
We can decompose "Fun(z^n)" and "Adj(z^n)" to character polynomials.
Then "P=Sum[(2*Nf*(C.P.s)*t^n+(C.P.s)*s^n)/n,{n,1,ord}]",
We have to compute "Exp(P)=Sum[(Sum[(2*Nf*(C.P.s)*t^n+(C.P.s)*s^n)/n,{n,1,ord}])^k/k!,{k,0,ord}]"
We swich this problem to combinatorial problem.
To get coefficient of "s^a*t^b", we select each term from "Sum[(2*Nf*(C.P.s)*t^n+(C.P.s)*s^n)/n,{n,1,ord}]".
Then total number of terms is "(# of "a" partition)*(# of "b" partition)".
This is just origin of Plethystic exponent... nono, different.
However, not using character form is more convenient.
$$Fun(a_i):=2N_f (z^{a_i}+z^{-a_i})$$
$$Adj(b_j):=(z^{2b_j}+1+z^{-2b_j})$$
$$(s^at^b\mbox{ coeff})=\sum_{\{a_i,b_j\}} \frac{1}{\prod n_{a_i}!\prod n_{b_i}!} \prod_{a_i} [Fun(a_i)]^{n_{a_i}}\prod_{b_j} [Adj(b_j)]^{n_{b_j}},$$ $$=\left[\sum_{\{a_i\}} \prod_{a_i} \frac{[Fun(a_i)]^{n_{a_i}}}{n_{a_i}!}\right]\left[\sum_{\{b_j\}} \prod_{b_j} \frac{[Adj(b_i)]^{n_{b_i}}}{n_{b_j}!}\right]$$ where $a_i$ and $b_j$ are partition of $a$ and $b$: $$\sum_{1\le i\le n_a} a_i=a,a_i\le a_{i+1},\ \sum_{1\le j\le n_b} b_j=b,b_j\le b_{j+1}$$ $n_{a_i}$ is defined by number of $a_i$ exists, which satisfies $$\sum_{a_i} n_{a_i}a_i=a,\quad \sum_{b_j} n_{b_j}b_j=b$$
Now we can compute this. $$\left[\sum_{\{a_i\}} \prod_{a_i} \frac{[Fun(a_i)]^{n_{a_i}}}{n_{a_i}!}\right]$$ when $a_i$ is partition of $a$: $$\sum_{1\le i\le n_a} a_i=a,a_i\le a_{i+1}$$ and $n_{a_i}$ is defined by number of $a_i$ exists, which satisfies $$\sum_{a_i} n_{a_i}a_i=a$$
In mathematica code,
Nf := 2;
f[x_, z_] := 2 Nf (z^x + z^(-x))/x;
(*Define the factorial function*)
Clear[factorial];
factorial[n_Integer] := If[n > 0, n factorial[n - 1], 1];
(*Define the main computation function*)
Clear[computeExpression];
computeExpression[a_Integer, z_] :=
Module[{partitions, nai, term, result},
partitions = IntegerPartitions[a];(*Generate all partitions of a*)
result =(*Sum over all partitions*)(nai = Tally[#];
term =
Times @@ (f[First[#], z]^Last[#] & /@ nai)/
Times @@ (factorial[Last[#]] & /@ nai); term) & /@ partitions;
result];
For fundamental and antifundamental, mathematica code is here.
su4caf[z1_, z2_, z3_] := z3 + z2/z3 + z1/z2 + 1/z1;
su4cad[z1_, z2_, z3_] := su4cfu[z1, z2, z3]*su4caf[z1, z2, z3] - 1;
su4h[z1_, z2_, z3_] :=
1/(z1 z2 z3) (1 - z1^2/z2) (1 - z1 z2/z3) (1 - z1 z3) (1 -
z2^2/z1/z3) (1 - z2 z3/z1) (1 - z3^2/z2);
Nf := 4;
fu[n_, z1_, z2_, z3_] := Nf su4cfu[z1^n, z2^n, z3^n]/n;
af[n_, z1_, z2_, z3_] := Nf su4caf[z1^n, z2^n, z3^n]/n;
ad[n_, z1_, z2_, z3_] := su4cad[z1^n, z2^n, z3^n]/n;
(*Define the factorial function*)
Clear[factorial];
factorial[n_Integer] := If[n > 0, n factorial[n - 1], 1];
(*Define the main computation function*)
Clear[computeExpression];
computeExpression[a_Integer, f_, z1_, z2_, z3_] :=
Module[{partitions, nai, term, result},
partitions = IntegerPartitions[a];(*Generate all partitions of a*)
result =(*Sum over all partitions*)(nai = Tally[#];
term =
Times @@ (f[First[#], z1, z2, z3]^Last[#] & /@ nai)/
Times @@ (factorial[Last[#]] & /@ nai); term) & /@ partitions;
result];
Clear[f];
f[n_, m_, u_] :=
Select[Select[
Select[Expand[
Total[computeExpression[n, fu, z1, z2, z3]]*
Total[computeExpression[m, af, z1, z2, z3]]*
Total[computeExpression[u, ad, z1, z2, z3]]*su4h[z1, z2, z3]*
z1 z2 z3], FreeQ[z3]], FreeQ[z2]], FreeQ[z1]];
f[4, 4, 11]
LaunchKernels[];
DistributeDefinitions[computeExpression];
(*Create a parallel table of coefficients*)1 + s^2 +
Total[Flatten[
ParallelTable[
f[n, m, u] t^n T^m s^u, {n, 1, 4}, {m, 1, 4}, {u, 1, 8}], 2]]
CloseKernels[];
Python is to slow.
If we memorize IntegerPartition and polyniomial expand (before Select) for each partition or order, it will be faster. Let's try Python(CUDA), C++, FORM, Scalar.
Combination example