BeginPackage["newusagemessages`"]
Unprotect@@Names["newusagemessages`*"];
ClearAll@@Names["newusagemessages`*"];

HarmonicSumsFunctionList::usage="Produces a list of all the commands available in the package HarmonicSums.m (including this one).


HarmonicSumsFunctionList[0] generates the list in alphabetic order.
HarmonicSumsFunctionList[] generates a table of contents which organizes the commands according to general subjects.
HarmonicSumsFunctionList[n_Integer] gives the commands associated to a given subject, where n is the number of the subject indicated by HarmonicSumsFunctionList[]."


Z::usage="Z[(Subscript[a, 1]),...,(Subscript[a, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},N] defines the Z-sum of depth n with upper sumation limit N. The (Subscript[a, i]) can be non-zero integers, while the (Subscript[x, i]) can be reals.

Z[(Subscript[a, 1]),...,(Subscript[a, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},N] = (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[\(\(\\ \)\*SubsuperscriptBox[\(x\), \(1\), SubscriptBox[\(i\), \(1\)]]\), \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(1\), SubscriptBox[\(a\), \(1\)]]\(\\ \)\)]\) (∑_((Subscript[i, 2]) = 1)^((Subscript[i, 1]) - 1))\!\(\*FractionBox[\(\(\\ \)\*SubsuperscriptBox[\(x\), \(2\), SubscriptBox[\(i\), \(2\)]]\), \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(2\), SubscriptBox[\(a\), \(2\)]]\(\\ \)\)]\) ... (∑_((Subscript[i, n - 1]) = 1)^((Subscript[i, n - 2]) - 1))\!\(\*FractionBox[\(\(\\ \)\*SubsuperscriptBox[\(x\), \(n - 1\), SubscriptBox[\(i\), \(n - 1\)]]\), \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(n - 1\), SubscriptBox[\(a\), \(n - 1\)]]\(\\ \)\)]\) (∑_((Subscript[i, n]) = 1)^((Subscript[i, n - 1]) - 1))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n\), SubscriptBox[\(i\), \(n\)]], \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(n\), SubscriptBox[\(a\), \(n\)]]\(\\ \)\)]\) .

The Z-sums are similar to the S-sums. The difference is that the upper limits of the inner sums in a Z-sum fall short by one compared to the corresponding S-sum.";

S2::usage="S2[(Subscript[a, 1]),...,(Subscript[a, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},N] defines the S-sum of depth n with upper sumation limit N. The (Subscript[a, i]) can be non-zero integers, while the (Subscript[x, i]) can be reals.

S2[(Subscript[a, 1]),...,(Subscript[a, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},N] = (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(1\), SubscriptBox[\(i\), \(1\)]], \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(1\), SubscriptBox[\(a\), \(1\)]]\(\\ \)\)]\) (∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(2\), SubscriptBox[\(i\), \(2\)]], \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(2\), SubscriptBox[\(a\), \(2\)]]\(\\ \)\)]\) ... (∑_((Subscript[i, n - 1]) = 1)^(Subscript[i, n - 2]))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n - 1\), SubscriptBox[\(i\), \(n - 1\)]], \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(n - 1\), SubscriptBox[\(a\), \(n - 1\)]]\(\\ \)\)]\) (∑_((Subscript[i, n]) = 1)^(Subscript[i, n - 1]))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n\), SubscriptBox[\(i\), \(n\)]], \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(n\), SubscriptBox[\(a\), \(n\)]]\(\\ \)\)]\) .";

CS::usage="CS[{{(Subscript[a, 1]),(Subscript[b, 1]),(Subscript[c, 1])},...,{(Subscript[a, n]),(Subscript[b, n]),(Subscript[c, n])}},{(Subscript[x, 1]),...,(Subscript[x, n])},N] defines the cyclotomic S-sum of depth n with upper sumation limit N.

CS[{{(Subscript[a, 1]),(Subscript[b, 1]),(Subscript[c, 1])},...,{(Subscript[a, n]),(Subscript[b, n]),(Subscript[c, n])}},{(Subscript[x, 1]),...,(Subscript[x, n])},N] = (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(1\), SubscriptBox[\(i\), \(1\)]], \(\(\\ \\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(1\)]\\ \*SubscriptBox[\(i\), \(1\)] + \*SubscriptBox[\(b\), \(1\)])\), SubscriptBox[\(c\), \(1\)]]\(\\ \)\)]\)(∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(2\), SubscriptBox[\(i\), \(2\)]], \(\(\\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(2\)]\\ \*SubscriptBox[\(i\), \(2\)] + \*SubscriptBox[\(b\), \(2\)])\), SubscriptBox[\(c\), \(2\)]]\(\\ \)\)]\) ... (∑_((Subscript[i, n - 1]) = 1)^(Subscript[i, n - 2]))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n - 1\), SubscriptBox[\(i\), \(n - 1\)]], \(\(\\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(n - 1\)]\\ \*SubscriptBox[\(i\), \(n - 1\)] + \*SubscriptBox[\(b\), \(n - 1\)])\), SubscriptBox[\(c\), \(2\)]]\(\\ \\ \)\)]\)(∑_((Subscript[i, n]) = 1)^(Subscript[i, n - 1]))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n\), SubscriptBox[\(i\), \(n\)]], \(\(\\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(n\)]\\ \*SubscriptBox[\(i\), \(n\)] + \*SubscriptBox[\(b\), \(n\)])\), SubscriptBox[\(c\), \(n\)]]\(\\ \\ \)\)]\) .";

CZ::usage="CZ[{{(Subscript[a, 1]),(Subscript[b, 1]),(Subscript[c, 1])},...,{(Subscript[a, n]),(Subscript[b, n]),(Subscript[c, n])}},{(Subscript[x, 1]),...,(Subscript[x, n])},N] defines the cyclotomic Z-sum of depth n with upper sumation limit N.

CZ[{{(Subscript[a, 1]),(Subscript[b, 1]),(Subscript[c, 1])},...,{(Subscript[a, n]),(Subscript[b, n]),(Subscript[c, n])}},{(Subscript[x, 1]),...,(Subscript[x, n])},N] = (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(1\), SubscriptBox[\(i\), \(1\)]], \(\(\\ \\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(1\)]\\ \*SubscriptBox[\(i\), \(1\)] + \*SubscriptBox[\(b\), \(1\)])\), SubscriptBox[\(c\), \(1\)]]\(\\ \)\)]\)(∑_((Subscript[i, 2]) = 1)^((Subscript[i, 1]) - 1))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(2\), SubscriptBox[\(i\), \(2\)]], \(\(\\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(2\)]\\ \*SubscriptBox[\(i\), \(2\)] + \*SubscriptBox[\(b\), \(2\)])\), SubscriptBox[\(c\), \(2\)]]\(\\ \)\)]\) ... (∑_((Subscript[i, n - 1]) = 1)^((Subscript[i, n - 2]) - 1))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n - 1\), SubscriptBox[\(i\), \(n - 1\)]], \(\(\\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(n - 1\)]\\ \*SubscriptBox[\(i\), \(n - 1\)] + \*SubscriptBox[\(b\), \(n - 1\)])\), SubscriptBox[\(c\), \(2\)]]\(\\ \\ \)\)]\)(∑_((Subscript[i, n]) = 1)^((Subscript[i, n - 1]) - 1))\!\(\*FractionBox[SubsuperscriptBox[\(x\), \(n\), SubscriptBox[\(i\), \(n\)]], \(\(\\ \)\*SuperscriptBox[\((\*SubscriptBox[\(a\), \(n\)]\\ \*SubscriptBox[\(i\), \(n\)] + \*SubscriptBox[\(b\), \(n\)])\), SubscriptBox[\(c\), \(n\)]]\(\\ \\ \)\)]\) .

The cyclotomic Z-sums are similar to the cyclotomic S-sums. The difference is that the upper limits of the inner sums in a cyclotomic Z-sum fall short by one compared to the corresponding cyclotomic S-sum.";

ESum::usage="ESum defines Eulersums.";

H::usage="H[(Subscript[m, 1]),...,(Subscript[m, n]),x] defines a harmonic polylogarithm ((Subscript[m, i]) ∈ {-1,0,1}) or a multiple polylogarithm ((Subscript[m, i]) ∈ ℝ), while H[{(Subscript[a, 1]),(Subscript[b, 1])},...,{(Subscript[a, n]),(Subscript[b, n])},x] defines a cylotomic harmonic polylogarithm ((Subscript[a, i]),(Subscript[b, i]) ∈ ℕ).

H[(Subscript[m, 1]),...,(Subscript[m, n]),x] = (∫_0^x)((\[DifferentialD](Subscript[t, 1]))/(Abs[(Subscript[m, 1])] - Sign[(Subscript[m, 1])] (Subscript[t, 1]))) (∫_0^(Subscript[t, 1]))((\[DifferentialD](Subscript[t, 2]))/(Abs[(Subscript[m, 2])] - Sign[(Subscript[m, 2])] (Subscript[t, 2]))) ... (∫_0^(Subscript[t, n - 2]))((\[DifferentialD](Subscript[t, n - 1]))/(Abs[(Subscript[m, n - 1])] - Sign[(Subscript[m, n - 1])] (Subscript[t, n - 1]))) (∫_0^(Subscript[t, n - 1]))((\[DifferentialD](Subscript[t, n]))/(Abs[(Subscript[m, n])] - Sign[(Subscript[m, n])] (Subscript[t, n]))) .

Example:

H[2,3,-4,-1,5,x] = (∫_0^x)((\[DifferentialD](Subscript[t, 1]))/(2 - (Subscript[t, 1]))) (∫_0^(Subscript[t, 1]))((\[DifferentialD](Subscript[t, 2]))/(3 - (Subscript[t, 2]))) (∫_0^(Subscript[t, 2]))((\[DifferentialD](Subscript[t, 3]))/(4 + (Subscript[t, 3]))) (∫_0^(Subscript[t, 3]))((\[DifferentialD](Subscript[t, 4]))/(1 + (Subscript[t, 4]))) (∫_0^(Subscript[t, 4]))((\[DifferentialD](Subscript[t, 5]))/(5 - (Subscript[t, 5]))) .

The cyclotomic harmonic polylogarithms are defined by

H[{(Subscript[a, 1]),(Subscript[b, 1])},...,{(Subscript[a, n]),(Subscript[b, n])},x] = (∫_0^x)\[DifferentialD](Subscript[t, 1])((Subscript[t, 1]^(Subscript[b, 1]))/((Subscript[Φ, (Subscript[a, 1])])[(Subscript[t, 1])])) (∫_0^(Subscript[t, 1]))\[DifferentialD](Subscript[t, 2])((Subscript[t, 2]^(Subscript[b, 2]))/((Subscript[Φ, (Subscript[a, 2])])[(Subscript[t, 2])])) ... (∫_0^(Subscript[t, n - 2]))\[DifferentialD](Subscript[t, n - 1])((Subscript[t, n - 1]^(Subscript[b, n - 1]))/((Subscript[Φ, (Subscript[a, n - 1])])[(Subscript[t, n - 1])])) (∫_0^(Subscript[t, n])) \[DifferentialD](Subscript[t, n])((Subscript[t, n]^(Subscript[b, n]))/((Subscript[Φ, (Subscript[a, n])])[(Subscript[t, n])])),

where (Subscript[Φ, i])[z] is the i-th cyclotomic polynomial in z. Example:

H[{1,2},{3,4},{5,1},x] = (∫_0^x)\[DifferentialD](Subscript[t, 1])((Subscript[t, 1]^2)/((Subscript[t, 1]) - 1)) (∫_0^(Subscript[t, 1]))\[DifferentialD](Subscript[t, 2])((Subscript[t, 2]^4)/(1 + (Subscript[t, 2]) + (Subscript[t, 2]^2))) (∫_0^(Subscript[t, 2]))\[DifferentialD](Subscript[t, 3])((Subscript[t, 3])/(1 + (Subscript[t, 2]) + (Subscript[t, 2]^2) + (Subscript[t, 2]^3) + (Subscript[t, 2]^4))) .

Mixed variations are also possible. For example:

H[{3,2},-1,0,{4,0},x] = (∫_0^x)\[DifferentialD](Subscript[t, 1])((Subscript[t, 1]^2)/(1 + (Subscript[t, 1]) + (Subscript[t, 1]^2))) (∫_0^(Subscript[t, 1]))((\[DifferentialD](Subscript[t, 2]))/(1 + (Subscript[t, 2]))) (∫_0^(Subscript[t, 2]))((\[DifferentialD](Subscript[t, 3]))/(Subscript[t, 3])) (∫_0^(Subscript[t, 3]))((\[DifferentialD](Subscript[t, 4]))/(1 + (Subscript[t, 4]^2))) .

There is also a more general option:

H[{{(Subscript[a, 1, 1]),...(Subscript[a, 1, (Subscript[j, 1])])},{(Subscript[b, 1, 1]),...(Subscript[b, 1, (Subscript[k, 1])])}},...,{{(Subscript[a, n, 1]),...(Subscript[a, n, (Subscript[j, n])])},{(Subscript[b, n, 1]),...(Subscript[b, n, (Subscript[k, n])])}},x] = (∫_0^x)\[DifferentialD](Subscript[t, 1])(((Subscript[b, 1, 1]) + (Subscript[b, 1, 2]) (Subscript[t, 1]^2) +  ...  + (Subscript[b, 1, (Subscript[k, 1])]) (Subscript[t, 1]^(Subscript[k, 1])))/((Subscript[a, 1, 1]) + (Subscript[a, 1, 2]) (Subscript[t, 1]^2) +  ...  + (Subscript[a, 1, (Subscript[j, 1])]) (Subscript[t, 1]^(Subscript[j, 1])))) ... (∫_0^(Subscript[t, n])) \[DifferentialD](Subscript[t, n])(((Subscript[b, n, 1]) + (Subscript[b, n, 2]) (Subscript[t, n]^2) +  ...  + (Subscript[b, n, (Subscript[k, n])]) (Subscript[t, n]^(Subscript[k, n])))/((Subscript[a, n, 1]) + (Subscript[a, n, 2]) (Subscript[t, n]^2) +  ...  + (Subscript[a, n, (Subscript[j, n])]) (Subscript[t, n]^(Subscript[j, n])))) ";

L::usage="L[{(Subscript[m, 1]),...,(Subscript[m, n])},x] defines a harmonic polylogarithm similar to H[(Subscript[m, 1]),...,(Subscript[m, n]),x] (notice that in L the indices are within curly brackets). The difference lies on the sign of the corresponding letters, particularly when (Subscript[m, i]) is positive,

L[{(Subscript[m, 1]),...,(Subscript[m, n])},x] = (∫_0^x)((\[DifferentialD](Subscript[t, 1]))/((Subscript[t, 1]) - (Subscript[m, 1]))) (∫_0^(Subscript[t, 1]))((\[DifferentialD](Subscript[t, 2]))/((Subscript[t, 2]) - (Subscript[m, 2]))) ... (∫_0^(Subscript[t, n - 2]))((\[DifferentialD](Subscript[t, n - 1]))/((Subscript[t, n - 1]) - (Subscript[m, n - 1]))) (∫_0^(Subscript[t, n - 1]))((\[DifferentialD](Subscript[t, n]))/((Subscript[t, n]) - (Subscript[m, n]))) .

Example:

L[{2,3,-4,-1,5},x] = (∫_0^x)((\[DifferentialD](Subscript[t, 1]))/((Subscript[t, 1]) - 2)) (∫_0^(Subscript[t, 1]))((\[DifferentialD](Subscript[t, 2]))/((Subscript[t, 2]) - 3)) (∫_0^(Subscript[t, 2]))((\[DifferentialD](Subscript[t, 3]))/((Subscript[t, 3]) + 4)) (∫_0^(Subscript[t, 3]))((\[DifferentialD](Subscript[t, 4]))/((Subscript[t, 4]) + 1)) (∫_0^(Subscript[t, 4]))((\[DifferentialD](Subscript[t, 5]))/((Subscript[t, 5]) - 5)) .";

LI::usage="LI[m_,x]:=Im[L[m,x]]";

LR::usage="LR[m_,x]:=Re[L[m,x]]";

LG::usage="LG[n] = Log[n] + EulerGamma";

MyLog::usage="MyLog[n] = Log[n]";

ru::usage="ru[j, k] = E^(2*Pi*I*j/k)";

Delta::usage="Is the dirac-delta distribution.";

Diff::usage="Diff[S[a__,n],k]=D[S[a,n],{n,k}]";

Multi::usage="Multi[CS[a__,n],n, k]=CS[a,k*n].";

Con::usage="Con[a] computes the complex conjugation of a.";

Half::usage="Half[S[a__,n],n]=S[a,n/2].";

SP::usage="SP[a,b]=Sign[a]Sign[b](Abs[a]+Abs[b])";

LimitH::usage="LimitH[expr,x->p] calculates the limit of an expr involving H functions as x->p. Examples:

In[1]:= LimitH[(H[-1,x]-H[-1,1/2])/(x-1/2),x->1/2]
Out[1]:= (2/3)

In[1]:= LimitH[(H[-1,-1,x]-H[-1,-1,1])/(1-x),x->1] // ReduceConstants[#,ToKnownConstants->True]&
Out[1]:= -(ln2/2)";

TransformH::usage="Performs serveral transforms on the argument of a harmonic polylogarithm. Examples are: TransformH[H[a__,1-x],x],TransformH[H[a__,x+b],x],TransformH[H[a__,x],1/x],...
For example,

In[1]:= TransformH[H[-1,x/(1+x)],x]
Out[1]:= -H[-1,x]+H[-(1/2),x]

In[2]:= TransformH[H[{3,1},x+3],x]
Out[2]:= H[{3,1},3]+H[{-3,1,3},x]

In[3]:= TransformH[H[{3,1},1/x],x]
Out[3]:= H[{0,0},1]-H[{0,0},x]-H[{3,0},1]+H[{3,0},x]+H[{3,1},x]

The transformations can also go in the opposite direction:

In[4]:= TransformH[H[-1,x],x/(1+x)]
Out[4]:= H[1,(x/(1 + x))]

In[5]:= TransformH[H[-1,x],(1-x)/(1+x)]
Out[5]:= H[-1,1]-H[-1,((1 - x)/(1 + x))]

Here is the full list of all possible argument transformations:

(x/(1 + x)) <-> x , (x/(1 - x)) <-> x , 1-x <-> x , x+b <-> x , bx  <-> x , (1/x) <-> x , ((1 - x)/(1 + x)) <-> x , (x^b) -> x";

TransformHx::usage="TransformHx[H[a__,x],x] transforms H[a__,x] to harmonic polylogarithms of the form H[__,1-x]";

TransformL::usage="Does the same as TransformH, but for L functions instead of H functions.";

TransformGL::usage="Does the same as TransformH, but for GL functions instead of H functions.";

RegularizeHConst::usage="For a constant c, RegularizeHConst[H[a__,c]] tries to express H[a__,c] in terms of harmonic polylogarithms at argument 1. 
Examples:

In[1]:= RegularizeHConst[H[-1,2]]
Out[1]:=H[-(1/2),1]

In[2]:= RegularizeHConst[H[-1,-1,2]+3*H[0,0,-1,3]]
Out[2]:= H[-(1/2),-(1/2),1]+3 H[0,0,-(1/3),1]";

ToCyclotomic::usage="Transforms a harmonic polylogarithm into the form of cyclotomic polylogarithms. Examples:

In[1]:= H[1,-1,0,x] // ToCyclotomic
Out[1]:= -H[{1,0},{2,0},{0,0},x]

In[2]:= H[1,-1,0,{3,1},x] // ToCyclotomic
Out[2]:= -H[{1,0},{2,0},{0,0},{3,1},x]";

LinearHExpand::usage="Expands all products of harmonic polylogarithms and cyclotomic polylogarithms at same argument. The command also works for L[__,_] and GL[__,_]. Examples:

In[1]:= H[-1,x] H[1,x] H[0,x] // LinearHExpand
Out[1]:= H[-1,0,1,x]+H[-1,1,0,x]+H[0,-1,1,x]+H[0,1,-1,x]+H[1,-1,0,x]+H[1,0,-1,x]

In[2]:= GL[{1/(1-VarGL)},x]GL[{1/VarGL},x] // LinearHExpand
Out[2]:= GL[{(1/(1 - VarGL)),(1/VarGL)},x]+GL[{(1/VarGL),(1/(1 - VarGL))},x]";

RemoveLeading1::usage="RemoveLeading1[H[__,x]] extracts leading ones. The result will not contain harmonic polylogarithms with leading 1's, except for H[1,x]. 
Examples:

In[1]:= RemoveLeading1[H[1,1,0,0,x]]
Out[1]:= (1/2) H[1,x]^2 H[0,0,x]-H[1,x] H[0,0,1,x]-H[1,x] H[0,1,0,x]+H[0,0,1,1,x]+H[0,1,0,1,x]+H[0,1,1,0,x]

In[2]:= RemoveLeading1[H[1,1,0,x]+2*H[1,-1,x]]
Out[2]:= (1/2) H[0,x] H[1,x]^2+2 (H[-1,x] H[1,x]-H[-1,1,x])-H[1,x] H[0,1,x]+H[0,1,1,x]";

RemoveTrailing0::usage="RemoveTrailing0[H[___,x]] extracts trailing zeroes. The result will not contain harmonic polylogarithms with trailing zeroes, except for H[0,x].
Examples:

In[1]:= RemoveTrailing0[H[1,0,0,x]]
Out[1]:= (1/2) H[0,x]^2 H[1,x]-H[0,x] H[0,1,x]+H[0,0,1,x]

In[2]:=RemoveTrailing0[H[1,0,0,x]+3*H[-1,0]]
Out[2]:= 3 H[-1,0]+(1/2) H[0,x]^2 H[1,x]-H[0,x] H[0,1,x]+H[0,0,1,x]";

RemoveLeadingIndex::usage="RemoveLeadingIndex[H[a__,x]] removes the leading index of H[a__,x]. 
RemoveLeadingIndex[expr,b] removes the leading index b of all harmonic polylogarithms in expr. 
The command also works for L[__,x] and GL[__,x]. Examples:

In[1]:= RemoveLeadingIndex[H[2,2,3,4,x]]
Out[1]:= H[2,2,x] H[3,4,x]-H[2,x] H[3,2,4,x]-H[2,x] H[3,4,2,x]+H[3,2,2,4,x]+H[3,2,4,2,x]+H[3,4,2,2,x]

In[2]:= RemoveLeadingIndex[H[2,2,3,3,x]+4*H[3,3,2,2,x],2]
Out[2]:= H[2,2,x] H[3,3,x]-H[2,x] H[3,2,3,x]-H[2,x] H[3,3,2,x]+H[3,2,2,3,x]+H[3,2,3,2,x]+5 H[3,3,2,2,x]

In[3]:= RemoveLeadingIndex[H[2,2,3,3,x]+4*H[3,3,2,2,x],3]
Out[3]:= H[2,2,3,3,x]+4 (H[2,2,x] H[3,3,x]-H[3,x] H[2,2,3,x]-H[3,x] H[2,3,2,x]+H[2,2,3,3,x]+H[2,3,2,3,x]+H[2,3,3,2,x])";

RemoveTrailingIndex::usage="RemoveTrailingIndex[H[a__,x]] removes the trailing index of H[a__,x]. 
RemoveTrailingIndex[expr,b] removes the trailing index b of all harmonic polylogarithms in expr. 
The command also works for L[__,x] and GL[__,x]. Examples:

In[1]:= RemoveTrailingIndex[H[2,4,3,3,x]]
Out[1]:= \!(1/2) H[3,x]^2 H[2,4,x]-H[3,x] H[2,3,4,x]-H[3,x] H[3,2,4,x]+H[2,3,3,4,x]+H[3,2,3,4,x]+H[3,3,2,4,x]

In[2]:= RemoveTrailingIndex[H[2,2,3,3,x]+4*H[3,3,2,2,x],2]
Out[2]:= H[2,2,3,3,x]+4 ((1/2) H[2,x]^2 H[3,3,x]-H[2,x] H[2,3,3,x]-H[2,x] H[3,2,3,x]+H[2,2,3,3,x]+H[2,3,2,3,x]+H[3,2,2,3,x])

In[3]:= RemoveTrailingIndex[H[2,2,3,3,x]+4*H[3,3,2,2,x],3]
Out[3]:= (1/2) H[3,x]^2 H[2,2,x]-H[3,x] H[2,3,2,x]-H[3,x] H[3,2,2,x]+H[2,3,3,2,x]+H[3,2,3,2,x]+5 H[3,3,2,2,x]";

GLRemoveTrailing0::usage="GLRemoveTrailing0[GL[_,x]] removes trailing 1/VarGL. The only GL function appearing in the result where 1/VarGL is the rightmost letter will be GL[{1/VarGL},x], GL[{1/VarGL,1/VarGL},x], etc. 
Examples:

In[1]:= GLRemoveTrailing0[ GL[{Sqrt[1-VarGL],1/(1+VarGL),1/VarGL,1/VarGL},x]]
Out[1]:= (1/2) GL[{(1/VarGL)},x]^2 GL[{(Sqrt[1 - VarGL]),(1/(1 + VarGL))},x]-GL[{(1/VarGL)},x] GL[{(Sqrt[1 - VarGL]),(1/VarGL),(1/(1 + VarGL))},x]-GL[{(1/VarGL)},x] GL[{(1/VarGL),(Sqrt[1 - VarGL]),(1/(1 + VarGL))},x]+GL[{(Sqrt[1 - VarGL]),(1/VarGL),(1/VarGL),(1/(1 + VarGL))},x]+GL[{(1/VarGL),(Sqrt[1 - VarGL]),(1/VarGL),(1/(1 + VarGL))},x]+GL[{(1/VarGL),(1/VarGL),(Sqrt[1 - VarGL]),(1/(1 + VarGL))},x]


In[2]:= GLRemoveTrailing0[ GL[{1/Sqrt[1+VarGL],1/VarGL,1/VarGL},x]+2*GL[{VarGL^2/Sqrt[1-VarGL],1/VarGL},x]]
Out[2]:= (1/2) GL[{(1/VarGL)},x]^2 GL[{(1/(Sqrt[1 + VarGL]))},x]+2 (GL[{(1/VarGL)},x] GL[{((VarGL^2)/(Sqrt[1 - VarGL]))},x]-GL[{(1/VarGL),((VarGL^2)/(Sqrt[1 - VarGL]))},x])-GL[{(1/VarGL)},x] GL[{(1/VarGL),(1/(Sqrt[1 + VarGL]))},x]+GL[{(1/VarGL),(1/VarGL),(1/(Sqrt[1 + VarGL]))},x]

See also 'RemoveTrailing0'.";

GLRemoveLeading1::usage="GLRemoveLeading1[GL[_,x]] removes leading 1/(1-VarGL). The only GL functions appearing in the result where 1/(1-VarGL) is the leftmost letter will be GL[{1/(1-VarGL)},x], GL[{1/(1-VarGL),1/(1-VarGL)},x], etc. 
Examples:

In[1]:= GLRemoveLeading1[ GL[{1/(1-VarGL),1/(1-VarGL),Sqrt[1-VarGL],1/(1+VarGL)},x]] 
Out[1]:= GL[{(1/(1 - VarGL)),(1/(1 - VarGL))},x] GL[{(Sqrt[1 - VarGL]),(1/(1 + VarGL))},x]-GL[{(1/(1 - VarGL))},x] GL[{(Sqrt[1 - VarGL]),(1/(1 - VarGL)),(1/(1 + VarGL))},x]-GL[{(1/(1 - VarGL))},x] GL[{(Sqrt[1 - VarGL]),(1/(1 + VarGL)),(1/(1 - VarGL))},x]+GL[{(Sqrt[1 - VarGL]),(1/(1 - VarGL)),(1/(1 - VarGL)),(1/(1 + VarGL))},x]+GL[{(Sqrt[1 - VarGL]),(1/(1 - VarGL)),(1/(1 + VarGL)),(1/(1 - VarGL))},x]+GL[{(Sqrt[1 - VarGL]),(1/(1 + VarGL)),(1/(1 - VarGL)),(1/(1 - VarGL))},x]


In[2]:= GLRemoveLeading1[ GL[{1/(1-VarGL),1/(1-VarGL),1/Sqrt[1+VarGL]},x]+2*GL[{1/(1-VarGL),VarGL^2/Sqrt[1-VarGL]},x]]
Out[2]:= GL[{(1/(Sqrt[1 + VarGL]))},x] GL[{(1/(1 - VarGL)),(1/(1 - VarGL))},x]+2 (GL[{(1/(1 - VarGL))},x] GL[{((VarGL^2)/(Sqrt[1 - VarGL]))},x]-GL[{((VarGL^2)/(Sqrt[1 - VarGL])),(1/(1 - VarGL))},x])-GL[{(1/(1 - VarGL))},x] GL[{(1/(Sqrt[1 + VarGL])),(1/(1 - VarGL))},x]+GL[{(1/(Sqrt[1 + VarGL])),(1/(1 - VarGL)),(1/(1 - VarGL))},x] 

See also 'RemoveLeading1'.";

MoveIndexBack::usage="MoveIndexBack[expr,b] tries to move the index b to the end of all harmonic polylogarithms in expr. The command also works for L[__,x] and GL[__,x].
Examples:

In[1]:= MoveIndexBack[H[2,3,4,5,x]+2*H[1,4,1,x],4]
Out[1]:= 2 H[1,x] H[1,4,x]-4 H[1,1,4,x]+H[5,x] H[2,3,4,x]-H[2,3,5,4,x]-H[2,5,3,4,x]-H[5,2,3,4,x]

In[2]:= MoveIndexBack[GL[{1/(1-VarGL),1/VarGL,1/(1+VarGL)},x],1/VarGL]
Out[2]:= GL[{(1/(1 + VarGL))},x] GL[{(1/(1 - VarGL)),(1/VarGL)},x]-GL[{(1/(1 - VarGL)),(1/(1 + VarGL)),(1/VarGL)},x]-GL[{(1/(1 + VarGL)),(1/(1 - VarGL)),(1/VarGL)},x]";


ForwardIndex::usage="ForwardIndex[expr,b] tries to move the index b to the front of all harmonic polylogarithms in expr. The command also works for L[__,x] and GL[__,x].
Examples:

In[1]:= ForwardIndex[H[1,2,2,3,x]+3*H[1,-1,2,2,x],2]
Out[1]:=(3/2) H[2,x]^2 H[1,-1,x]-3 H[1,x] H[2,-1,2,x]-3 H[1,x] H[2,2,-1,x]+H[1,x] H[2,2,3,x]+3 H[2,-1,1,2,x]+3 H[2,-1,2,1,x]-H[2,1,2,3,x]+3 H[2,2,-1,1,x]-H[2,2,1,3,x]-H[2,2,3,1,x]

In[2]:= ForwardIndex[GL[{1/(1-VarGL),1/VarGL,1/(1+VarGL)},x],1/VarGL]
Out[2]:= GL[{(1/(1 - VarGL))},x] GL[{(1/VarGL),(1/(1 + VarGL))},x]-GL[{(1/VarGL),(1/(1 - VarGL)),(1/(1 + VarGL))},x]-GL[{(1/VarGL),(1/(1 + VarGL)),(1/(1 - VarGL))},x]

";

CycloHToStandardForm::usage="Removes indices of the form {0,a} with a>0. Examples:

In[1]:= CycloHToStandardForm[H[{0,1},x]]
Out[1]:= x

In[2]:= CycloHToStandardForm[H[{0,2},{2,3},{0,1},x]]
Out[2]:= -((x^2)/4)+((x^3)/6)+((x^4)/8)-((x^5)/15)+((x^6)/24)+(1/2) (x-H[{2,0},x])-(1/2) (x^2) (x-H[{2,0},x])

In[3]:= CycloHToStandardForm[H[{0,3},{1,4},x]+2*H[{0,2},{0,1},x]]
Out[3]:= -(x/3)-((x^2)/6)+\!\(\*FractionBox[\(5\\ \*SuperscriptBox[\(x\), \(3\)]\), \(9\)]\)+((x^4)/4)+((x^5)/10)+((x^6)/18)+((x^7)/28)-(1/3) H[{1,0},x]+(1/3) (x^3) H[{1,0},x]";

HInf::usage="HInf[H[a__, x], x] calculates the regularized values of the multiple polylogarithm H[a,x] for x -> ∞. Example:

In[1]:= HInf[H[1,0,x],x]
Out[1]:= -2 z2

We can check that this is the constant term of the expansion at infinity:

In[2]:= HInfSeries[H[1,0,x],x]
Out[2]:= I π H[0,x]+(1/2) H[0,x]^2-H[0,0,1]-2 H[0,1,1]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^2))+H[0,x] (-I π-H[0,x]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1])))

In[3]:= ReduceConstants[-2*H[0,1,1],ToKnownConstants->True]
Out[3]:= -2 z2";

HInfSeries::usage="HInfSeries[H[a__, x], x] calculates the expansion of the multiple polylogarithm H[a,x] for x -> ∞.
Examples:

In[1]:= HInfSeries[H[1,0,x],x]
Out[1]:= I π H[0,x]+(1/2) H[0,x]^2-H[0,0,1]-2 H[0,1,1]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^2))+H[0,x] (-I π-H[0,x]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1])))

In[2]:= HInfSeries[H[1,1,0,x]+2*H[1,0,x],x]
Out[2]:= -(1/2) (π^2) H[0,x]+(1/6) H[0,x]^3+I π ((1/2) H[0,x]^2-H[0,0,1])+H[0,0,0,1]+H[0,0,1,1]+H[0,1,0,1]+2 H[0,1,1,1]+2 ((Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^3)))+H[0,x] ((Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^2)))+I π (-H[0,1,1]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^2)))-(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])\!\(\*FractionBox[\(\*SuperscriptBox[\((\*FractionBox[\(1\), \(x\)])\), SubscriptBox[\(t\), \(1\)]]\\ S[1, \*SubscriptBox[\(t\), \(1\)]]\), SubsuperscriptBox[\(t\), \(1\), \(2\)]]\)-(-I π H[0,x]-(1/2) H[0,x]^2+H[0,0,1]+2 H[0,1,1]-(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^2))) (-I π-H[0,x]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1])))+(1/2) H[0,x] (-I π-H[0,x]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1])))^2+2 (I π H[0,x]+(1/2) H[0,x]^2-H[0,0,1]-2 H[0,1,1]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]^2))+H[0,x] (-I π-H[0,x]+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])(((((1/x)))^(Subscript[t, 1]))/(Subscript[t, 1]))))";

LinearExpand::usage="Expands all the products of harmonic sums, cyclotomic sums and binomial sums at same upper summation limit. Examples:

In[1]:= LinearExpand[S[1,1,-1,N]*S[1,N]+S[2,N]*S[-1,N]]
Out[1]:= -S[-3,N]+S[-1,2,N]+S[2,-1,N]-S[1,1,-2,N]-S[1,2,-1,N]-S[2,1,-1,N]+S[1,1,-1,1,N]+3 S[1,1,1,-1,N]

In[2]:= LinearExpand[CS[{{1,0,1},{2,1,3}},N]*S[1,N]]
Out[2]:= 2 CS[{{1,0,1},{2,1,1}},N]+2 CS[{{1,0,1},{2,1,2}},N]+2 CS[{{1,0,1},{2,1,3}},N]-CS[{{1,0,2},{2,1,3}},N]+2 CS[{{1,0,1},{1,0,1},{2,1,3}},N]+CS[{{1,0,1},{2,1,3},{1,0,1}},N]-S[1,1,N]

In[3]:= LinearExpand[BS[2,{1},{{{1},{2,3}}},N]*S[1,N]]
Out[3]:= -BS[{{1,0,3}},{1},{{{1},{2,3}}},N]+BS[{{1,0,1},{1,0,2}},{1,1},{{{},{}},{{1},{2,3}}},N]+BS[{{1,0,2},{1,0,1}},{1,1},{{{1},{2,3}},{{},{}}},N]";


Synchronize::usage="Synchronizes harmonic sums, S-sums and cyclotomic sums at k*n+p (k,n ∈ ℕ) to cyclotomic sums at n. Examples:

In[1]:= Synchronize[S[1,2*N-1]]
Out[1]:= 1-\!\(\*FractionBox[\(1\), \(2\\ N\)]\)-\!\(\*FractionBox[\(1\), \(1 + 2\\ N\)]\)+CS[{{2,1,1}},N]+(1/2) S[1,N]

In[2]:= Synchronize[S[-1,3*N+1]+2*S[2,2*N]]
Out[2]:= -(1/2)-\!\(\*FractionBox[SuperscriptBox[\((\(-1\))\), \(1 + N\)], \(1 + 3\\ N\)]\)+\!\(\*FractionBox[SuperscriptBox[\((\(-1\))\), \(1 + N\)], \(2 + 3\\ N\)]\)-CS[{{3,1,-1}},N]+CS[{{3,2,-1}},N]-\!\(\*FractionBox[SuperscriptBox[\((\(-1\))\), UnderscriptBox[\(N\), \(.\)]], \(1 + 3\\ N\)]\)+(1/3) S[-1,N]+2 (1-\!\(\*FractionBox[\(1\), SuperscriptBox[\((1 + 2\\ N)\), \(2\)]]\)+CS[{{2,1,2}},N]+(1/4) S[2,N])

In[3]:= Synchronize[CS[{{1,0,1},{2,1,3}},2*N+1]]
Out[3]:= \!\(\*FractionBox[\(27\\ \*SuperscriptBox[\((3 + 4\\ N)\), \(3\)] - 27\\ \*SuperscriptBox[\((1 + 2\\ \((1 + 2\\ N)\))\), \(3\)] + \((1 + 2\\ N)\)\\ \*SuperscriptBox[\((3 + 4\\ N)\), \(3\)]\\ \*SuperscriptBox[\((1 + 2\\ \((1 + 2\\ N)\))\), \(3\)]\), \(27\\ \((1 + 2\\ N)\)\\ \*SuperscriptBox[\((3 + 4\\ N)\), \(3\)]\\ \*SuperscriptBox[\((1 + 2\\ \((1 + 2\\ N)\))\), \(3\)]\)]\)+(1/27) CS[{{2,1,1}},N]+(2/27) CS[{{4,3,1}},N]+(2/9) CS[{{4,3,2}},N]+(2/3) CS[{{4,3,3}},N]+(1/2) CS[{{1,0,1},{4,1,3}},N]+(1/2) CS[{{1,0,1},{4,3,3}},N]+CS[{{2,1,1},{4,1,3}},N]+CS[{{2,1,1},{4,3,3}},N]\!\(\*FractionBox[\(27\\ \*SuperscriptBox[\((3 + 4\\ N)\), \(3\)] - 27\\ \*SuperscriptBox[\((1 + 2\\ \((1 + 2\\ N)\))\), \(3\)] + \((1 + 2\\ N)\)\\ \*SuperscriptBox[\((3 + 4\\ N)\), \(3\)]\\ \*SuperscriptBox[\((1 + 2\\ \((1 + 2\\ N)\))\), \(3\)]\), \(27\\ \((1 + 2\\ N)\)\\ \*SuperscriptBox[\((3 + 4\\ N)\), \(3\)]\\ \*SuperscriptBox[\((1 + 2\\ \((1 + 2\\ N)\))\), \(3\)]\)]\)+(1/27) CS[{{2,1,1}},N]+(2/27) CS[{{4,3,1}},N]+(2/9) CS[{{4,3,2}},N]+(2/3) CS[{{4,3,3}},N]+(1/2) CS[{{1,0,1},{4,1,3}},N]+(1/2) CS[{{1,0,1},{4,3,3}},N]+CS[{{2,1,1},{4,1,3}},N]+CS[{{2,1,1},{4,3,3}},N]";


ZToS::usage="Converts Z-sums to S-sums. Examples:

In[1]:= ZToS[Z[1,1,2,N]]
Out[1]:= S[4,N]-S[1,3,N]-S[2,2,N]+S[1,1,2,N]

In[2]:= ZToS[Z[1,N]+2*Z[-1,1,N]]
Out[2]:= S[1,N]+2 (-S[-2,N]+S[-1,1,N])";

SToZ::usage="Converts S-sums to Z-sums. Examples:

In[1]:= SToZ[S[1,1,2,N]]
Out[1]:= Z[4,N]+Z[1,3,N]+Z[2,2,N]+Z[1,1,2,N]

In[2]:= SToZ[S[1,N]+2*S[-1,1,N]]
Out[2]:= Z[1,N]+2 (Z[-2,N]+Z[-1,1,N])";

CSToS::usage="Converts a cyclotomic sum into a harmonic sum as long as this is possible. Example:

In[1]:= CSToS[CS[{{1,0,1}},x]]
Out[1]:= S[1,x]";

SToCS::usage="Converts S-sums into the form of CS-sums. Example:

In[1]:= SToCS[S[1,1,2,N]]
Out[1]:= CS[{{1,0,1},{1,0,1},{1,0,2}},N]";

CSToRUS::usage="Expresses cyclotomic harmonic sums in terms of harmonic sums with powers of square roots of unity in the numerator of the summands. Example:

In[1]:= CSToRUS[CS[{{3,2,1}},n]]
Out[1]:= -\!\(\*FractionBox[\(3\\ n\), \(2\\ \((2 + 3\\ n)\)\)]\)+(1/3) S[1,3 n]+(1/3) (-1)^(2/3) S[1,{ru[1,3]},3 n]-(1/3) (-1)^(1/3) S[1,{ru[2,3]},3 n]";

CSToCZ::usage="Converts CS-sums to CZ-sums. Example:

In[1]:= CSToCZ[CS[{{3,2,1},{3,2,3}},n]]
Out[1]:= CZ[{{3,2,4}},n]+CZ[{{3,2,1},{3,2,3}},n]";

CZToCS::usage="Converts CZ-sums to CS-sums. Example:

In[1]:= CZToCS[CZ[{{3,2,1},{3,2,3}},n]]
Out[1]:= -CS[{{3,2,4}},n]+CS[{{3,2,1},{3,2,3}},n]";

SToESum::usage="Converts S-sums or CS-sums into the form of ESums.";

ComputeConjugateSum::usage="Given f[n], ComputeConjugateSum[f[n],n] computes -Sum[(-1)^i Binomial[n,i]f[i],{i,1,n}]. Example:

In[1]:= ComputeConjugateSum[1/N^2,N]
Out[1]:= S[1,1,N]";

Shuffle::usage="Calculates the ShuffleProduct of S-sums";

TransformToSSums::usage="Rewrites, if possiple, expressions containing nested sums into expressions in terms of cyclotomic S-sums.
Example:

In[1]:= expr2=\!\(\*FractionBox[\(1\), \(\*SuperscriptBox[\((\(-2\) + n)\), \(2\)]\\ \*SuperscriptBox[\((\(-1\) + n)\), \(2\)]\\ \*SuperscriptBox[\(n\), \(2\)]\\ \*SuperscriptBox[\((1 + n)\), \(3\)]\)]\)((-4+7 n+27 (n^2)-7 (n^3)-3 (n^4)-14 (n^5)+6 (n^6)+2 (n^7)-2 (n^8)) (-1)^(Underscript[n, .])+(-2+n)^2 (-1+n)^2 n (1+n)^2 (1+4 n+2 (n^2)) (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 4), n])((((-1))^(Underscript[(Subscript[ι, 1]), .]))/(((-3 + (Subscript[ι, 1])))^2))+4 (-2+n)^2 (-1+n)^2 (n^2) (1+n)^3 (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 3), n])((((-1))^(Underscript[(Subscript[ι, 1]), .]))/(-2 + (Subscript[ι, 1])))+(-2+n)^2 (-1+n)^2 (n^2) (1+n)^3 (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 2), n])((((-1))^(Underscript[(Subscript[ι, 1]), .]))/(((-1 + (Subscript[ι, 1])))^3))+2 (-2+n)^2 (-1+n)^2 (n^2) (1+n)^3 (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 4), n])(((Underoverscript[(∑^(.)), ((Subscript[ι, 2]) = 4), (Subscript[ι, 1])])((((-1))^(Underscript[(Subscript[ι, 2]), .]))/(((-3 + (Subscript[ι, 2])))^2)))/(-1 + (Subscript[ι, 1]))));

In[2]:= TransformToSSums[expr2]
Out[2]:= -\!\(\*FractionBox[\(2 + 6\\ n + 6\\ \*SuperscriptBox[\(n\), \(2\)] + 2\\ \*SuperscriptBox[\(n\), \(3\)] - \*SuperscriptBox[\((\(-1\))\), UnderscriptBox[\(n\), \(.\)]]\), SuperscriptBox[\((1 + n)\), \(3\)]]\)+S[-3,n]+\!\(\*FractionBox[\(S[\(-2\), n]\), \(n\\ \((1 + n)\)\)]\)-2 S[1,-2,n]

Options: UseSigmaReduce, FinalSigmaReduce";

ReduceSums::usage="Rewrites, if possiple, expressions containing nested sums into expressions in terms of cyclotomic S-sums and reduces the sums with respect to algebraic relations. 
Example:

In[1]:= expr2=\!\(\*FractionBox[\(1\), \(\*SuperscriptBox[\((\(-2\) + n)\), \(2\)]\\ \*SuperscriptBox[\((\(-1\) + n)\), \(2\)]\\ \*SuperscriptBox[\(n\), \(2\)]\\ \*SuperscriptBox[\((1 + n)\), \(3\)]\)]\)((-4+7 n+27 (n^2)-7 (n^3)-3 (n^4)-14 (n^5)+6 (n^6)+2 (n^7)-2 (n^8)) (-1)^(Underscript[n, .])+(-2+n)^2 (-1+n)^2 n (1+n)^2 (1+4 n+2 (n^2)) (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 4), n])((((-1))^(Underscript[(Subscript[ι, 1]), .]))/(((-3 + (Subscript[ι, 1])))^2))+4 (-2+n)^2 (-1+n)^2 (n^2) (1+n)^3 (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 3), n])((((-1))^(Underscript[(Subscript[ι, 1]), .]))/(-2 + (Subscript[ι, 1])))+(-2+n)^2 (-1+n)^2 (n^2) (1+n)^3 (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 2), n])((((-1))^(Underscript[(Subscript[ι, 1]), .]))/(((-1 + (Subscript[ι, 1])))^3))+2 (-2+n)^2 (-1+n)^2 (n^2) (1+n)^3 (Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 4), n])(((Underoverscript[(∑^(.)), ((Subscript[ι, 2]) = 4), (Subscript[ι, 1])])((((-1))^(Underscript[(Subscript[ι, 2]), .]))/(((-3 + (Subscript[ι, 2])))^2)))/(-1 + (Subscript[ι, 1]))));

In[2]:= ReduceSums[expr2]
Out[2]:= -S[-3,n]+((S[-2, n])/(n + (n^2)))-2 S[-2,n] S[1,n]+\!\(\*FractionBox[\(\(-2\) + \*SuperscriptBox[\((\(-1\))\), \(n\)] - 6\\ n - 6\\ \*SuperscriptBox[\(n\), \(2\)] - 2\\ \*SuperscriptBox[\(n\), \(3\)] + 2\\ \*SuperscriptBox[\((1 + n)\), \(3\)]\\ S[\(-2\), 1, n]\), SuperscriptBox[\((1 + n)\), \(3\)]]\)

It has all the options of 'TransformToSSums' and 'ReduceToBasis'.";

UseSigmaReduce::usage="UseSigmaReduce is an option for TransformToSSums and ReduceSums that specifies whether SigmaReduce should be used in each step to simplify the Result. Note that Carsten Schneiders Sigma Packages has to be loaded in order to use this Option. If Sigma is loaded the default value is True.";

FinalSigmaReduce::usage="FinalSigmaReduce is an option for TransformToSSums and ReduceSums that specifies whether SigmaReduce should be used to Simplify the Result. Default value is False. Note that Carsten Schneiders Sigma Packages has to be loaded in order to use this Option.";

ReduceNonLinearDenominators::usage="";

UseEvaluateMultiSums::usage="";

UseReduceSums::usage="";

AutoSync::usage="This function affects the behaviour of S-sums in a Mathematica session. If AutoSync[True/False] S-sums and cyclotomic sums at k*n+p are/ are not Synchronized automatically to cyclotomic sums at n.
Examples:

In[1]:= AutoSync[True];

In[2]:= S2[2,3,n+1]
Out[2]:= (((1/(((1 + n))^3)) + S[3, n])/(((1 + n))^2))+S[2,3,n]

In[3]:= AutoSync[False];

In[4]:= S2[2,3,n+1]
Out[4]:= S2[2,3,n+1]";

NumberOfBasisSums::usage="NumberOfBasisSums[] uses the Witt-formulae and gives the number of basic harmonic sums, using algebraic relations. NumberOfBasisSums[w_Integer] gives the number of basic harmonic sums at weight w. NumberOfBasisSums[{n1,n2,...}] gives the number of basic harmonic sums with index i appearing ni times";

ComputeHSumBasis::usage="ComputeHSumBasis[{n1,n2,...},n] calculates the algebraic relations of harmonic sums with index i appearing ni times.
ComputeHSumBasis[w, n] calculates the algebraic/differential/half integer relations of S-sums at weight w. 
ComputeHSumBasis[w, n,ToBasis->{s1,s2,...}] calculates the algebraic/differential/half integer relations of harmonic sums at weight w and tries to choose the sums s1, s2, ... to be in the basis, n specifies the upper sumation limit of the Ssums.

Examples:

In[1]:= ComputeHSumBasis[2,n]
Out[1]:= {{S[-1,1,n],S[-2,n],S[2,n]},{S[1,-1,n]->S[-2,n]+S[-1,n] S[1,n]-S[-1,1,n],S[1,1,n]->(1/2) S[1,n]^2+(1/2) S[2,n],S[-1,-1,n]->(1/2) S[-1,n]^2+(1/2) S[2,n]}}

The output above is a list of two lists. The first list is the basis of S-sums of wight 2. The second list gives the relation between the remaining S-sums of weight 2 and those in the basis.

In[2]:= ComputeHSumBasis[{1,2},n]
Out[2]:= {S[a1_,a1_,a2_,n]:>(1/2) S[a1,n] S[a1,a2,n]+(1/2) S[a1,SP[a1,a2],n]-(1/2) S[a1,n] S[a2,a1,n]-(1/2) S[a2,SP[a1,a1],n]+(1/2) S[SP[a1,a1],a2,n]-(1/2) S[SP[a1,a2],a1,n]+S[a2,a1,a1,n]/;a1≠a2,S[a1_,a2_,a1_,n]:>S[a1,n] S[a2,a1,n]+S[a2,SP[a1,a1],n]+S[SP[a1,a2],a1,n]-2 S[a2,a1,a1,n]/;a1≠a2}

In[3]:= ComputeHSumBasis[2, n,ToBasis->{S[2,n]}]
Out[3]:= {{S[-1,1,n],S[1,-1,n],S[2,n]},{S[-2,n]->-S[-1,n] S[1,n]+S[-1,1,n]+S[1,-1,n],S[-1,-1,n]->(1/2) S[-1,n]^2+(1/2) S[2,n],S[1,1,n]->(1/2) S[1,n]^2+(1/2) S[2,n]}}

ComputeHSumBasis[{2, 1},n, {{a1, a1, a2}, {a2, a1, a1}}] calculates the algebraic relations of S-sums with two different indices, where one index appears twice and tries to choose the index sets {a1, a2, a2} and {a2, a1, a2} to be in the basis:

In[4]:= ComputeHSumBasis[{2, 1}, n, {{a1, a1, a2}, {a2, a1, a1}}]
Out[4]:= {S[a1,a2,a1,n]->S[a1,n] S[a2,a1,n]+S[a2,SP[a1,a1],n]+S[SP[a1,a2],a1,n]-2 S[a2,a1,a1,n],S[a1,a1,a2,n]->(1/2) S[a1,n] S[a1,a2,n]+(1/2) S[a1,SP[a1,a2],n]-(1/2) S[a1,n] S[a2,a1,n]-(1/2) S[a2,SP[a1,a1],n]+(1/2) S[SP[a1,a1],a2,n]-(1/2) S[SP[a1,a2],a1,n]+S[a2,a1,a1,n]}

Options: ToBasis";

ToBasis::usage="ToBasis is an Option for functions like ComputeHSumBasis, using the Option ToBasis->{s1,s2,...} it tries to choose the objects s1,s2, ... to be in the basis.";

Alphabet::usage="Alphabet is an option for functions such as ComputeHLogBasis to specify which letters should be taken into account.";

ComputeZSumBasis::usage="ComputeZSumBasis[{n1,n2,...},n] calculates the algebraic relations of Z-sums with index i appearing ni times";

ComputeZSumListBasis::usage="ComputeZSumListBasis[{Z1,Z2,...},n] expresses each Z-sum in {Z1,Z2,...} in terms of a basis. Example:

In[1]:= ComputeZSumListBasis[{Z[1,1,n],Z[2,2,n],Z[2,3,n],Z[3,2,n]},n]
Out[1]:= {(1/2) Z[1,n]^2-(1/2) Z[2,n],(1/2) Z[2,n]^2-(1/2) Z[4,n],Z[2,n] Z[3,n]-Z[5,n]-Z[3,2,n],Z[3,2,n]}";

ComputeSSumBasis::usage="ComputeSSumBasis[{(Subscript[n, 1]),(Subscript[n, 2]),...},{(Subscript[x, 1]),(Subscript[x, 2]),...},n] calculates the algebraic relations of S-sums with index (Subscript[a, i]) appearing (Subscript[n, i]) times. 
ComputeSSumBasis[w_,{(Subscript[x, 1]),(Subscript[x, 2]),...},n], computes algebraic/differential/half integer relations of S-sums with indices (Subscript[x, i]) at weight w.
Examples:

In[1]:= ComputeSSumBasis[{1,2},{1,1,1},n]
Out[1]:= {S[a1,a1,a2,n]->(1/2) S[a1,n] S[a1,a2,n]+(1/2) S[a1,a1+a2,n]+(1/2) S[2 a1,a2,n]-(1/2)S[a1,n] S[a2,a1,n]-(1/2) S[a2,2 a1,n]-(1/2) S[a1+a2,a1,n]+S[a2,a1,a1,n],
     S[a1,a2,a1,n]->S[a1,n] S[a2,a1,n]+S[a2,2 a1,n]+S[a1+a2,a1,n]-2 S[a2,a1,a1,n]}

In[2]:= ComputeSSumBasis[{1,2},{x,x,y},n]
Out[2]:= {S[a1,a1,a2,{x,x,y},n]->(1/2) S[a1,{x},n] S[a1,a2,{x,y},n]+(1/2) S[a1,a1+a2,{x,x y},n]+(1/2) S[2 a1,a2,{(x^2),y},n]-(1/2) S[a1,{x},n] S[a2,a1,{y,x},n]-(1/2) S[a2,2 a1,{y,(x^2)},n]-(1/2) S[a1+a2,a1,{x y,x},n]+S[a2,a1,a1,{y,x,x},n], S[a1,a1,a2,{x,y,x},n]->S[a2,{x},n] S[a1,a1,{x,y},n]+S[a1,a1+a2,{x,x y},n]-S[a1,{x},n] S[a2,a1,{x,y},n]-S[a2,2 a1,{x,x y},n]+S[a2,a1,a1,{x,y,x},n], S[a1,a1,a2,{y,x,x},n]->-S[a2,{x},n] S[a1,a1,{x,y},n]+S[a1,{y},n] S[a1,a2,{x,x},n]+S[2 a1,a2,{x y,x},n]-S[a1+a2,a1,{(x^2),y},n]+S[a2,a1,a1,{x,x,y},n], S[a1,a2,a1,{x,x,y},n]->S[a1,{x},n] S[a2,a1,{x,y},n]+S[a2,2 a1,{x,x y},n]+S[a1+a2,a1,{(x^2),y},n]-S[a2,a1,a1,{x,x,y},n]-S[a2,a1,a1,{x,y,x},n], S[a1,a2,a1,{x,y,x},n]->S[a1,{x},n] S[a2,a1,{y,x},n]+S[a2,2 a1,{y,(x^2)},n]+S[a1+a2,a1,{x y,x},n]-2 S[a2,a1,a1,{y,x,x},n], S[a1,a2,a1,{y,x,x},n]->-S[a1,{y},n] S[a1,a2,{x,x},n]+S[a1,{x},n] S[a1,a2,{y,x},n]-S[a1,a1+a2,{x,x y},n]+S[a1,a1+a2,{y,(x^2)},n]+S[a1,{x},n] S[a2,a1,{x,y},n]+S[a2,2 a1,{x,x y},n]+S[a1+a2,a1,{(x^2),y},n]-S[a2,a1,a1,{x,x,y},n]-S[a2,a1,a1,{x,y,x},n]}

In[3]:= ComputeSSumBasis[2,{x,y},n]
Out[3]:= {{S[1,1,{x,1},n],S[1,1,{y,1},n],S[-1,1,n],S[-1,-1,{1,-1},n],S[-1,-1,{x,1},n],S[-1,-1,{y,1},n],S[-1,1,{-1,-1},n],S[-1,1,{-1,1},n],S[-1,1,{1,-1},n],S[-1,1,{1,1},n],S[-1,1,{1,x},n],S[-1,1,{1,y},n],S[-1,1,{x,1},n],S[-1,1,{y,1},n],S[-2,n],S[2,n],S[-2,{-1},n],S[-2,{1},n],S[-2,{x},n],S[-2,{y},n],S[2,{x},n],S[2,{y},n]},   {S[1,-1,n]->S[-2,n]+S[-1,n] S[1,n]-S[-1,1,n], S[1,1,n]->(1/2) S[1,n]^2+(1/2) S[2,n], S[1,-1,{-1,-1},n]->S[-1,n] S[-1,{-1},n]+S[0,{1},n]-S[-1,1,{-1,-1},n], S[1,-1,{-1,1},n]->S[-1,n] S[-1,{1},n]+S[0,{-1},n]-S[-1,1,{1,-1},n], S[1,-1,{1,-1},n]->S[1,n] S[-1,{-1},n]+S[0,{-1},n]-S[-1,1,{-1,1},n], S[1,-1,{1,1},n]->S[1,n] S[-1,{1},n]+S[0,{1},n]-S[-1,1,{1,1},n], S[1,-1,{1,x},n]->S[1,n] S[-1,{x},n]+S[0,{x},n]-S[-1,1,{x,1},n], S[1,-1,{1,y},n]->S[1,n] S[-1,{y},n]+S[0,{y},n]-S[-1,1,{y,1},n], S[1,-1,{x,1},n]->S[0,{x},n]+S[-1,{1},n] S[1,{x},n]-S[-1,1,{1,x},n], S[1,-1,{y,1},n]->S[0,{y},n]+S[-1,{1},n] S[1,{y},n]-S[-1,1,{1,y},n], S[1,1,{1,x},n]->S[1,n] S[1,{x},n]+S[2,{x},n]-S[1,1,{x,1},n], S[1,1,{1,y},n]->S[1,n] S[1,{y},n]+S[2,{y},n]-S[1,1,{y,1},n], S[-1,-1,n]->(1/2) S[-1,n]^2+(1/2) S[2,n],S[-1,-1,{-1,-1},n]->(1/2) S[-2,{1},n]+(1/2) S[-1,{-1},n]^2, S[-1,-1,{-1,1},n]->S[-2,{-1},n]+S[-1,{-1},n] S[-1,{1},n]-S[-1,-1,{1,-1},n], S[-1,-1,{1,1},n]->(1/2) S[-2,{1},n]+(1/2) S[-1,{1},n]^2, S[-1,-1,{1,x},n]->S[-2,{x},n]+S[-1,{1},n] S[-1,{x},n]-S[-1,-1,{x,1},n], S[-1,-1,{1,y},n]->S[-2,{y},n]+S[-1,{1},n] S[-1,{y},n]-S[-1,-1,{y,1},n]}}";

ComputeCSumBasis::usage="ComputeCSumBasis[w_Integer,{(Subscript[l, 1]),...,(Subscript[l, k])},n] computes relations of cyclotomic sums at weight w with letters (Subscript[l, 1]),...(Subscript[l, k]). The letters (Subscript[l, i]) should be in the form {a,b} (a,b ∈ ℕ). Examples:

In[1]:= ComputeCSumBasis[2,{{2,1}},n]
Out[1]:= {{CS[{{2,1,-1},{2,1,1}},n],CS[{{2,1,2}},n],CS[{{2,1,-2}},n]},{CS[{{2,1,1},{2,1,1}},n]->(1/2) CS[{{2,1,1}},n]^2+(1/2) CS[{{2,1,2}},n],CS[{{2,1,1},{2,1,-1}},n]->CS[{{2,1,-2}},n]+CS[{{2,1,-1}},n] CS[{{2,1,1}},n]-CS[{{2,1,-1},{2,1,1}},n],CS[{{2,1,-1},{2,1,-1}},n]->(1/2) CS[{{2,1,-1}},n]^2+(1/2) CS[{{2,1,2}},n]}}

In[2]:= ComputeCSumBasis[2,{{2,1},{3,5}},n]
Out[2]:= {{CS[{{3,5,-1},{3,5,1}},n],CS[{{2,1,1},{3,5,1}},n],CS[{{2,1,1},{3,5,-1}},n],CS[{{2,1,-1},{3,5,1}},n],CS[{{2,1,-1},{3,5,-1}},n],CS[{{2,1,-1},{2,1,1}},n],CS[{{3,5,2}},n],CS[{{3,5,-2}},n],CS[{{2,1,2}},n],CS[{{2,1,-2}},n]}, {CS[{{3,5,1},{3,5,1}},n]->(1/2) CS[{{3,5,1}},n]^2+(1/2) CS[{{3,5,2}},n], CS[{{3,5,1},{3,5,-1}},n]->CS[{{3,5,-2}},n]+CS[{{3,5,-1}},n] CS[{{3,5,1}},n]-CS[{{3,5,-1},{3,5,1}},n], CS[{{3,5,1},{2,1,1}},n]->(2/7) CS[{{2,1,1}},n]-(3/7) CS[{{3,5,1}},n]+CS[{{2,1,1}},n] CS[{{3,5,1}},n]-CS[{{2,1,1},{3,5,1}},n], CS[{{3,5,1},{2,1,-1}},n]->(2/7) CS[{{2,1,-1}},n]-(3/7) CS[{{3,5,-1}},n]+CS[{{2,1,-1}},n] CS[{{3,5,1}},n]-CS[{{2,1,-1},{3,5,1}},n], CS[{{3,5,-1},{3,5,-1}},n]->(1/2) CS[{{3,5,-1}},n]^2+(1/2) CS[{{3,5,2}},n],CS[{{3,5,-1},{2,1,1}},n]->(2/7) CS[{{2,1,-1}},n]-(3/7) CS[{{3,5,-1}},n]+CS[{{2,1,1}},n] CS[{{3,5,-1}},n]-CS[{{2,1,1},{3,5,-1}},n], CS[{{3,5,-1},{2,1,-1}},n]->(2/7) CS[{{2,1,1}},n]+CS[{{2,1,-1}},n] CS[{{3,5,-1}},n]-(3/7) CS[{{3,5,1}},n]-CS[{{2,1,-1},{3,5,-1}},n], CS[{{2,1,1},{2,1,1}},n]->(1/2) CS[{{2,1,1}},n]^2+(1/2) CS[{{2,1,2}},n],CS[{{2,1,1},{2,1,-1}},n]->CS[{{2,1,-2}},n]+CS[{{2,1,-1}},n] CS[{{2,1,1}},n]-CS[{{2,1,-1},{2,1,1}},n], CS[{{2,1,-1},{2,1,-1}},n]->(1/2) CS[{{2,1,-1}},n]^2+(1/2) CS[{{2,1,2}},n]}}

In both examples the output is a list of the list. The first list is the basis of CS-sums, while the second list expresses all other CS-sums of the given weight and with the given letters in terms of those in the basis.";

ComputeCSSumBasis::usage="ComputeCSSumBasis[w_Integer,{{(Subscript[a, 1]),(Subscript[b, 1])},...{(Subscript[a, k]),(Subscript[b, k])}},{(Subscript[x, 1]),...,(Subscript[x, l])},n] calculates the algebraic relations of CS-sums of weight w, with powers of (Subscript[x, i]) in the numerator and indices {(Subscript[a, i]),(Subscript[b, i])} (representing the first two indices of the three-index sets defining the CS-sums).
Examples:

In[1]:= ComputeCSSumBasis[2,{{1,0},{2,1}},{1},n]
Out[1]:= {{CS[{{1,0,1},{2,1,1}},n],CS[{{2,1,2}},n],CS[{{1,0,2}},n]}, {CS[{{2,1,1},{2,1,1}},n]->(1/2) CS[{{2,1,1}},n]^2+(1/2) CS[{{2,1,2}},n], CS[{{2,1,1},{1,0,1}},n]->CS[{{1,0,1}},n]-2 CS[{{2,1,1}},n]+CS[{{1,0,1}},n] CS[{{2,1,1}},n]-CS[{{1,0,1},{2,1,1}},n], CS[{{1,0,1},{1,0,1}},n]->(1/2) CS[{{1,0,1}},n]^2+(1/2) CS[{{1,0,2}},n]}}

In[2]:= ComputeCSSumBasis[2,{{2,1}},{1,x},n]
Out[2]:= {{CS[{{2,1,1},{2,1,1}},{x,x},n],CS[{{2,1,1},{2,1,1}},{1,x},n],CS[{{2,1,2}},{x},n],CS[{{2,1,2}},n]}, {CS[{{2,1,1},{2,1,1}},{x,1},n]->CS[{{2,1,1}},n] CS[{{2,1,1}},{x},n]+CS[{{2,1,2}},{x},n]-CS[{{2,1,1},{2,1,1}},{1,x},n], CS[{{2,1,1},{2,1,1}},n]->(1/2) CS[{{2,1,1}},n]^2+(1/2) CS[{{2,1,2}},n]}}

The output in both examples is a list of two lists. The first list is the basis of CS-sums, while the second list provides relations between other CS-sums and those in the basis.
Sometimes no relations are found:

In[3]:= ComputeCSSumBasis[2,{{1,0},{2,1}},{2,3},n]
Out[3]:= {{CS[{{1,0,1},{1,0,1}},{2,2},n],CS[{{1,0,1},{1,0,1}},{2,3},n],CS[{{1,0,1},{1,0,1}},{3,2},n],CS[{{1,0,1},{1,0,1}},{3,3},n],CS[{{1,0,1},{2,1,1}},{2,2},n],CS[{{1,0,1},{2,1,1}},{2,3},n],CS[{{1,0,1},{2,1,1}},{3,2},n],CS[{{1,0,1},{2,1,1}},{3,3},n],CS[{{2,1,1},{1,0,1}},{2,2},n],CS[{{2,1,1},{1,0,1}},{2,3},n],CS[{{2,1,1},{1,0,1}},{3,2},n],CS[{{2,1,1},{1,0,1}},{3,3},n],CS[{{2,1,1},{2,1,1}},{2,2},n],CS[{{2,1,1},{2,1,1}},{2,3},n],CS[{{2,1,1},{2,1,1}},{3,2},n],CS[{{2,1,1},{2,1,1}},{3,3},n]},{}}

In this case, one may want to extend the alphabet beyond that of the {(Subscript[a, i]),(Subscript[b, i])} or (Subscript[x, i]) given in the input:

In[4]:= ComputeCSSumBasis[2,{{1,0},{2,1}},{2,3},n,ExtendAlphabet->True]
Out[4]:=  {{CS[{{2,1,1},{2,1,1}},{2,3},n],CS[{{1,0,1},{2,1,1}},{3,3},n],CS[{{1,0,1},{2,1,1}},{3,2},n],CS[{{1,0,1},{2,1,1}},{2,3},n],CS[{{1,0,1},{2,1,1}},{2,2},n],CS[{{1,0,1},{1,0,1}},{2,3},n],CS[{{2,1,2}},{9},n],CS[{{2,1,2}},{6},n],CS[{{2,1,2}},{4},n],CS[{{1,0,2}},{9},n],CS[{{1,0,2}},{6},n],CS[{{1,0,2}},{4},n]},{CS[{{2,1,1},{2,1,1}},{3,3},n]->(1/2) CS[{{2,1,1}},{3},n]^2+(1/2) CS[{{2,1,2}},{9},n],CS[{{2,1,1},{2,1,1}},{3,2},n]->CS[{{2,1,1}},{2},n] CS[{{2,1,1}},{3},n]+CS[{{2,1,2}},{6},n]-CS[{{2,1,1},{2,1,1}},{2,3},n],CS[{{2,1,1},{2,1,1}},{2,2},n]->(1/2) CS[{{2,1,1}},{2},n]^2+(1/2) CS[{{2,1,2}},{4},n],CS[{{2,1,1},{1,0,1}},{3,3},n]->CS[{{1,0,1}},{9},n]+CS[{{1,0,1}},{3},n] CS[{{2,1,1}},{3},n]-2 CS[{{2,1,1}},{9},n]-CS[{{1,0,1},{2,1,1}},{3,3},n],CS[{{2,1,1},{1,0,1}},{3,2},n]->CS[{{1,0,1}},{6},n]+CS[{{1,0,1}},{2},n] CS[{{2,1,1}},{3},n]-2 CS[{{2,1,1}},{6},n]-CS[{{1,0,1},{2,1,1}},{2,3},n],CS[{{2,1,1},{1,0,1}},{2,3},n]->CS[{{1,0,1}},{6},n]+CS[{{1,0,1}},{3},n] CS[{{2,1,1}},{2},n]-2 CS[{{2,1,1}},{6},n]-CS[{{1,0,1},{2,1,1}},{3,2},n],CS[{{2,1,1},{1,0,1}},{2,2},n]->CS[{{1,0,1}},{4},n]+CS[{{1,0,1}},{2},n] CS[{{2,1,1}},{2},n]-2 CS[{{2,1,1}},{4},n]-CS[{{1,0,1},{2,1,1}},{2,2},n],CS[{{1,0,1},{1,0,1}},{3,3},n]->(1/2) CS[{{1,0,1}},{3},n]^2+(1/2) CS[{{1,0,2}},{9},n],CS[{{1,0,1},{1,0,1}},{3,2},n]->CS[{{1,0,1}},{2},n] CS[{{1,0,1}},{3},n]+CS[{{1,0,2}},{6},n]-CS[{{1,0,1},{1,0,1}},{2,3},n],CS[{{1,0,1},{1,0,1}},{2,2},n]->(1/2) CS[{{1,0,1}},{2},n]^2+(1/2) CS[{{1,0,2}},{4},n]}}";

ComputeBSSumBasis::usage="ComputeBSSumBasis[{BS[__,n],...,BS[__,n]}] expresses the BS-sums given in the input in terms of a basis. Example:

In[1]:= ComputeBSSumBasis[{BS[{{1,0,1},{1,0,1}},{1,1},{{{},{}},{{},{}}},n],BS[{{1,0,1},{1,0,1}},{1,1},{{{2},{1,1}},{{},{}}},n]}]
Out[1]:= {{BS[{{1,0,1},{1,0,1}},{1,1},{{{},{}},{{2},{1,1}}},n]},{BS[{{1,0,1},{1,0,1}},{1,1},{{{2},{1,1}},{{},{}}},n]->BS[{{1,0,1}},{1},{{{},{}}},n] BS[{{1,0,1}},{1},{{{2},{1,1}}},n]+BS[{{1,0,2}},{1},{{{2},{1,1}}},n]-BS[{{1,0,1},{1,0,1}},{1,1},{{{},{}},{{2},{1,1}}},n],BS[{{1,0,1},{1,0,1}},{1,1},{{{},{}},{{},{}}},n]->(1/2) BS[{{1,0,1}},{1},{{{},{}}},n]^2+(1/2) BS[{{1,0,2}},{1},{{{},{}}},n]}}

The output is a list of two lists. The first list shows the BS-sums of the basis which are of the same weight as the ones given in the input. The second list shows the relations between the BS-sums in the input and those in the basis.
We can also find all relations for BS-sums of a given weight with specific indices. This can be done in two ways. One way is to provide the weight and a set of 'loyal' indices, as in

In[2]:= ComputeBSSumBasis[3,{{{1,0,1},x,{{2},{1,1}}},{{2,1,1},y,{{1,1},{2}}}},n];

We do not show the output because it is too large, but it contains BS-sums where the cyclotomic index {1,0,1} is always associated to x and {{2},{1,1}}, and the cyclotomic index {2,1,1} is always associated to  y and {{1,1},{2}}. This is what we mean by 'loyal' indices.
We can also allow the different indices to permute, as in

In[3]:= ComputeBSSumBasis[2,{{1,0,1},{2,1,1}},{x,y},{{{2},{1,1}},{{1,3},{4}}},n];

Again, we do not show the output because it is too large, but it contains BS-sums where both cyclotomic indices, {1,0,1} and {2,1,1}, can go with either x or y, and with either {{2},{1,1}} or {{1,3},{4}}.";


ComputeHLogBasis::usage="ComputeHLogBasis[w, x] calculates the algebraic relations of H-Logs in x at weight w. 
ComputeHLogBasis[w, x, ToBasis->{h1,h2,...}] calculates the algebraic relations of H-Logs at weight w and tries to choose the H-Log h1, h2, ... to be in the basis. 
ComputeHLogBasis[2,x,Alphabet->{(Subscript[a, 1]),...,(Subscript[a, n])}] computes the algebraic relations of H-Logs of weigth 2 and with alphabet {(Subscript[a, 1]),...,(Subscript[a, n])}.

Examples:

In[1]:= ComputeHLogBasis[2,x]
Out[1]:= {{H[0,1,x],H[-1,1,x],H[-1,0,x]},{H[1,1,x]->(1/2) H[1,x]^2,H[1,0,x]->H[0,x] H[1,x]-H[0,1,x],H[1,-1,x]->H[-1,x] H[1,x]-H[-1,1,x],H[0,0,x]->(1/2) H[0,x]^2,H[0,-1,x]->H[-1,x] H[0,x]-H[-1,0,x],H[-1,-1,x]->(1/2) H[-1,x]^2}}

In[2]:= ComputeHLogBasis[2,x,ToBasis->{H[1,0,x]}]
Out[2]:= {{H[-1,1,x],H[-1,0,x],H[1,0,x]},{H[1,1,x]->(1/2) H[1,x]^2,H[1,-1,x]->H[-1,x] H[1,x]-H[-1,1,x],H[0,1,x]->H[0,x] H[1,x]-H[1,0,x],H[0,0,x]->(1/2) H[0,x]^2,H[0,-1,x]->H[-1,x] H[0,x]-H[-1,0,x],H[-1,-1,x]->(1/2) H[-1,x]^2}}

In[3]:= ComputeHLogBasis[2,x,Alphabet->{a,b}]
Out[3]:= {{H[a,b,x]},{H[b,b,x]->(1/2) H[b,x]^2,H[b,a,x]->H[a,x] H[b,x]-H[a,b,x],H[a,a,x]->(1/2) H[a,x]^2}

In these examples the output consists of a list of two lists. The first list is the basis of H functions, while the second list gives the relations between all other H functions of the same weight and those in the basis.

ComputeHLogBasis[x, IndexStructure -> {(Subscript[a, 1]),...,(Subscript[a, n])}] computes the algebraic relations of H-Logs with index set {(Subscript[a, 1]),...,(Subscript[a, n])}. For example,

In[4]:= ComputeHLogBasis[x,IndexStructure->{a,a,b}]
Out[4]:= {{H[a,a,b,x]},{H[b,a,a,x]/;a≠b:>H[b,x] H[a,a,x]-H[a,x] H[a,b,x]+H[a,a,b,x],H[a,b,a,x]/;a≠b:>H[a,x] H[a,b,x]-2 H[a,a,b,x]}}";


IndexStructure::usage="IndexStructure is an option for functions such as ComputeHLogBasis to specify which letters appear in which multiplicity.";

NumberOfBasisHLogs::usage="NumberOfBasisHLogs[w,Alphabet->{a__}] uses the Witt-formulae and gives the number of basic harmonic polylogartihms at weight w wiht alphabet {a__}, using algebraic relations. NumberOfBasisHLogs[IndexStructure->{a__}] gives the number of basic harmonic polylogartihms with respect to the IndexStructure {a}.";

UseSquaredArgument::usage="";

UseOneOverArgument::usage="";

UseOneMinusArgument::usage="";

UseOneMinusArgumentOverOnePlusArgument::usage="";

DeleteTower::usage="Option for ReduceToBasis[expr,Online->Pratly].";

UseDifferentiation::usage="UseDifferentiation is an option for ReducetoBasis, ComputeSSumBasis, ComputeHSumBasis and ComputeCSumBasis, if it is set true relations originating from differentiation are used.";

UseHalfInteger::usage="UseHalfInteger is an option for ReducetoBasis, ComputeSSumBasis, ComputeHSumBasis and ComputeCSumBasis, if it is set true half-integer relations are used.";

UseAlgebraic::usage="UseAlgebraic is an option for ComputeSSumBasis, ComputeHSumBasis and ComputeCSumBasis, if it is set true algebraic relations are used.";

UseMultipleInteger::usage="UseMultipleInteger is an option for ComputeCSumBasis, if it is set true multiple-integer relations are used.";

Partly::usage="Is an option for ReduceToBasis.";

Online::usage="Online is an option for ReduceToBasis, if it is set true the relations are calculated online.";

ExtendAlphabet::usage="";

ReduceToBasis::usage="For default option setting ReduceToBasis[expr] replaces dependent harmonic sums up to weight 6 using algebraic relations. In order to replace harmonic sums of higher weight you have to load in additonal relation tables by using DefineRelationTableStatic. Relationtables up to weight 8 are available.
Examples:

In[1]:= ReduceToBasis[S[1,1,N]+3*S[2,N]]
Out[1]:= (1/2) S[1,N]^2+(7/2) S[2,N]

In[2]:= ReduceToBasis[S[1,1,N]+5*S[-1,-1,N]]
Out[2]:= (5/2) S[-1,N]^2+(1/2) S[1,N]^2+3 S[2,N]

Options: UseDifferentiation, UseHalfInteger, Partly, Online.";

ReduceToHBasis::usage="ReduceToHBasis[expr] replaces dependent H-logs up to weight 6 using algebraic relations. Relationtables up to weight 8 are available. Example:

In[1]:= ReduceToHBasis[H[1,1,1,x]+2*H[1,-1,1,x]]
Out[1]:= (1/6) H[1,x]^3+2 H[1,x] H[-1,1,x]-4 H[-1,1,1,x]";

ReduceToLBasis::usage="ReduceToLBasis[expr,x] uses the shuffle algebra to reduce L[_,x] to a basis. Example:

In[1]:= ReduceToLBasis[L[{-1,-1,1},x]+L[{-1,1,-1},x],x]
Out[1]:= L[{-1},x]^2 L[{1},x]+L[{-1,-1,1},x]";

DefineRelationTable::usage="DefineRelationTable['filename'] reads in the relation table used by ReduceToBasis[expr,Online->Partly]. A table up to depth 4 is included. Tables up to depth 8 are available.";

DefineRelationTableStatic::usage="DefineRelationTableStatic['filename'] reads in the relation table used by ReduceToBasis[expr]. A table up to weight 6 is included. Tables up to weight 8 are available.";

DefineRelationTableHStatic::usage="DefineRelationTableHStatic['filename'] reads in the relation table used by ReduceToHBasis[expr]. A table up to weight 6 is included. Tables up to weight 8 are available.";

DefineRelationTableDiff::usage="DefineRelationTableDiff['filename'] reads in the relation table used by ReduceToBasis[expr,UseDifferentiation->True].";

DefineRelationTableHalf::usage="DefineRelationTableHalf['filename'] reads in the relation table used by ReduceToBasis[expr,UseHalfInteger->True].";

DefineRelationTableDiffHalf::usage="DefineRelationTableDiffHalf['filename'] reads in the relation table used by ReduceToBasis[expr,UseDifferentiation->True,UseHalfInteger->True].";

DefineSinfTable::usage="DefineSinfTable['filename'] reads in a relation table used by ReduceConstants.";

DefineCSinfTable::usage="DefineCSinfTable['filename'] reads in a relation table used by ReduceConstants.";

DefineL1Table::usage="DefineL1Table['filename'] reads in a relation table used by ReduceConstants.";

DefineH1Table::usage="DefineH1Table['filename'] reads in a relation table used by ReduceConstants.";

SForwardIndex::usage="SForwardIndex[expr_,c_] tries to move the index c to the front of all S-sums in expr. Examples:

In[1]:= SForwardIndex[S[1,2,2,-2,n],2]
Out[1]:= S[2,-5,n]+S[3,n] S[2,-2,n]+S[5,-2,n]-S[2,-2,3,n]+S[2,2,-3,n]+S[1,n] S[2,2,-2,n]-S[2,1,2,-2,n]-S[2,2,-2,1,n]-S[2,2,1,-2,n]

In[2]:= SForwardIndex[S[1,2,-1,-2,n]+2*S[1,2,n],2]
Out[2]:= 2 S[1,n] S[2,n]+2 S[3,n]-2 S[2,1,n]+S[2,-2,-2,n]+S[2,-1,-3,n]+S[1,n] S[2,-1,-2,n]+S[3,-1,-2,n]-S[2,-1,-2,1,n]-S[2,-1,1,-2,n]-S[2,1,-1,-2,n]

In[3]:= SForwardIndex[S[1,2,{x,y},n],{2,y}]
Out[3]:= S[1,{x},n] S[2,{y},n]+S[3,{x y},n]-S[2,1,{y,x},n]";

SRemoveLeading1::usage="SRemoveLeading1[S[__,n]] extracts leading ones. Example: 

In[1]:= SRemoveLeading1[S[1,1,2,n]+2*S[1,-1,n]]
Out[1]:= (1/2) S[1,n]^2 S[2,n]+S[1,n] S[3,n]+(1/2) S[4,n]+2 (S[-2,n]+S[-1,n] S[1,n]-S[-1,1,n])-S[1,n] S[2,1,n]-S[3,1,n]+S[2,1,1,n]

We see that, except for S[1,n], none of the S-sums in the output has a 1 as the first index.";

ZRemoveLeading1::usage="ZRemoveLeading1[Z[__,n]] extracts leading ones. Example:

In[1]:= ZRemoveLeading1[Z[1,1,2,n]+2*Z[1,-1,n]]
Out[1]:= (1/2) Z[1,n]^2 Z[2,n]-Z[1,n] Z[3,n]+(1/2) Z[4,n]+2 (-Z[-2,n]+Z[-1,n] Z[1,n]-Z[-1,1,n])-Z[1,n] Z[2,1,n]+Z[3,1,n]+Z[2,1,1,n]

We see that, except for Z[1,n], none of the Z-sums in the output has a 1 as the first index.";

SRemoveLeadingIndex::usage="SRemoveLeadingIndex[S[a1,a___,n]] extracts leading a1. 
SRemoveLeadingIndex[expr,a] extracts leading a of the S-sums appearing in expression expr.
Examples:

In[1]:= SRemoveLeadingIndex[S[2,1,-1,n]]
Out[1]:= S[1,-3,n]+S[2,n] S[1,-1,n]+S[3,-1,n]-S[1,-1,2,n]-S[1,2,-1,n]

In[2]:= SRemoveLeadingIndex[S[3,3,1,n]]
Out[2]:= (1/2) S[1,n] S[3,n]^2+S[3,n] S[4,n]+(1/2) S[7,n]-S[3,n] S[1,3,n]-(1/2) S[1,6,n]-S[4,3,n]+(1/2) S[6,1,n]+S[1,3,3,n]

Notice that in both examples only a single S-sum is given as input. If we provide an index to be extracted, we can give an expression containing several S-sums:

In[3]:= SRemoveLeadingIndex[S[3,3,1,n]+2*S[-1,3,1,n],3]
Out[3]:= (1/2) S[1,n] S[3,n]^2+S[3,n] S[4,n]+(1/2) S[7,n]-S[3,n] S[1,3,n]-(1/2) S[1,6,n]-S[4,3,n]+(1/2) S[6,1,n]+2 S[-1,3,1,n]+S[1,3,3,n]";


SRemoveTrailing1::usage="SRemoveTrailing1[S[__,n]] extracts trailing ones. Example:

In[1]:= SRemoveTrailing1[S[2,1,1,n]+2*S[-1,1,n]]
Out[1]:= (1/2) S[1,n]^2 S[2,n]+S[1,n] S[3,n]+(1/2) S[4,n]+2 (S[-2,n]+S[-1,n] S[1,n]-S[1,-1,n])-S[1,n] S[1,2,n]-S[1,3,n]+S[1,1,2,n]

We see that, except for S[1,n], none of the S-sums in the output has a 1 as the last index.";

SRemoveTrailingIndex::usage="SRemoveTrailingIndex[S[a___,a1,n]] extracts trailing a1. 
SRemoveTrailingIndex[expr,a] extracts trailing a of the S-sums appearing in expression expr.
Examples:

In[1]:= SRemoveTrailingIndex[S[2,1,-1,n]]
Out[1]:= S[-3,1,n]+S[2,-2,n]+S[-1,n] S[2,1,n]-S[-1,2,1,n]-S[2,-1,1,n]

In[2]:= SRemoveTrailingIndex[S[1,2,2,n]]
Out[2]:= (1/2) S[1,n] S[2,n]^2+S[2,n] S[3,n]+(1/2) S[5,n]+(1/2) S[1,4,n]-S[2,n] S[2,1,n]-S[2,3,n]-(1/2) S[4,1,n]+S[2,2,1,n]

Notice that in both examples only a single S-sum is given as input. If we provide an index to be extracted, we can give an expression containing several S-sums:

In[3]:= SRemoveTrailingIndex[S[1,2,2,n]+3*S[-1,2,1,n],2]
Out[3]:=(1/2) S[1,n] S[2,n]^2+S[2,n] S[3,n]+(1/2) S[5,n]+(1/2) S[1,4,n]-S[2,n] S[2,1,n]-S[2,3,n]-(1/2) S[4,1,n]+3 S[-1,2,1,n]+S[2,2,1,n]";

CSRemoveTrailing1::usage="CSRemoveTrailing1[CS[__,n]] extracts trailing ones. Example:

In[1]:= CSRemoveTrailing1[CS[{{2,-1,2},{1,2,1}},n]] // Collect[#,CS[__,n],Factor]&
Out[1]:= -\!\(\*FractionBox[\(n\\ \((\(-1351\) + 1061\\ n + 4112\\ \*SuperscriptBox[\(n\), \(2\)] + 1632\\ \*SuperscriptBox[\(n\), \(3\)])\)\), \(450\\ \((1 + n)\)\\ \((2 + n)\)\\ \*SuperscriptBox[\((1 + 2\\ n)\), \(2\)]\)]\)-(968/225) CS[{{2,1,1}},n]-(13/30) CS[{{2,1,2}},n]+\!\(\*FractionBox[\(\((7 + 44\\ n)\)\\ \((37 + 44\\ n)\)\), \(225\\ \*SuperscriptBox[\((1 + 2\\ n)\), \(2\)]\)]\)CS[{{1,0,1}},n] +CS[{{2,1,2}},n] CS[{{1,0,1}},n]-CS[{{1,0,1},{2,1,2}},n]";

CSRemoveTrailingIndex::usage="CSRemoveTrailingIndex[CS[a___,a1,n]] extracts trailing a1. 
CSRemoveTrailingIndex[expr,a] extracts trailing a of the CS-sums appearing in expression expr.
Examples:

In[1]:= CSRemoveTrailingIndex[CS[{{1,1,1},{2,-1,2}},n]]
Out[1]:= -CS[{{1,0,1}},n]+4 CS[{{2,1,1}},n]+(1/(1 + n)) CS[{{2,1,2}},n]+CS[{{1,0,1},{2,1,2}},n]

In[2]:= CSRemoveTrailingIndex[CS[{{1,1,1},{2,-1,1},{1,0,1}},n]]
Out[2]:= -\!\(\*FractionBox[\(4\\ n\), \(1 + n\)]\)+2 CS[{{1,0,1}},n]+(1/(1 + n))(2  CS[{{2,1,1}},n]+CS[{{1,0,1}},n]-2 CS[{{2,1,1}},n]+CS[{{1,0,1}},n] CS[{{2,1,1}},n]-CS[{{1,0,1},{2,1,1}},n])+CS[{{1,0,1}},n] CS[{{1,0,1},{2,1,1}},n]+CS[{{1,0,2},{2,1,1}},n]-2 CS[{{1,0,1},{1,0,1},{2,1,1}},n]

Notice that in both examples only a single CS-sum is given as input. If we provide an index to be extracted, we can give an expression containing several CS-sums:

In[3]:= CSRemoveTrailingIndex[CS[{{1,0,1},{2,-1,1},{1,0,1}},n]+2*CS[{{1,0,2},{2,-1,1}},n],{2,-1,1}]
Out[3]:= 4  CS[{{2,1,1}},n]-2 CS[{{1,0,1},{1,0,1}},n]+2 CS[{{1,0,1},{2,1,1}},n]+2 (2 CS[{{1,0,1}},n]-4 CS[{{2,1,1}},n]+CS[{{1,0,2},{2,1,1}},n])+2 CS[{{2,1,1},{1,0,1}},n]+CS[{{1,0,1},{2,1,1},{1,0,1}},n]";

CSRemoveLeading1::usage="CSRemoveTrailing1[CS[__,n]] extracts leading ones. Example:

In[1]:= CSRemoveLeading1[CS[{{1,2,1},{1,0,2}},n]] // Collect[#,CS[__,n],Factor]&
Out[1]:= (n/(1 + n))+\!\(\*FractionBox[\(1 - n - \*SuperscriptBox[\(n\), \(2\)]\), \(\((1 + n)\)\\ \((2 + n)\)\)]\) CS[{{1,0,2}},n]+CS[{{1,0,1}},n] CS[{{1,0,2}},n]-CS[{{1,0,2},{1,0,1}},n]";

CSRemoveLeadingIndex::usage="CSRemoveTrailingIndex[CS[a1,a___,n]] extracts leading a1. 
CSRemoveTrailingIndex[expr,a] extracts leading a of the CS-sums apearing in expr.
Example:

In[1]:= CSRemoveLeadingIndex[CS[{{1,0,1},{2,-1,1}},n]]
Out[1]:= CS[{{1,0,1}},n]+CS[{{1,0,1}},n] CS[{{2,1,1}},n]-CS[{{2,1,1},{1,0,1}},n]

In[2]:= CSRemoveLeadingIndex[CS[{{1,3,1},{2,-1,1}},n]]
Out[2]:= \!\(\*FractionBox[\(\(-549\)\\ n - 508\\ \*SuperscriptBox[\(n\), \(2\)] - 111\\ \*SuperscriptBox[\(n\), \(3\)]\), \(30\\ \((1 + n)\)\\ \((2 + n)\)\\ \((3 + n)\)\)]\)+(23/15) CS[{{1,0,1}},n]+\!\(\*FractionBox[\(69 + 4\\ n - 51\\ \*SuperscriptBox[\(n\), \(2\)] - 16\\ \*SuperscriptBox[\(n\), \(3\)]\), \(15\\ \((1 + n)\)\\ \((2 + n)\)\\ \((3 + n)\)\)]\) CS[{{2,1,1}},n])+CS[{{1,0,1},{2,1,1}},n]

Notice that in both examples only a single CS-sum is given as input. If we provide an index to be extracted, we can give an expression containing several CS-sums:

In[3]:= CSRemoveLeadingIndex[CS[{{1,0,1},{2,-1,1},{1,0,1}},n]+2*CS[{{1,2,2},{2,-1,1}},n],{2,-1,1}]
Out[3]:= 2 \!\(\*FractionBox[\(\(-262\)\\ n - 444\\ \*SuperscriptBox[\(n\), \(2\)] - 248\\ \*SuperscriptBox[\(n\), \(3\)] - 45\\ \*SuperscriptBox[\(n\), \(4\)]\), \(9\\ \*SuperscriptBox[\((1 + n)\), \(2\)]\\ \*SuperscriptBox[\((2 + n)\), \(2\)]\)]\)+(76/9) CS[{{1,0,1}},n]+(4/3) CS[{{1,0,2}},n]+2 \!\(\*FractionBox[\(\(-259\) - 858\\ n - 970\\ \*SuperscriptBox[\(n\), \(2\)] - 456\\ \*SuperscriptBox[\(n\), \(3\)] - 76\\ \*SuperscriptBox[\(n\), \(4\)]\), \(9\\ \*SuperscriptBox[\((1 + n)\), \(2\)]\\ \*SuperscriptBox[\((2 + n)\), \(2\)]\)]\) CS[{{2,1,1}},n]+CS[{{1,0,2},{2,1,1}},n])+2 CS[{{2,1,1},{1,0,1}},n]+CS[{{1,0,1},{2,1,1},{1,0,1}},n]

In[4]:= CSRemoveLeadingIndex[CS[{{1,0,1},{2,-1,1},{1,0,1}},n]+2*CS[{{2,-1,1},{1,0,2}},n],{2,-1,1}]
Out[4]:= 4 CS[{{2,1,1}},n]-2 CS[{{1,0,1},{1,0,1}},n]+2 CS[{{1,0,1},{2,1,1}},n]+2 CS[{{2,1,1},{1,0,1}},n]+\!\(\*FractionBox[\(16\\ n\), \(1 + 2\\ n\)]\)-4 CS[{{1,0,1}},n]-\!\(\*FractionBox[\(4\\ \((1 + n)\)\), \(1 + 2\\ n\)]\) CS[{{1,0,2}},n]+8 CS[{{2,1,1}},n]+2 CS[{{2,1,1},{1,0,2}},n]+CS[{{1,0,1},{2,1,1},{1,0,1}},n]";

HToSinf::usage="HToSinf[expr] transforms harmonic polylogarithms at 1 to S-sums at infinity. Example:

In[1]:= HToSinf[H[1,-1,0,1,1]+2*H[-1,1]]
Out[1]:= -2 S[-1,∞]+S[4,∞]-S[-1,-3,∞]+S[1,∞] (S[3,∞]-S[-1,-2,∞])-S[2,2,∞]-2 (-S[4,∞]+S[-1,-3,∞]+S[3,1,∞]-S[-1,-2,1,∞])+S[-1,-1,2,∞]";

HToS::usage="HToS[expr] computes the power series expansion of harmonic polylogarithms without trailing zeroes. Example:

In[1]:= HToS[H[1,-1,2,x]]
Out[1]:= -((Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((2^(-(Subscript[t, 1]))) (x^(Subscript[t, 1])))/(Subscript[t, 1]^3))+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((-x)^(Subscript[t, 1]) S[1,{-1/2},(Subscript[t, 1])])/(Subscript[t, 1]^2)+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[2,{1/2},(Subscript[t, 1])])/(Subscript[t, 1])-(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[1,1,{-1,-1/2},(Subscript[t, 1])])/(Subscript[t, 1])";

SToH::usage="SToH[expr,x] takes (part of) a powerseries expansion of a harmonic polylogarithm (expr) and finds the harmonic polylogratithm(s) it orignates form. It is the inverse of HToS. 
Examples:

In[1]:=SToH[(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((2^(-(Subscript[t, 1]))) (x^(Subscript[t, 1])))/(Subscript[t, 1]^3),x]
Out[1]:= H[0,0,2,x]

In[2]:= SToH[(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((-x)^(Subscript[t, 1]) S[1,{-1/2},(Subscript[t, 1])])/(Subscript[t, 1]^2),x]
Out[2]:= -H[0,-1,2,x]+H[0,0,2,x]

In[3]:= SToH[-((Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((2^(-(Subscript[t, 1]))) (x^(Subscript[t, 1])))/(Subscript[t, 1]^3))+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((-x)^(Subscript[t, 1]) S[1,{-1/2},(Subscript[t, 1])])/(Subscript[t, 1]^2)+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[2,{1/2},(Subscript[t, 1])])/(Subscript[t, 1])-(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[1,1,{-1,-1/2},(Subscript[t, 1])])/(Subscript[t, 1]),x]
Out[3]:= H[1,-1,2,x]";

SinfToH::usage="SinfToH[expr] transforms S-sums at infinity to expressions in H[__,1]. Example:

In[1]:= SinfToH[-2 S[-1,∞]+S[4,∞]-S[-1,-3,∞]]
Out[1]:= 2 H[-1,1]+H[-1,0,0,1,1]";

SinfToL::usage="SinfToL[expr] transforms S-sums at infinity to expressions in L[_,1]. Example:

In[1]:= SinfToL[-2 S[-1,∞]+S[4,∞]-S[-1,-3,∞]]
Out[1]:= 2 L[{-1},1]-L[{-1,0,0,1},1]";

ZinfToL::usage="ZinfToL[expr] transforms Z-sums at infinity to expressions in L[_,1]. Example:

In[1]:= ZinfToL[-2 Z[-1,∞]+Z[4,∞]-Z[-1,-3,∞]]
Out[1]:= 2 L[{-1},1]-L[{-1,0,0,1},1]-L[{0,0,0,1},1]";

Mellin::usage="Mellin[expr,x,n], calculates the Mellin Transform of expr. Examples:

In[1]:= Mellin[H[0,x]/(1-x),x,n]
Out[1]:= S[2,n]

In this case it is evaluating (∫_0^1)((H[0, x])/(1 - x)) ((x^n)-1) \[DifferentialD]x

In[2]:= Mellin[1/(1+x),x,n] 
Out[2]:= (-1)^n S[-1,n]+(-1)^(1 + n) S[-1,∞]
In[3]:= % // ReduceConstants[#,ToKnownConstants->True]&
Out[3]:= (-1)^(2 + n) ln2+(-1)^n S[-1,n]

Here it evaluated (∫_0^1)((x^n)/(1 + x)) \[DifferentialD]x.  
Another example:

In[4]:= Mellin[H[0,x]/(1+x)+H[0,1,x]+H[0,0,-1,x],x,n];
In[5]:= % // Collect[ReduceConstants[#,ToKnownConstants->True],{S[__],ln2,z2,z3},Factor]&
Out[5]:= \!\(\*FractionBox[\(\((1 + \*SuperscriptBox[\((\(-1\))\), \(n\)])\)\\ ln2\), SuperscriptBox[\((1 + n)\), \(3\)]]\)-((2 + n)/(((1 + n))^4))-\!\(\*FractionBox[\(\((\((\(-1\) + \*SuperscriptBox[\((\(-1\))\), \(n\)])\)\\ \((1 + 2\\ n)\) + \*SuperscriptBox[\((\(-1\))\), \(n\)]\\ \*SuperscriptBox[\(n\), \(2\)])\)\\ z2\), \(2\\ \*SuperscriptBox[\((1 + n)\), \(2\)]\)]\)+\!\(\*FractionBox[\(3\\ z3\), \(4\\ \((1 + n)\)\)]\)+(-1)^(1 + n) S[-2,n]+((((-1))^n)/(((1 + n))^3)) S[-1,n]-((S[1, n])/(((1 + n))^2))

It can also compute more general Mellin transforms, such as (∫_0^1)((x^q))^n f(x) \[DifferentialD]x, with q ∈ Integers, which is done with Mellin[f[x],x,q*n]. For example:

In[6]:= Mellin[1/Cyclotomic[3,x],x,3n]
Out[6]:= -(11/20)+\!\(\*FractionBox[\(1\), \(1 + 3\\ n\)]\)-\!\(\*FractionBox[\(1\), \(2 + 3\\ n\)]\)+\!\(\*FractionBox[\(1\), \(4 + 3\\ n\)]\)+\!\(\*FractionBox[\(3\\ n\), \(4\\ \((4 + 3\\ n)\)\)]\)-\!\(\*FractionBox[\(1\), \(5 + 3\\ n\)]\)-\!\(\*FractionBox[\(3\\ n\), \(5\\ \((5 + 3\\ n)\)\)]\)-CS[{{3,1,1}},n]+CS[{{3,2,1}},n]+H[{3,0},1]

A Mellin transform of the form (∫_0^1)\!\(\*SuperscriptBox[\(x\), \(a\\ n + b\)]\) f(x) \[DifferentialD]x is also possible:

In[7]:= Mellin[1/Cyclotomic[3,x],x,3n+1]
Out[7]:= -(1/2)+\!\(\*FractionBox[\(1\), \(2 + 3\\ n\)]\)-CS[{{3,2,1}},n]+H[{3,1},1]+(1/3) S[1,n]";

PlusFunctionDefinition::usage="PlusFunctionDefinition is an option for Mellin. There are two different PlusFunctionDefinitions available. PlusFunctionDefinition->1: Mellin[H[m,x]/(1-x),x,n] computes Integrate[(x^n-1)/(1-x)H[m,x],{x,0,1}]. PlusFunctionDefinition->2: Mellin[H[m1,m,x]/(1-x),x,n] computes Integrate[(x^n*H[m1,m,x]-H[m1,m,1])/(1-x),{x,0,1}] and Mellin[H[m1,m,x]H[1,x]^k/(1-x),x,n] computes Integrate[(x^n*H[m1,m,x]-H[m1,m,1])H[1,x]^k/(1-x),{x,0,1}] if m1=!=1";

ConvertMellinInput::usage="Converts an input of a Mellin transform with PlusFunctionDefinition->2 to an input which is suitable for a Mellin transform with PlusFunctionDefinition->1,i.e. Mellin[expr,x,n,PlusFunctionDefinition->2]=Mellin[ConvertMellinInput[expr,x,n],x,n,PlusFunctionDefinition->1].";

InvMellin::usage="InvMellin[expr,n,x] calculates the inverse Mellin-Transform of expr, which will be a function of n, and the output will be a function of x. Examples:

In[1]:= InvMellin[S[1,1,n],n,x]
Out[1]:= -((H[1, x])/(1 - x))

In[2]:=  InvMellin[(-1)^(2 + n) ln2+(-1)^n S[-1,n],n,x];
In[3]:= % // Collect[ReduceConstants[#,ToKnownConstants->True],{S[__],ln2,z2,z3},Factor]&
Out[3]:= (1/(1 + x))

In[4]:= InvMellin[S[1,-1,n]/(n+1)+2*S[1,n],n,x];
In[5]:= % // Collect[ReduceConstants[#,ToKnownConstants->True],{S[__],ln2,z2,z3},Factor]&
Out[5]:= (1/2) (-1+(-1)^(1 + n)) (ln2^2)-(1/2) (-1)^n z2+ln2 ((-1)^n H[-1,x]-H[0,x]+(-1)^(1 + n) H[0,x]-H[1,x])+(1/(1 - x)) (-2+(-1)^(1 + n) H[-1,-1,x]+(-1)^n x H[-1,-1,x]+(-1)^n H[0,-1,x]+(-1)^(1 + n) x H[0,-1,x])

It can also give a result in terms of more general inverse Mellin transforms:

In[6]:= InvMellin[CS[{{2,1,1}},n],n,x]
Out[6]:= -1+\!\(\*FractionBox[\(1\), \(1 + 2\\ n\)]\)+(1/2) H[-1,1]-(1/2) Mellin[(((((x^2)))^n)/(1 + x)),x]+(1/2) Mellin[((-1 + ((((x^2)))^n))/(-1 + x)),x]";

RepresentSum::usage="RepresentSum is an option for InvMellin, if it is set to True the inverse Mellin-Transform is used to represent S[a,n] as the sum of the Mellin transform of functions involving harmonic polylogarithms and required constants.";

ShowRegularization::usage="";

RepresentExpression::usage="";

DifferentiateSSum::usage="DifferentiateSSum[S[a__,n_],x_] calculates the derivative of S[a,n] with respect to x. Example:

In[1]:= DifferentiateSSum[S[1,1,{x,y},n],x] // Expand
Out[1]:= \!\(\*FractionBox[\(\*SuperscriptBox[\(x\), UnderscriptBox[\(n\), \(.\)]]\\ S[1, {y}, n]\), \(\(-1\) + x\)]\)-\!\(\*FractionBox[\(S[1, {x\\ y}, n]\), \(\((\(-1\) + x)\)\\ x\)]\)";

ReduceConstants::usage="Replaces harmonic polylogartihms at one and harmonic sums at infinity by a special set of constants. In order to find the result in terms of known constants, such as multiple zeta values, the option 'ToKnwonConstants->True' must be included. Examples:

In[1]:= ReduceConstants[S[2,∞]]
Out[1]:= S[2,∞]

In[2]:= ReduceConstants[S[2,∞],ToKnownConstants->True]
Out[2]:= z2

In[3]:= ReduceConstants[S[2,2,∞]+2*S[3,2,2,∞],ToKnownConstants->True]
Out[3]:= \!\(\*FractionBox[\(7\\ \*SuperscriptBox[\(z2\), \(2\)]\), \(10\)]\)+2 (\!\(\*FractionBox[\(21\\ \*SuperscriptBox[\(z2\), \(2\)]\\ z3\), \(10\)]\)+\!\(\*FractionBox[\(15\\ z2\\ z5\), \(2\)]\)-\!\(\*FractionBox[\(291\\ z7\), \(16\)]\))

In[4]:= ReduceConstants[S[-5,-1,∞],ToKnownConstants->True]
Out[4]:= s6

Some examples with harmononic polylogarithms evaluated at one:

In[5]:= ReduceConstants[H[0,1,-1,1],ToKnownConstants->True]
Out[5]:= (3 ln2 z2)/2-z3

In[6]:= ReduceConstants[H[0,1,-1,1]+2H[0,0,0,0,1,1],ToKnownConstants->True]
Out[6]:= (3 ln2 z2)/2-z3+2 z5.

The results can be divergent:

In[7]:= ReduceConstants[S[1,∞],ToKnownConstants->True]
Out[7]:= sinf

In[8]:= ReduceConstants[H[1,1,-1,1],ToKnownConstants->True]
Out[8]:= (ln2^3)/6+((ln2^2) sinf)/2+(ln2 (sinf^2))/2-ln2 z2-(sinf z2)/2+(7 z3)/8

The option 'DefineConstants' allows us to replace the consntants by whatever expression we wish:

In[9]:= ReduceConstants[H[1,1,-1,1],DefineConstants->{S[1,∞]->SINF,S[-1,∞]->Sm1inf,S[2,∞]->zeta2,S[3,∞]->zeta3+nothing}]
Out[9]:= -(1/2) (SINF^2) Sm1inf+(1/2) (Sm1inf^2)-(1/6) (Sm1inf^3)-(1/2) SINF zeta2+Sm1inf zeta2+(7/8) (nothing+zeta3)";

DefineConstants::usage="Is an option for ReduceConstants: Set DefineConstants->{S[1,inf]->Sinf,S[-1,inf]->-Log[2]} to replace the S-sums accordingly";

FastIncomplete::usage="";

UseDualityRelations::usage="";

HalfRel::usage="HalfRel[S[a__,n]] gives a relation for S[a__,n] using half-interger relations.";

MellinP::usage="MellinP[f[x],x,n] computes  Integrate[(x^n-1)f[x],{x,0,1}]. Example:

In[1]:= MellinP[H[1,x],x,n]
Out[1]:= -1+(1/(((1 + n))^2))+((S[1, n])/(1 + n))";

InvMellinP::usage="InvMellinP[__,n,x] is the inverse of MellinP[__,x,n]. For example:

In[1]:= MellinP[H[1,x],x,n]
Out[1]:=  -1+(1/(((1 + n))^2))+((S[1, n])/(1 + n))
so

In[2]:= InvMellinP[-1+1/(1+n)^2+S[1,n]/(1+n),n,x] // Factor
Out[2]:= H[1,x]

Another example:

In[3]:= InvMellinP[S[-2,n],n,x]
Out[3]:= ((-1)^(1 + n) H[0,x])/(1+x)+(Subscript[δ, x]) (-S[-2,∞]+(-1)^(2 + n) S[-2,∞])";

ComputeHSumInfBasis::usage="ComputeHSumInfBasis[w_Integer] computes relations of harmonic sums at Infinity and weight w. Example:

In[1]:= ComputeHSumInfBasis[2]
Out[1]:= {{S[2,∞]},{S[-1,-1,∞]->(1/2) S[-1,∞]^2+(1/2) S[2,∞],S[-1,1,∞]->(1/2) S[-1,∞]^2-(1/2) S[2,∞],S[1,-1,∞]->-(1/2) S[-1,∞]^2+S[-1,∞] S[1,∞],S[1,1,∞]->(1/2) S[1,∞]^2+(1/2) S[2,∞],S[-2,∞]->-(1/2) S[2,∞]}}";

ComputeSSumInfBasis::usage="ComputeSSumInfBasis[w_Integer,{(Subscript[x, 1]),..,(Subscript[x, k])}] computes relations of S-sums at Infinity and weight w with indices in (Subscript[x, 1]),...(Subscript[x, k]). Example:

In[1]:= ComputeSSumInfBasis[2,{1,-1}]
Out[1]:= {{S[-2,∞]},{S[1,-1,∞]->-(1/2) S[-1,∞]^2+S[-1,∞] S[1,∞],S[1,1,∞]->-S[-2,∞]+(1/2) S[1,∞]^2,S[-1,1,∞]->S[-2,∞]+(1/2) S[-1,∞]^2,S[-1,-1,∞]->-S[-2,∞]+(1/2) S[-1,∞]^2,S[2,∞]->-2 S[-2,∞]}}";

ComputeCSumInfBasis::usage="ComputeCSumInfBasis[w_Integer,{(Subscript[l, 1]),...,(Subscript[l, k])}] computes relations of cyclotomic sums at Infinity and weight w with letters (Subscript[l, 1]),...(Subscript[l, k]). The letters (Subscript[l, i]) should be in the form {a,b} a,b out of the natural numbers.
Examples:

In[1]:= ComputeCSumInfBasis[2,{{2,0},{1,0}}]
Out[1]:= {{CS[{{1,0,1},{2,0,1}},∞],CS[{{2,0,1},{1,0,1}},∞],CS[{{2,0,1},{2,0,1}},∞],CS[{{1,0,1},{2,0,-1}},∞],CS[{{2,0,1},{1,0,-1}},∞],CS[{{2,0,1},{2,0,-1}},∞],CS[{{2,0,-2}},∞],CS[{{1,0,-1},{2,0,1}},∞],CS[{{2,0,-1},{1,0,1}},∞],CS[{{2,0,-1},{2,0,1}},∞],CS[{{1,0,-1},{2,0,-1}},∞],CS[{{2,0,-1},{1,0,-1}},∞],CS[{{2,0,-1},{2,0,-1}},∞],CS[{{1,0,2}},∞],CS[{{2,0,2}},∞]},{CS[{{1,0,1},{1,0,1}},∞]->(1/2) CS[{{1,0,2}},∞]+2 CS[{{2,0,1}},∞]^2,CS[{{1,0,1},{1,0,-1}},∞]->-2 CS[{{2,0,-1}},∞]^2+4 CS[{{2,0,-1}},∞] CS[{{2,0,1}},∞],CS[{{1,0,-2}},∞]->-(1/2) CS[{{1,0,2}},∞],CS[{{1,0,-1},{1,0,1}},∞]->-(1/2) CS[{{1,0,2}},∞]+2 CS[{{2,0,-1}},∞]^2,CS[{{1,0,-1},{1,0,-1}},∞]->(1/2) CS[{{1,0,2}},∞]+2 CS[{{2,0,-1}},∞]^2}}

In[2]:= ComputeCSumInfBasis[2,{{2,1}}]
Out[2]:= {{CS[{{2,1,-2}},∞],CS[{{2,1,-1},{2,1,1}},∞]},{CS[{{2,1,1},{2,1,1}},∞]->1+2 CS[{{2,1,1}},∞]^2-(3/2) CS[{{1,0,1},{2,1,1}},∞],CS[{{2,1,1},{2,1,-1}},∞]->-1-CS[{{1,0,-1}},∞]+CS[{{1,0,1}},∞]+CS[{{2,1,-2}},∞]-2 CS[{{2,1,1}},∞]-(1/2) CS[{{1,0,-1},{2,1,-1}},∞]+(1/2) CS[{{1,0,1},{2,1,-1}},∞]-CS[{{2,1,-1},{2,1,1}},∞],CS[{{2,1,-1},{2,1,-1}},∞]->1/2-2 CS[{{2,1,-1}},∞]+(3/2) CS[{{2,1,1}},∞]^2-(1/2) CS[{{1,0,-1},{2,1,1}},∞]-(3/2) CS[{{1,0,1},{2,1,1}},∞],CS[{{2,1,2}},∞]->2+3 CS[{{2,1,1}},∞]^2-3 CS[{{1,0,1},{2,1,1}},∞]}}";

NoMinusOne::usage="";

ComputeCRUSumInfBasis::usage="ComputeCRUSumInfBasis[w_Integer,{l1,..,lk},l_] computes relations of cyclotomic S-sums at Infinity at weight w and Cyclotomy l. The letters li should be in the form {a,b} (a,b ∈ ℕ).";

MyMemberQ::usage="MyMemberQ is used by ReducedToBasis.";

HarmonicSumsSum::usage="HarmonicSumsSum[f,{i,min,max}] defines a sum with summand f where i runs from min to max. Example:

In[1]:= HarmonicSumsSum[1/k,{k,1,N}]
Out[1]:= (Underoverscript[(∑^(.)), (k = 1), N]) 1/k";

HarmonicSumsIntegrate::usage="HarmonicSumsIntegrate[f,{x,min,max}] defines an integral with integrand f where x runs from min to max. Example:

In[1]:= HarmonicSumsIntegrate[1/(1+x^2),{x,0,1}]
Out[1]:= (Subscript[(∫^(.)), 0]^1) (1/(1 + (x^2))) \[DifferentialD]x";

UseableFormat::usage="";

HarmonicSumsPower::usage="HarmonicSumsPower[a_,b_] represents a^b.";

HarmonicSumsFactorial::usage="HarmonicSumsFactorial[a_] represents a!.";

HarmonicSumsBinomial::usage="HarmonicSumsBinomial[a_,b_] represents Binomial[a,b].";

ToStandardForm::usage="Converts an CS-sum CS[{{a1,b1,c1},...,{ak,bk,ck}},n] to the standard form where all bi>=0 and ai>bi. Examples:

In[1]:= ToStandardForm[CS[{{2,-1,1}},{x},n]]
Out[1]:= x CS[{{2,1,1}},{x},n]+\!\(\*FractionBox[\(x\\ \((1 + 2\\ n - \*SuperscriptBox[\(x\), UnderscriptBox[\(n\), \(.\)]])\)\), \(1 + 2\\ n\)]\)

In[2]:= ToStandardForm[CS[{{1,2,1}},{x},n]]
Out[2]:= \!\(\*FractionBox[\(\(-4\) - 6\\ n - 2\\ \*SuperscriptBox[\(n\), \(2\)] - 2\\ x - 3\\ n\\ x - \*SuperscriptBox[\(n\), \(2\)]\\ x + 4\\ \*SuperscriptBox[\(x\), UnderscriptBox[\(n\), \(.\)]] + 2\\ n\\ \*SuperscriptBox[\(x\), UnderscriptBox[\(n\), \(.\)]] + 2\\ x\\ \*SuperscriptBox[\(x\), UnderscriptBox[\(n\), \(.\)]] + 2\\ n\\ x\\ \*SuperscriptBox[\(x\), UnderscriptBox[\(n\), \(.\)]]\), \(2\\ \((1 + n)\)\\ \((2 + n)\)\\ x\)]\)+(1/(x^2)) S[1,{x},n]";

ToHarmonicSumsSum::usage="Shows the definition of harmonic sums, cyclotmic sums and BS-sums. Examples:

In[1]:= S[1,1,N]+S[2,1,-1,N] // ToHarmonicSumsSum
Out[1]:= (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), N]) (1/(Subscript[t, 1]^2)) (Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])]) (1/(Subscript[t, 2])) (Underoverscript[(∑^(.)), ((Subscript[t, 3]) = 1), (Subscript[t, 2])]) ((((-1))^(Subscript[t, 3]))/(Subscript[t, 3])) +  (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), N]) (1/(Subscript[t, 1])) (Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])]) (1/(Subscript[t, 2]))

In[2]:= CS[{{1,1,1},{2,1,3}},{x,y},n] // ToHarmonicSumsSum
Out[2]:= (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), n]) ((x^(Subscript[t, 1]))/(1 + (Subscript[t, 1]))) (Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])]) \!\(\*FractionBox[SuperscriptBox[\(y\), SubscriptBox[\(t\), \(2\)]], SuperscriptBox[\((1 + 2\\ \*SubscriptBox[\(t\), \(2\)])\), \(3\)]]\)

In[3]:= BS[1,2,3,{x,y,z},{{{1,1},{2}},{{3},{1,2}},{{},{4}}},n]// ToHarmonicSumsSum
Out[3]:= (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), n]) \!\(\*FractionBox[\(\*SuperscriptBox[\(x\), SubscriptBox[\(t\), \(1\)]]\\ \*SuperscriptBox[\((\(\*SubscriptBox[\(t\), \(1\)]!\))\), \(2\)]\), \(\(\((2\\ \*SubscriptBox[\(t\), \(1\)])\)!\)\\ \*SubscriptBox[\(t\), \(1\)]\)]\) (Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])]) \!\(\*FractionBox[\(\*SuperscriptBox[\(y\), SubscriptBox[\(t\), \(2\)]]\\ \(\((3\\ \*SubscriptBox[\(t\), \(2\)])\)!\)\), \(\(\*SubscriptBox[\(t\), \(2\)]!\)\\ \(\((2\\ \*SubscriptBox[\(t\), \(2\)])\)!\)\\ \*SubsuperscriptBox[\(t\), \(2\), \(2\)]\)]\) (Underoverscript[(∑^(.)), ((Subscript[t, 3]) = 1), (Subscript[t, 2])]) \!\(\*FractionBox[SuperscriptBox[\(z\), SubscriptBox[\(t\), \(3\)]], \(\(\((4\\ \*SubscriptBox[\(t\), \(3\)])\)!\)\\ \*SubsuperscriptBox[\(t\), \(3\), \(3\)]\)]\)";

DefineHarmonicSumsObjects::usage="";

SExpansion::usage="SExpansion[S[a__,n],n,ord] computes the asymptotic expansion of S[a,n] at infinity up to order ord. Example:

In[1]:= SExpansion[Mellin[H[1,x],x,n],n,5]
Out[1]:= -\!\(\*FractionBox[\(183\), \(40\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)+\!\(\*FractionBox[\(43\), \(12\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(31\), \(12\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+\!\(\*FractionBox[\(3\), \(2\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+((1/(n^5))-(1/(n^4))+(1/(n^3))-(1/(n^2))+(1/n)) LG[n]";

GetApproximation::usage="GetApproximation[S[a__,n],{x,y}] computes an approximation of the analytic contiuation of S[a,n] at x+I*y using the (Odd/Even) asymptotic expansion of S[a,n] up to order ExpansionOrder. 

Options: AsymptoticRegion -> ar(default is 20);
 ExpansionOrder -> ord (default is 20);
 Expansion -> Odd/Even (default is Even)";

AsymptoticRegion::usage="Is an option for GetApproximation.";

ExpansionOrder::usage="Is an option for GetApproximation.";

Expansion::usage="Is an option for GetApproximation.";

TaylorSeries::usage="TaylorSeries[CS[a, n], n, x, ord] computes the taylor series expansion in n of CS[a,n] at point x up to order ord. Examples:

In[1]:= TaylorSeries[CS[{{1,0,1}},n],n,1,5] // ToNotCyclotomic // ReduceConstants[#,ToKnownConstants->True]&
Out[1]:= 1+(-1+n) (-1+((π^2)/6))+(1/90) (-1+n)^3 (-90+(π^4))+(1/945) (-1+n)^5 (-945+(π^6))-(-1+n)^2 (-1+z3)-(-1+n)^4 (-1+z5)

In[2]:= TaylorSeries[CS[{{1,2,1}},n],n,0,5] // ToNotCyclotomic // ReduceConstants[#,ToKnownConstants->True]&
Out[2]:= (1/4) n (-5+\!\(\*FractionBox[\(2\\ \*SuperscriptBox[\(π\), \(2\)]\), \(3\)]\))+\!\(\*FractionBox[\(\*SuperscriptBox[\(n\), \(3\)]\\ \((\(-1530\) + 16\\ \*SuperscriptBox[\(π\), \(4\)])\)\), \(1440\)]\)+\!\(\*FractionBox[\(\*SuperscriptBox[\(n\), \(5\)]\\ \((\(-61425\) + 64\\ \*SuperscriptBox[\(π\), \(6\)])\)\), \(60480\)]\)+(1/8) (n^2) (9-8 z3)-(1/32) (n^4) (-33+32 z5)

In[3]:= TaylorSeries[CS[{{1,0,1},{1,2,1}},n],n,0,4] // ToNotCyclotomic // ReduceConstants[#,ToKnownConstants->True]&
Out[3]:= (1/48) n (78-12 (π^2)+48 z3)+(1/480) (n^2) (-750-\!\(\*FractionBox[\(4\\ \*SuperscriptBox[\(π\), \(4\)]\), \(3\)]\)+720 z3)+\!\(\*FractionBox[\(\*SuperscriptBox[\(n\), \(3\)]\\ \((4410 - 48\\ \*SuperscriptBox[\(π\), \(4\)] - 480\\ \*SuperscriptBox[\(π\), \(2\)]\\ z3 + 5760\\ z5)\)\), \(2880\)]\)+\!\(\*FractionBox[\(\*SuperscriptBox[\(n\), \(4\)]\\ \((\(-733320\) - 384\\ \*SuperscriptBox[\(π\), \(6\)] + 241920\\ \*SuperscriptBox[\(z3\), \(2\)] + 725760\\ z5)\)\), \(483840\)]\)";

ExpandSInf::usage="ExpandSInf is an option for SExpansion and HarmonicSumsSeries to specify whether S[1,{a},n] for Abs[a]>1 should be expanded at infinity.";

ReduceDepth::usage="ReduceDepth[CS[a, n]] tries to reduce the nested depth of the sum CS[a,n] by expressing it using generalized euler sums.";

ToHarmonicSumsIntegrate::usage="Shows the definition of harmonic polylogarithms, multiple polylogarithms and cyclotomic harmonic polylogartihms. Examples:

In[1]:= H[-1,0,1,-1,x] // ToHarmonicSumsIntegrate
Out[1]:= \!\(\*TagBox[RowBox[{SubsuperscriptBox["∫", "0", "x"], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "1"]], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "2"]], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "3"]], RowBox[{FractionBox["1", RowBox[{RowBox[{"(", RowBox[{"1", "+", SubscriptBox["t", "1"]}], ")"}], " ", SubscriptBox["t", "2"], " ", RowBox[{"(", RowBox[{"1", "-", SubscriptBox["t", "3"]}], ")"}], " ", RowBox[{"(", RowBox[{"1", "+", SubscriptBox["t", "4"]}], ")"}]}]], RowBox[{"\[DifferentialD]", SubscriptBox["t", "4"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "3"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "2"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "1"]}]}]}]}]}]}],HoldForm]\)

In[2]:= H[-1,2,1,0,x] // ToHarmonicSumsIntegrate
Out[2]:= \!\(\*TagBox[RowBox[{SubsuperscriptBox["∫", "0", "x"], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "1"]], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "2"]], RowBox[{FractionBox[RowBox[{"H", "[", RowBox[{"0", ",", SubscriptBox["t", "3"]}], "]"}], RowBox[{RowBox[{"(", RowBox[{"1", "+", SubscriptBox["t", "1"]}], ")"}], " ", RowBox[{"(", RowBox[{"2", "-", SubscriptBox["t", "2"]}], ")"}], " ", RowBox[{"(", RowBox[{"1", "-", SubscriptBox["t", "3"]}], ")"}]}]], RowBox[{"\[DifferentialD]", SubscriptBox["t", "3"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "2"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "1"]}]}]}]}]}],HoldForm]\)

In[3]:= H[{3,0},{4,0},1,x] // ToHarmonicSumsIntegrate
Out[3]:= \!\(\*TagBox[RowBox[{SubsuperscriptBox["∫", "0", "x"], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "1"]], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "2"]], RowBox[{FractionBox["1", RowBox[{RowBox[{"(", RowBox[{"1", "+", SubscriptBox["t", "1"], "+", SubsuperscriptBox["t", "1", "2"]}], ")"}], " ", RowBox[{"(", RowBox[{"1", "+", SubsuperscriptBox["t", "2", "2"]}], ")"}], " ", RowBox[{"(", RowBox[{"1", "-", SubscriptBox["t", "3"]}], ")"}]}]], RowBox[{"\[DifferentialD]", SubscriptBox["t", "3"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "2"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "1"]}]}]}]}]}],HoldForm]\)

In[4]:= GL[{(1/(Sqrt[1 + VarGL])),(1/VarGL),(1/(1 - VarGL))},x] //ToHarmonicSumsIntegrate
Out[4]:= \!\(\*TagBox[RowBox[{SubsuperscriptBox["∫", "0", "x"], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "1"]], RowBox[{SubsuperscriptBox["∫", "0", SubscriptBox["t", "2"]], RowBox[{FractionBox["1", RowBox[{SqrtBox[RowBox[{"1", "+", SubscriptBox["t", "1"]}]], " ", SubscriptBox["t", "2"], " ", RowBox[{"(", RowBox[{"1", "-", SubscriptBox["t", "3"]}], ")"}]}]], RowBox[{"\[DifferentialD]", SubscriptBox["t", "3"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "2"]}], RowBox[{"\[DifferentialD]", SubscriptBox["t", "1"]}]}]}]}]}],HoldForm]\)";

HToL::usage="HToL[expr] transforms the H[__,_] in expr to L[_,_]. Example:

In[1]:= HToL[H[1,-1,-2,x]]
Out[1]:= -L[{1,-1,-2},x]";

LToH::usage="LToH[expr] transforms the L[__,_] in expr to H[_,_]. Example:

In[1]:= LToH[L[{1,1,2},x]]
Out[1]:= -H[1,1,2,x]";

ToMathematicaConstants::usage="ToMathematicaConstants[expr_] rewrites ln2,z2,z3,... in terms of Mathematica constants like Log[2], Zeta[2], Zeta[3],...";

ConstantsToHarmonicSums::usage="ConstantsToHarmonicSums[expr_] rewrites ln2,z2,z3,... in terms of harmonic sums at infinity. Example:

In[1]:= ConstantsToHarmonicSums[1/2*ln2*z2+z3/4+li4half]
Out[1]:= -(1/2) S[-1,∞] S[2,∞]+(1/4) S[3,∞]-S[-1,1,1,1,∞]";

HarmonicSumsSeries::usage="HarmonicSumsSeries[expr, x, c, ord] computes the series expansion of expr with respect to x around c up to order ord. expr may contain harmonic sums, cyclotomic sums, harmonic polylogarithms, multiple polylogarithms, etc. 
Examples:

In[1]:= HarmonicSumsSeries[H[1,1,x], x, 0, 8]
Out[1]:= ((x^2)/2)+((x^3)/2)+(11/24) (x^4)+(5/12) (x^5)+(137/360) (x^6)+(7/20) (x^7)+(363/1120) (x^8)

In[2]:= HarmonicSumsSeries[H[{3,1},{4,0},x]/(1-x), x, 0, 8]
Out[2]:= ((x^3)/3)+((x^4)/12)+((x^5)/60)+(43/180) (x^6)+(157/1260) (x^7)+(73/1260) (x^8)

In[3]:= HarmonicSumsSeries[GL[{1/VarGL,1/(1-VarGL)},x]/(1+x), x, 0, 8]
Out[3]:= x-(3/4) (x^2)+(31/36) (x^3)-(115/144) (x^4)+(3019/3600) (x^5)-(973/1200) (x^6)+(48877/58800) (x^7)-(191833/235200) (x^8)";

NumericalValues::usage="Evaluates numerically expressions involving sums at infinity or functions at one, as well as other objects. Example:

In[1]:= H[1,2,1/2]+z2+S[3,∞] // NumericalValues
Out[1]:= 2.95339115740654`";

HarmonicSumsVersion::usage="";

ToNotCyclotomic::usage="ToNotCyclotomic[expr_] rewrites cyclotomic letters like {2,0} in H[__,_] in terms of non cyclotomic letters like -1, as much as possible. Example:

In[1]:= ToNotCyclotomic[H[{1,0},{2,0},x]]
Out[1]:= -H[1,-1,x]";

ToKnownConstants::usage="";

ToHLogs::usage="ToHLogs[expr] rewrites certain  Mathematica functions like Log and PolyLog in terms of H[__,_]. ToHLogs[expr,x] rewrites certain Mathematica functions like Log[x] and PolyLog[x,2] in terms of H[__,_].
Example:

In[1]:= ToHLogs[Log[x]*PolyLog[2,1-x]+Log[1-x]*PolyLog[3,1-x]]
Out[1]:= H[0,x] (H[0,1,1]+H[1,0,x])-H[1,x] (-H[1,x] H[0,1,1]+H[0,0,1,1]-H[1,1,0,x])";

ToLogs::usage="ToLogs[expr] rewrites certain H[__,_] functions in terms of functions like Log and PolyLog. ToLogs[expr,x] rewrites certain H[__,x] functions in terms of functions like Log[x] and PolyLog[x,2].
Example: 

In[1]:= ToLogs[H[0,x]*H[1,0,x]+H[1,0,1,x]+2*H[-1,x]] // Expand
Out[1]:= -Log[1-x]^2 Log[x]-Log[1-x] Log[x]^2+2 Log[1+x]-2 Log[1-x] PolyLog[2,1-x]-Log[1-x] PolyLog[2,x]-Log[x] PolyLog[2,x]+2 PolyLog[3,1-x]-2 Zeta[3]";

VariableToArgument::usage="VariableToArgument[L[a_List,y_],x_,z_,opts___Rule] expresses H functions a L functions evaluated at one and with variables as indices in terms of such functions with the variable in the argument. Here x is the variable to be moved to the argument, and z is a value around x which the transformation is performed. Examples:

In[1]:= VariableToArgument[L[{-1,x},1],x,1/2]
Out[1]:= -(ln2^2)-ln2 H[0,x]+H[-1,x] (ln2+H[0,x]+H[1/2,1])-H[-1,1/2,1]+H[-1,1,x]-H[0,-1,x]-ln2 S[1,{-(1/2)},∞]+H[1/2,1] S[1,{-(1/2)},∞]-S[2,{-(1/2)},∞]-S[1,1,{-1,-(1/2)},∞]

In[2]:= VariableToArgument[L[{-1,x},1],x,1]//GLToL
Out[2]:= (ln2^2)/2+(1/2) L[{-1},1]^2+ln2 L[{-1},x]-ln2 L[{0},x]+L[{-1},x] L[{0},x]-(L[{-1},1]-L[{-1},x]) L[{1},1]-L[{-1,1},x]-L[{0,-1},x]+S[-2,∞]+L[{-1},1] (-ln2-S[1,∞])+L[{-1},x] S[1,∞]

In[3]:= VariableToArgument[H[{{eta,0,1},1},1,1,1],eta]
Out[3]:= H[0,0,{4,1},(Sqrt[(1/eta)])]+H[0,{4,0},{4,0},(Sqrt[(1/eta)])]-H[0,{4,1},{4,1},(Sqrt[(1/eta)])]+H[{4,0},0,{4,0},(Sqrt[(1/eta)])]-H[{4,0},{4,0},{4,1},(Sqrt[(1/eta)])]-H[{4,0},{4,1},{4,0},(Sqrt[(1/eta)])]-H[{4,1},0,{4,1},(Sqrt[(1/eta)])]-H[{4,1},{4,0},{4,0},(Sqrt[(1/eta)])]+H[{4,1},{4,1},{4,1},(Sqrt[(1/eta)])]

In the case fo GL functions, 'GLVariableToArgument' should be rather used.";

VariableToIndex::usage="VariableToIndex[expr_,y_] expresses H functions of y in terms of such functions evaluated at 1 and with y moved to the indices. Examples:

In[1]:= VariableToIndex[H[-1,1,x]+H[-1,x],x]
Out[1]:= H[{{(1/x),1},0},1]-H[{{(1/x),1},0},{{-(1/x),1},0},1]

In[2]:= VariableToIndex[H[-1,1,x]+H[-1,1/x],x]
Out[2]:= H[-1,(1/x)]-H[{{(1/x),1},0},{{-(1/x),1},0},1]";

SortFunction::usage="";

AnalyticContinuationFactor::usage="";

MaxDepth::usage="";

ComputeLLogBasis::usage="ComputeLLogBasis[w_Integer,x] finds relations between L-logs of weight w in the variable x. Example:

In[1]:= ComputeLLogBasis[2,x]
Out[1]:= {{L[{1,0},x],L[{1,-1},x],L[{0,-1},x]},{L[{1,1},x]->-(1/2) L[{1},x]^2,L[{0,1},x]->-L[{0},x] L[{1},x],L[{0,0},x]->-(1/2) L[{0},x]^2,L[{-1,1},x]->-L[{-1},x] L[{1},x],L[{-1,0},x]->-L[{-1},x] L[{0},x],L[{-1,-1},x]->-(1/2) L[{-1},x]^2}}";

ComputeLLogListBasis::usage="ComputeLLogListBasis[{L1,L2,...}] expresses the L functions in the list {L1,L2,...} in terms of a basis. Examples:

In[1]:= ComputeLLogListBasis[{L[{1,1,1},x],L[{2,2,2},x]}]
Out[1]:= {-(1/3) L[{1},x] L[{1,1},x], -(1/3) L[{2},x] L[{2,2},x]}

In[2]:= ComputeLLogListBasis[{L[{1,-1,-1},x],L[{1,3,2},x],L[{1,-2,2},x]}]
Out[2]:= {-(1/2) L[{-1},x] L[{1,-1},x],-L[{1},x] L[{3,2},x],-L[{2},x] L[{1,-2},x]}";

ComputeLLog1Basis::usage="ComputeLLogBasis[w_Integer,{(Subscript[l, 1]),...,(Subscript[l, k])}] finds relations between L-logs of weight w with indices (Subscript[l, 1]),...,(Subscript[l, k]) evaluated at one. Example:

In[1]:= ComputeLLog1Basis[2,{1,-1,2}]
Out[1]:= {{L[{2,-1},1],L[{2,1},1]},{L[{-1,-1},1]->(1/2) L[{-1},1]^2,L[{-1,0},1]->-L[{2,1},1],L[{-1,1},1]->(1/2) L[{-1},1]^2-L[{2,1},1],L[{-1,2},1]->L[{-1},1] L[{2},1]-L[{2,-1},1],L[{0,-1},1]->L[{-1},1] L[{0},1]+L[{2,1},1],L[{0,0},1]->(1/2) L[{0},1]^2,L[{0,1},1]->-2 L[{2,1},1],L[{0,2},1]->(1/2) L[{-1},1]^2-L[{2,1},1],L[{1,-1},1]->-(1/2) L[{-1},1]^2+L[{-1},1] L[{1},1]+L[{2,1},1],L[{1,0},1]->2 L[{2,1},1],L[{1,1},1]->(1/2) L[{1},1]^2-L[{2,1},1],L[{1,2},1]->-L[{-1},1] L[{0},1]-L[{-1},1] L[{1},1]-L[{2,1},1],L[{2,0},1]->-(1/2) L[{-1},1]^2+L[{2,1},1],L[{2,2},1]->(1/2) L[{2},1]^2}}";

ComputeLLogRU1Basis::usage="ComputeLLogRU1Basis[w_Integer,k_Integer] finds relations between L-logs of weight w having indices involving the k-th root of unity. Examples:

In[1]:= ComputeLLogRU1Basis[1,3]
Out[1]:= {{LI[{ru[2,3]},1],LR[{1},1],LR[{ru[2,3]},1]},{L[{0},1]->0,L[{1},1]->LR[{1},1],L[{ru[1,3]},1]->-I LI[{ru[2,3]},1]+LR[{ru[2,3]},1],L[{ru[2,3]},1]->I LI[{ru[2,3]},1]+LR[{ru[2,3]},1]},{LR[{ru[1,3]},1]->LR[{ru[2,3]},1]},{LI[{1},1]->0,LI[{ru[1,3]},1]->-LI[{ru[2,3]},1]}}

In[2]:= ComputeLLogRU1Basis[1,6]
Out[2]:= {{LI[{ru[5,6]},1],LR[{-1},1],LR[{1},1],LR[{ru[2,3]},1]},{L[{0},1]->0,L[{ru[1,3]},1]->-(1/2) I LI[{ru[5,6]},1]+LR[{ru[2,3]},1],L[{ru[1,6]},1]->-I LI[{ru[5,6]},1],L[{-1},1]->LR[{-1},1],L[{1},1]->LR[{1},1],L[{ru[2,3]},1]->(1/2) I LI[{ru[5,6]},1]+LR[{ru[2,3]},1],L[{ru[5,6]},1]->I LI[{ru[5,6]},1]},{LR[{ru[5,6]},1]->0},{LI[{-1},1]->0,LI[{1},1]->0,LI[{ru[2,3]},1]->(1/2) LI[{ru[5,6]},1]}}

In[3]:= ComputeLLogRU1Basis[2,2]
Out[3]:= {{LR[{0,1},1],LR[{-1},1],LR[{1},1]},{L[{-1,-1},1]->(1/2) LR[{-1},1]^2,L[{0,-1},1]->-(1/2) LR[{0,1},1],L[{1,-1},1]->-(1/2) LR[{-1},1]^2+LR[{-1},1] LR[{1},1]-(1/2) LR[{0,1},1],L[{0,0},1]->0,L[{1,0},1]->-LR[{0,1},1],L[{1,1},1]->(1/2) LR[{1},1]^2+(1/2) LR[{0,1},1],L[{-1,0},1]->(1/2) LR[{0,1},1],L[{-1,1},1]->(1/2) LR[{-1},1]^2+(1/2) LR[{0,1},1],L[{0,1},1]->LR[{0,1},1],L[{0},1]->0,L[{-1},1]->LR[{-1},1],L[{1},1]->LR[{1},1]},{},{LI[{0,1},1]->0,LI[{-1},1]->0,LI[{1},1]->0}}";

UseLyndonFactorization::usage="";

PowerRelations::usage="";

LToS::usage="Computes the power series expansion of L[m,x]. LToS[expr,x,ord],LToS[expr,x], LToS[expr]. Example:

In[1]:= LToS[L[{1,1,2},x]]
Out[1]:= -((Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((2^(-(Subscript[t, 1]))) (x^(Subscript[t, 1])))/(Subscript[t, 1]^3))+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[1,{1/2},(Subscript[t, 1])])/(Subscript[t, 1]^2)+(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[2,{1/2},(Subscript[t, 1])])/(Subscript[t, 1])-(Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), ∞])((x^(Subscript[t, 1])) S[1,1,{1,1/2},(Subscript[t, 1])])/(Subscript[t, 1])";

LToSinf::usage="LToSinf[expr] rewrites L[_,c] (c a constant) in terms of S-sums at infinity. Example:

In[1]:= LToSinf[L[{-1,1},1]]
Out[1]:= -S[2,∞]+S[-1,-1,∞]";

LToZinf::usage="LToSinf[expr] rewrites L[_,c] (c a constant) in terms of Z-sums at infinity. Example:

In[1]:= LToZinf[L[{-1,1},1]]
Out[1]:= Z[-1,-1,∞]";

RUSinfToL::usage="RUSinfToL[expr] rewrites S-sums at infinity in terms of L[_,_]. Examples:

In[1]:= RUSinfToL[S[1,1,{ru[1,3],-1},∞]]
Out[1]:= L[{-(-1)^(1/3),(-1)^(1/3)},1]+L[{(-1)^(1/3),0},1]

In[2]:= RUSinfToL[S[2,1,{ru[1,3],-1},∞]]
Out[2]:= -L[{-(-1)^(1/3),0,(-1)^(1/3)},1]-L[{-(-1)^(1/3),(-1)^(1/3),0},1]-L[{(-1)^(1/3),0,0},1]";

CycloHToL::usage="CycloHToL[expr] rewrites H[_,_] in terms of L[_,_] using roots of unity. Examples:

In[1]:= CycloHToL[H[{6,0},x]]
Out[1]:= L[{(-1)^(1/3)},x]/((-1)^(1/3)+(-1)^(2/3))+L[{-(-1)^(2/3)},x]/(-(-1)^(1/3)-(-1)^(2/3))

We can also use the option ToRUNotation->True to get the result in terms of the square root of unity

In[2]:= CycloHToL[H[{6,0},x],ToRUNotation->True]
Out[2]:= \!\(\*FractionBox[\(L[{ru[5, 6]}, x]\\ ru[1, 4]\), SqrtBox[\(3\)]]\)+\!\(\*FractionBox[\(L[{ru[1, 6]}, x]\\ ru[3, 4]\), SqrtBox[\(3\)]]\)";

ToRUNotation::usage="An option of some functions to convert cyclotomic harmonic polylogarithms into and expression involving square root of unity.";

LToCycloH::usage="LToCycloH[expr] rewrites L[_,_] in terms of cyclotomic H[_,_] as far as possible. Examples:

In[1]:= LToCycloH[L[{-1,1},x],x]
Out[1]:= H[{2,0},{1,0},x]

In[2]:= LToCycloH[L[{ru[1,3],1},x],x]
Out[2]:= H[{3,1},{1,0},x]+H[{3,0},{1,0},x] ru[1,6]

In[3]:= LToCycloH[L[{ru[1,6]},x],x]
Out[3]:= H[{6,1},x]+H[{6,0},x] ru[1,3]

In[4]:= LToCycloH[L[{E^(2 Pi I /3)},x],x]
Out[4]:= H[{3,1},x]+H[{3,0},x] ru[1,6]";


GLToL::usage="GLToL[expr] rewrites GL[__,_] in terms of L[_,_] as far as possible. Example:

In[1]:= GLToL[ GL[{(1/(1 - VarGL)),(1/(1 + VarGL)),(1/(2 - VarGL))},x]+2*GL[{(1/(Sqrt[1 - VarGL])),(1/(1 + VarGL)),(1/VarGL)},x] ]
Out[1]:= 2 GL[{(1/(Sqrt[1 - VarGL])),(1/(1 + VarGL)),(1/VarGL)},x] + L[{1,-1,2},x]";


GLToH::usage="GLToH[expr] rewrites GL[__,_] in terms of H[__,_] as far as possible. Example:

In[1]:= GLToH[ GL[{(1/(1 - VarGL)),(1/(1 + VarGL)),(1/(2 - VarGL))},x]+2*GL[{(1/(Sqrt[1 - VarGL])),(1/(1 + VarGL)),(1/VarGL)},x] ]
Out[1]:=2 GL[{(1/(Sqrt[1 - VarGL])),(1/(1 + VarGL)),(1/VarGL)},x] - H[{1,0},{2,0},2,x]";

RemoveRationalPowers::usage="";

ToGL::usage="ToGL[expr] rewrites H functions in terms of GL functions. Examples: 

In[1]:= ToGL[H[1,x]]
Out[1]:= GL[{(1/(1 - VarGL))},x]

In[2]:=  ToGL[H[{3,0},{4,0},x]+2*H[{{1,2,2},{2,3}},x]]
Out[2]:= 2 GL[{\!\(\*FractionBox[\(2 + 3\\ VarGL\), \(1 + 2\\ VarGL + 2\\ \*SuperscriptBox[\(VarGL\), \(2\)]\)]\)},x]+GL[{(1/(1 + VarGL + (VarGL^2))),(1/(1 + (VarGL^2)))},x]";

LToGL::usage="LToGL[expr] rewrites L[__,_] in terms of GL[__,_]. Example:

In[1]:= LToGL[L[{1,-1,2},x]]
Out[1]:= GL[{(1/(-1 + VarGL)),(1/(1 + VarGL)),(1/(-2 + VarGL))},x]";

HToGL::usage="HToGL[expr] rewrites H[__,_] in terms of GL[__,_]. Example:

In[1]:= HToGL[H[1,-1,2,x]]
Out[1]:= GL[{(1/(1 - VarGL)),(1/(1 + VarGL)),(1/(2 - VarGL))},x]";

HwToGL::usage="HwToGL[expr] rewrites Hw[_,_] in terms of GL[_,_]. Examples:

In[1]:= HwToGL[Hw[f1,fw1,x]]
Out[1]:= 4 (Sqrt[1 - x]) (x^(3/2))+4 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},1]-8 GL[{1/(1-VarGL)},x] GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},1]-4 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},x]+8 GL[{1/(1-VarGL),(Sqrt[1 - VarGL]) (Sqrt[VarGL])},x]+8 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL]),1/(1-VarGL)},1]

In[2]:= HwToGL[Hw[fw1,x]+3*Hw[fw27,x]];
In[3]:= % // Collect[#,{ (Sqrt[1 - x]), (Sqrt[4 - x]),GL[{__},_]},Factor]&
Out[3]:= \!\(\*FractionBox[\(13\), \(2\\ \*SqrtBox[\(3\)]\)]\)+2 (Sqrt[1 - x]) \!\(\*SqrtBox[\(\(x\)\(\\ \)\)]\)(2 x-1)+(1/6) (Sqrt[4 - x]) \!\(\*SqrtBox[\(\(x\)\(\\ \)\)]\)(5 x-18)+8 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},1]-8 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},x]+(5/3) GL[{(Sqrt[4 - VarGL]) (Sqrt[VarGL])},1]-(5/3) GL[{(Sqrt[4 - VarGL]) (Sqrt[VarGL])},x]-(8/3) GL[{((Sqrt[4 - VarGL]) (Sqrt[VarGL]))/(1+2 VarGL)},1]+(8/3) GL[{((Sqrt[4 - VarGL])(Sqrt[VarGL]))/(1+2 VarGL)},x]";

MultipleSumLimit::usage="MultipleSumLimit[expr_,n_,q_Integer] rewrites S-sums, CS-sums and BS-sums appearing in expr as functions of n in terms of such sums as functions of q*n. Example:

In[1]:= MultipleSumLimit[S[2,n]+CS[{{2,1,1}},{1},n],n,2]
Out[1]:= (1/2) (CS[{{1,1,-1}},2 n]+CS[{{1,1,1}},2 n])+2 (S[-2,2 n]+S[2,2 n])

Notice that both the original expression and the result are indeed the same:

In[2]:= S[2,n]+CS[{{2,1,1}},{1},n] /.n->10
Out[2]:= (160189649813/58663725120) 

In[3]:= MultipleSumLimit[S[2,n]+CS[{{2,1,1}},{1},n],n,2] /.n->10
Out[3]:= (160189649813/58663725120)

Another example:

In[4]:= MultipleSumLimit[S[1,n],n,3]
Out[4]:= S[1,3 n]+S[1,{ru[1,3]},3 n]+S[1,{ru[2,3]},3 n]";

IntRepCS::usage="IntRepCS[CS[__,n],x] gives an integral representation of cyclotomic harmonic sums. The integration variables will be of the form x[i], i ∈ Integers. Example:

In[1]:= IntRepCS[CS[{{2,1,1}},n],x]
Out[1]:= (Subscript[(∫^(.)), 0]^1)-1\[DifferentialD]x[1]+(Subscript[(∫^(.)), 0]^1)(x[1]^2)^n\[DifferentialD]x[1]+(Subscript[(∫^(.)), 0]^1)((1-(x[1]^2)^n)/(2 (1+x[1])))\[DifferentialD]x[1]+(Subscript[(∫^(.)), 0]^1)((-1+(x[1]^2)^n)/(2 (-1+x[1])))\[DifferentialD]x[1]";

GeneralMellin::usage="GeneralMellin[expr_,x_,n_,opts___Rule] does the same as Mellin[expr,x,n] when no options are specified. For example,

In[1]:= GeneralMellin[GL[{1/VarGL}, x], x, n]
Out[1]:= -(1/(1+n)^2)

It is also capable of computing Mellin transforms in cases where 'Mellin' would fail. For example,

In[2]:= Mellin[H[{3,0},{1,0},x],x,n]
Out[2]:= MellinProblem[-H[{3,0},1,x],x,n]

In[3]:= GeneralMellin[H[{3,0},{1,0},x],x,n]
Out[3]:= -((GL[{(1/(1 + VarGL + (VarGL^2))), (1/(1 - VarGL))}, 1])/(1 + n))+((1/2) (-I+(Sqrt[3]))\!\(\*SuperscriptBox[\()\), \(\(-8\)\\ n\)]\) (-\!\(\*FractionBox[\(I\\ GL[{\*FractionBox[\(1\), \(1 + VarGL + \*SuperscriptBox[\(VarGL\), \(2\)]\)], \*FractionBox[\(1\), \(1 - VarGL\)]}, 1]\), \(\*SqrtBox[\(3\)]\\ \((1 + n)\)\)]\)+\!\(\*FractionBox[\(1\), \(6\\ \((1 + n)\)\)]\)(-1)^(1/6) (-3 I GL[{(VarGL/(1 + VarGL + (VarGL^2))),(1/(1 - VarGL))},1]+(Sqrt[3]) GL[{(VarGL/(1 + VarGL + (VarGL^2))),(1/(1 - VarGL))},1]))+((1/2) (-I+(Sqrt[3]))\!\(\*SuperscriptBox[\()\), \(\(-16\)\\ n\)]\) (\!\(\*FractionBox[\(I\\ GL[{\*FractionBox[\(1\), \(1 + VarGL + \*SuperscriptBox[\(VarGL\), \(2\)]\)], \*FractionBox[\(1\), \(1 - VarGL\)]}, 1]\), \(\*SqrtBox[\(3\)]\\ \((1 + n)\)\)]\)+\!\(\*FractionBox[\(\((3 + I\\ \*SqrtBox[\(3\)])\)\\ GL[{\*FractionBox[\(VarGL\), \(1 + VarGL + \*SuperscriptBox[\(VarGL\), \(2\)]\)], \*FractionBox[\(1\), \(1 - VarGL\)]}, 1]\), \(6\\ \((1 + n)\)\)]\)+\!\(\*FractionBox[\(\((3 + I\\ \*SqrtBox[\(3\)])\)\\ S[1, 1, {\(-\*FractionBox[\(1\), \(2\)]\)\\ I\\ \((\(-I\) + \*SqrtBox[\(3\)])\), 1}, n]\), \(6\\ \((1 + n)\)\)]\))+\!\(\*FractionBox[\(1\), \(3\\ \((1 + n)\)\)]\)(-1)^n \!\(\*SuperscriptBox[\(2\), \(\(-1\) + 14\\ n\)]\) (3-I (Sqrt[3])) (-I+(Sqrt[3])\!\(\*SuperscriptBox[\()\), \(\(-14\)\\ n\)]\) S[1,1,{(1/2) I (I+(Sqrt[3])),1},n]

If we specify the option Regularization->1, then 'GeneralMellin' will compute Integrate[(x^n-1)f[x],{x,0,1}].

If we set Regularization->2, then we get Integrate[Sum[(x^n p[k][x]-p[k][1])/q[k][x]*Log[1-x]^k,{k,0,m}],{x,0,1}] where f[x]:=Sum[p[k][x]/q[k][x]*Log[1-x]^k,{k,0,m}].

Examples:

In[2]:= GeneralMellin[H[-1,x]/(x-1),x,n,Regularization->1] // GLToH
Out[2]:= -H[{2,0},1] S[-1,n]-(1/2) S[-1,n]^2+H[{2,0},1] S[1,n]-(1/2) S[2,n]

In[3]:= GeneralMellin[H[-1,x]/(x-1),x,n,Regularization->2]
Out[3]:= -H[{2,0},{1,0},1]-H[{2,0},1] S[-1,n]-(1/2) S[-1,n]^2+H[{2,0},1] S[1,n]-(1/2) S[2,n]
We can also regularize the result around a certain point p by setting the option RegularizationPoint->p, which will then give Integrate[(x^n-p^n)f[x],{x,0,1}]. This option should laways be used together with the option Regulartization->1. Examples:

In[4]:= GeneralMellin[1/(x-1/2),x,n,Regularization->1, RegularizationPoint->1/2]
Out[4]:= (2^(-n)) S[1,{2},n]

In[5]:= GeneralMellin[H[1,x]/(x-1/3),x,n,Regularization->1, RegularizationPoint->1/3]
Out[5]:= (3^(-n)) S[1,1,{3,1},n]";

MellinProblem::usage="Indicates that a Mellin transform could not be performed. Example:

In[1]:= Mellin[H[{3,0},{1,0},x],x,n]
Out[1]:= MellinProblem[-H[{3,0},1,x],x,n]";

InvMellinProblem::usage="Indicates that an inverse Mellin transform could not be performed. Example:

In[1]:= InvMellin[Sin[x]/x,x,n]
Out[1]:= InvMellinProblem[((Sin[x])/x),x,n]";

Regularization::usage="Option of GeneralMellin";

RegularizationPoint::usage="Option of GeneralMellin";

ExpandMellinExpression::usage="Option of GeneralMellin";

NumberOfParallelKernels::usage="";


CSSeparateSinf::usage="CSSeparateSinf[expr_] separates the S[1,n] infinities in expr. Examples:

In[1]:= CSSeparateSinf[CS[{{1,0,1},{3,2,1}},∞]]
Out[1]:= (3/4)-H[{3,0},1]^2-(3/2) H[{3,1},1]+H[{3,1},1]^2+H[{3,0},1,1]+H[{3,0},{3,0},1]+H[{3,0},{3,1},1]+H[{3,1},{3,1},1]-(1/2) S[1,∞]+H[{3,1},1] S[1,∞]+(1/3) S[1,∞]^2-(1/6) (S[1,∞]^2+S[2,∞])

We see that the result consists of finite constants and powers of S[1,∞].

We can also do the S[1,n] separation when the input depends on n:

In[2]:= CSSeparateSinf[CS[{{1,0,1},{1,2,1}},n]]
Out[2]:=\!\(\*FractionBox[\(13\\ n\), \(4\\ \((1 + n)\)\\ \((2 + n)\)\)]\)+\!\(\*FractionBox[\(7\\ \*SuperscriptBox[\(n\), \(2\)]\), \(4\\ \((1 + n)\)\\ \((2 + n)\)\)]\)-(3/2) S[1,n]+(1/2) S[1,n]^2+(1/2) S[2,n] 

In[3]:= CSSeparateSinf[CS[{{1,0,1},{3,2,1}},n]]
Out[3]:= -(3/2) (Underoverscript[(∑^(.)), ((Subscript[ο, 0]) = 1), n])(-\!\(\*FractionBox[\(1\), \(3\\ \*SubscriptBox[\(ο\), \(0\)]\)]\)+\!\(\*FractionBox[\(1\), \(2 + 3\\ \*SubscriptBox[\(ο\), \(0\)]\)]\))-(Underoverscript[(∑^(.)), ((Subscript[ο, 0]) = 1), n])CS[{{1,0,1}},(Subscript[ο, 0])] (-\!\(\*FractionBox[\(1\), \(3\\ \*SubscriptBox[\(ο\), \(0\)]\)]\)+\!\(\*FractionBox[\(1\), \(2 + 3\\ \*SubscriptBox[\(ο\), \(0\)]\)]\))+(Underoverscript[(∑^(.)), ((Subscript[ο, 0]) = 1), n])(-\!\(\*FractionBox[\(1\), \(3\\ \*SubscriptBox[\(ο\), \(0\)]\)]\)+\!\(\*FractionBox[\(1\), \(2 + 3\\ \*SubscriptBox[\(ο\), \(0\)]\)]\)) S[1,n]+(1/3) S[1,n]^2-(1/6) (S[1,n]^2+S[2,n])";

CSinfToHAll::usage="CSinfToHAll[w,c] computes all relations from cyclotomic harmonic sums with cyclotomy c at infinity up to weight w to hpls at 1. Examples:

In[1]:= CSinfToHAll[1,6]
Out[1]:= {CS[{{1,0,-1}},∞]->-H[{2,0},1],CS[{{6,1,-1}},∞]->-1-(1/3) H[{4,0},1]+H[{12,0},1],CS[{{3,1,-1}},∞]->-1+(1/3) H[{2,0},1]+H[{6,0},1]-H[{6,1},1],CS[{{2,1,-1}},∞]->-1+H[{4,0},1],CS[{{3,2,-1}},∞]->-(1/2)-(1/3) H[{2,0},1]+H[{6,1},1],CS[{{6,5,-1}},∞]->-(1/5)-(1/3) H[{4,0},1]+H[{12,2},1],CS[{{1,0,1}},∞]->-H[{1,0},1],CS[{{6,1,1}},∞]->-1-(1/6) H[{1,0},1]+(1/3) H[{2,0},1]+(1/2) H[{3,0},1]+(1/2) H[{3,1},1]+(1/6) H[{6,0},1]+(1/6) H[{6,1},1],CS[{{3,1,1}},∞]->-1-(1/3) H[{1,0},1]+H[{3,0},1]+H[{3,1},1],CS[{{2,1,1}},∞]->-1-(1/2) H[{1,0},1]+H[{2,0},1],CS[{{3,2,1}},∞]->-(1/2)-(1/3) H[{1,0},1]+H[{3,1},1],CS[{{6,5,1}},∞]->-(1/5)-(1/6) H[{1,0},1]+(1/3) H[{2,0},1]+(1/2) H[{3,1},1]-(1/3) H[{6,0},1]+(1/6) H[{6,1},1]}

In[2]:= CSinfToHAll[2,1]
Out[2]:= {CS[{{1,0,-2}},∞]->H[{2,0},{0,0},1],CS[{{1,0,2}},∞]->H[{1,0},1]^2-2 H[{1,0},{1,0},1],CS[{{1,0,-1},{1,0,-1}},∞]->(1/2) H[{1,0},1]^2+(1/2) H[{2,0},1]^2-H[{1,0},{1,0},1],CS[{{1,0,-1},{1,0,1}},∞]->H[{2,0},{0,0},1]+H[{2,0},{2,0},1],CS[{{1,0,1},{1,0,-1}},∞]->H[{1,0},1] H[{2,0},1]-H[{2,0},{2,0},1],CS[{{1,0,1},{1,0,1}},∞]->H[{1,0},1]^2-H[{1,0},{1,0},1],CS[{{1,0,-1}},∞]->-H[{2,0},1],CS[{{1,0,1}},∞]->-H[{1,0},1]}

By 'cyclotomy c' it is meant that the letters are of the form {c,a,b} (with b constrained by the weight w). Notice that if c = n (Subscript[c, 2]) and a = n (Subscript[a, 2]), with n ∈ Integers, then letters of the form {(Subscript[c, 2]),(Subscript[a, 2]),b} can also arise.";

HToCSinfAll::usage="HToCSinfAll[w,c] computes all relations from cyclotomic hpls at 1 with cyclotomy c up to weight w to cyclotomic harmonic sums at infinity. Examples:

In[1]:= HToCSinfAll[2,1]
Out[1]:= {H[{1,0},{1,0},1]->-S[2,∞]+S[1,1,∞],H[{1,0},{0,0},1]->S[2,∞],H[{0,0},{1,0},1]->-S[2,∞],H[{0,0},{0,0},1]->0,H[{1,0},1]->-S[1,∞],H[{0,0},1]->0}

In[2]:= HToCSinfAll[1,4]
Out[2]:= {H[{1,0},1]->-S[1,∞],H[{2,0},1]->-S[-1,∞],H[{4,0},1]->1+CS[{{2,1,-1}},∞],H[{4,1},1]->-(1/2) S[-1,∞],H[{0,0},1]->0}";

GeneralHToH::usage="Expresses H functions written in their most general form to a more specific form whenever possibe. Examples:

In[1]:= H[{{1,1,1},0},x] // GeneralHToH
Out[1]:= H[{3,0},x]

In[2]:= H[{{1,1,1},0},{{1,1,1},{1,1}},x] // GeneralHToH
Out[2]:= H[{3,0},{3,0},x]+H[{3,0},{3,1},x]

In[3]:= H[{{1,1,1},0},{{1,1,2},{1,1}},x] // GeneralHToH
Out[3]:= H[{3,0},{{1,1,2},{1,1}},x]

In[4]:= H[{{1,0,0,1},0},x]+2*H[{{1,0,0,0,1},1},x] //GeneralHToH
Out[4]:=(1/3) H[-1,x]+(2/3) H[{6,0},x]-(1/3) H[{6,1},x]+2 H[{8,1},x]";

HSeparateCuts::usage="HSeparateCuts[expr_] performms the cut separation of harmonic polylogarithms. Example:

In[1]:= HSeparateCuts[H[−1,1,1,x]]
Out[1]:= {-H[-1,x] H[1,1,-1]+H[-1,1,1,x],H[-1,x] H[1,1,-1]}

The sum of the two terms in the output yields the original expression again.";

GLToIndependentLetters::usage="GLToIndependentLetters[expr] tries to remove relations between the appearing GL-letters in expr. Examples:

In[1]:= GLToIndependentLetters[GL[{1/(Sqrt[1 - VarGL]),1/VarGL},x]]
Out[1]:= -2 (Sqrt[1 - x]) GL[{1/VarGL},x]+2 GL[{(Sqrt[1 - VarGL])/VarGL},x]

In[2]:= GLToIndependentLetters[GL[{1/(1-VarGL)^(3/2),1/VarGL,1/(1+VarGL)^(3/2)},x]]
Out[2]:= (2 (2 GL[{1/VarGL},x]-2 GL[{1/(VarGL (Sqrt[1 + VarGL]))},x]))/(Sqrt[1 - x])-2 (-2 (Sqrt[1 - x]) (2-2/(Sqrt[1 + x]))+2 GL[{(Sqrt[1 - VarGL])/VarGL},x]+2 GL[{(Sqrt[1 - VarGL])/(1+VarGL)^(3/2)},x]-2 GL[{(Sqrt[1 - VarGL])/(VarGL (Sqrt[1 + VarGL]))},x])";

ResetRelations::usage="";

CollectTogether::usage="Collects all types of functions defined in the 'HarmonicSums.m' package. Examples:

In[1]:= CollectTogether[n*S[1,1,n]+S[1,1,n]+n^2*CS[{{1,1,1},{1,0,2}},n]+CS[{{1,1,1},{1,0,2}},n]]
Out[1]:= (1+(n^2)) CS[{{1,1,1},{1,0,2}},n]+(1+n) S[1,1,n]

In[2]:= CollectTogether[H[1,1,x]+x*H[1,1,x]+GL[{1/VarGL},x]+2*x^3*GL[{1/VarGL},x]]
Out[2]:= (1+2 (x^3)) GL[{1/VarGL},x]+(1+x) H[1,1,x]";


HIntegrate::usage="HIntegrate[expr,x] computes the anti derivative of expr with respect to x in terms of H-functions. 
Examples:

In[1]:= HIntegrate[1/x,x]
Out[1]:= H[0,x]

In[2]:= HIntegrate[(1+(x^2)+2 (x^3))/(1+(x^4)),x]
Out[2]:= H[{8,0},x]+H[{8,2},x]+2 H[{8,3},x]

In[3]:= HIntegrate[H[0,x]/(1-x),x]
Out[3]:= H[1,0,x]

In[4]:= HIntegrate[H[1,x](1+(x^2))/(1+(x^4)),x]
Out[4]:= H[{8,0},1,x]+H[{8,2},1,x]

It also works with integration boundaries:

In[5]:= HIntegrate[H[0,x]/(1-x),{x,0,1}]
Out[5]:= -z2

In[6]:= HIntegrate[H[0,x]/(1-x),{x,a,b}]
Out[6]:= -H[1,0,a]+H[1,0,b]";

LIntegrate::usage="LIntegrate[expr,x] computes the anti derivative of expr with respect to x in terms of L-functions. It can also work with boundaries, LIntegrate[expr,{x,a,b}].
Examples:

In[1]:= LIntegrate[1/x,x]
Out[1]:= L[{0},x]

In[2]:= LIntegrate[L[{0,1},x]/(1+x),x]
Out[2]:= L[{-1,0,1},x]";

GeneralInvMellin::usage="GeneralInvMellin[expr_,n_,x_,opts___Rule] is a more general version of 'InvMellin' which includes a few extra options. It writes the result in a slightly different notation, for example:

In[1]:= GeneralInvMellin[S[1,n],n,x]
Out[1]:= Mellin[-1+(x^n),-(1/(1 - x))]

which indicates explictly that the result is equal to (∫_0^1)-((-1 + (x^n))/(1 - x))\[DifferentialD]x
If we use 'InvMellin' instead, we just get 

In[2]:= InvMellin[S[1,n],n,x]
Out[2]:= (1/(-1 + x))

Another example highlighting the difference between the notations used for the output of 'InvMellin' and 'GeneralInvMellin':

In[3]:= InvMellin[S[-1,n],n,x]
Out[3]:= ((((-1))^n)/(1 + x))+(Subscript[δ, 1 - x]) S[-1,∞]

In[4]:= GeneralInvMellin[S[-1,n],n,x]
Out[4]:= -GL[{(1/(1 + VarGL))},1]+(-1)^(-n) Mellin[(x^n),(1/(1 + x))]

We see that the output of 'GeneralInvMellin' is given explicitly in terms of a Mellin transform. In the output of 'InvMellin', the Mellin transform (∫_0^1)(x^n) f(x) \[DifferentialD]x is implicit, so the constant -GL[{1/VarGL},1]=S[-1,∞] is multiplied by the Dirac delta (Subscript[δ, 1 - x]).

'GeneralInvMellin' can succeed in cases where 'InvMellin' will fail:

In[5]:= InvMellin[BS[{{1,0,1}},{1},{{{1,1},{2}}},n],n,x]
Out[5]:= InvMellinProblem[BS[{{1,0,1}},{1},{{{1,1},{2}}},n],n,x]

In[6]:= GeneralInvMellin[BS[{{1,0,1}},{1},{{{1,1},{2}}},n],n,x]
Out[6]:= (1/3) (2-\!\(\*SuperscriptBox[\(2\), \(1 - 2\\ n\)]\))-(1/3) \!\(\*SuperscriptBox[\(2\), \(\(-2\)\\ n\)]\) (-1+\!\(\*SuperscriptBox[\(2\), \(2\\ n\)]\)) GL[{((Sqrt[1 - VarGL])/(4 - VarGL))},1]+(1/4) Mellin[-1+(x^n),-((4^(-n))/(((1 - x))^(3/2)))]+3 I \!\(\*SuperscriptBox[\(2\), \(\(-2\) - 2\\ n\)]\) Mellin[-1+(x^n),-\!\(\*FractionBox[\(I\\ x\), \(\*SuperscriptBox[\((1 - x)\), \(3/2\)]\\ \((4 - x)\)\)]\)]

If we set the option 'ComputeMellinConvolution' to 'False', then 'GeneralInvMellin' may give a result involving products of Mellin transforms, while if the same option is set to 'True', it will perform the convolution and give a single Mellin transform:

In[7]:= GeneralInvMellin[S[-1,n]/Binomial[2n,n],n,x,OnlyBSSums->False,ComputeMellinConvolution->False] // Expand
Out[7]:= -\!\(\*SuperscriptBox[\(2\), \(\(-2\)\\ n\)]\) GL[{1/(1+VarGL)},1]+(-1)^(-n) \!\(\*SuperscriptBox[\(2\), \(\(-2\)\\ n\)]\) Mellin[(x^n),1/(1+x)]-(1/2) GL[{1/(1+VarGL)},1] Mellin[-1+(x^n),-((4^(-n))/(1-x)^(3/2))]+(1/2) (-1)^(-n) Mellin[(x^n),1/(1+x)] Mellin[-1+(x^n),-((4^(-n))/(1-x)^(3/2))]

In[8]:= GeneralInvMellin[S[-1,n]/Binomial[2n,n],n,x,OnlyBSSums->False,ComputeMellinConvolution->True]
Out[8]:= Mellin[(x^n),(1/((1-x) x (Sqrt[1 + x])))(-1)^(1 - n) \!\(\*SuperscriptBox[\(2\), \(\(-1\) - 2\\ n\)]\) n (5 (Sqrt[1 + x])-5 (-1\!\(\*SuperscriptBox[\()\), \(2\\ n\)]\) (Sqrt[1 + x])-2 (Sqrt[1 - x]) (Sqrt[1 + x])+2 (-1)^n (Sqrt[1 - x]) (Sqrt[1 + x])-5 x (Sqrt[1 + x])+5 (-1\!\(\*SuperscriptBox[\()\), \(2\\ n\)]\) x (Sqrt[1 + x])+2 (Sqrt[1 - x]) x (Sqrt[1 + x])-2 (-1\!\(\*SuperscriptBox[\()\), \(2\\ n\)]\) (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]))/VarGL},1]+2 (-1)^n (Sqrt[1 - x]) (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]))/VarGL},1]+2 (-1\!\(\*SuperscriptBox[\()\), \(2\\ n\)]\) x (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]))/VarGL},1]+2 (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]))/VarGL},x]-2 x (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]))/VarGL},x]+2 GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]-2 x GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]+(Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]+(-1\!\(\*SuperscriptBox[\()\), \(1 + 2\\ n\)]\) (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]-2 (-1)^n (Sqrt[1 - x]) (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]-x (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]+(-1\!\(\*SuperscriptBox[\()\), \(2\\ n\)]\) x (Sqrt[1 + x]) GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},1]-2 GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},x]+2 x GL[{((Sqrt[1 - VarGL]) (Sqrt[1 + VarGL]))/VarGL},x])]

The option 'OnlyBSSums->True' computes the inverse Mellin transform of an expression ignoring anything that is not a binomial sum. For example:

In[9]:= GeneralInvMellin[BS[{{1,0,1}},{1},{{{2},{1,1}}},n]Binomial[2n,n],n,x, OnlyBSSums->True]
Out[9]:= Mellin[-(4^(-n))+(x^n),-\!\(\*FractionBox[\(\*SuperscriptBox[\(2\), \(3 + 2\\ n\)]\\ Gamma[2\\ n]\), \(n\\ π\\ \((1 - 4\\ x)\)\\ \*SuperscriptBox[\(Gamma[n]\), \(2\)]\)]\) (π-2 (Sqrt[1 - x])(Sqrt[x])+4 (Sqrt[1 - x]) (x^(3/2))-8 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},x])]

Notice the presence still of Binomial[2n,n] (albeit now written as Gamma[2n]/Gamma[n]), which was untouched by 'GeneralInvMellin'. On the other hand, by setting 'OnlyBSSums->False', the full inverse Mellin transform is performed:

In[10]:= GeneralInvMellin[BS[{{1,0,1}},{1},{{{2},{1,1}}},n]Binomial[2n,n],n,x, OnlyBSSums->False]
Out[10]:= Mellin[(x^n),\!\(\*SuperscriptBox[\(2\), \(\(-1\) + 2\\ n\)]\)/(π (Sqrt[1 - x]) (Sqrt[x]))] (\!\(\*SuperscriptBox[\(2\), \(3 + 2\\ n\)]\) Mellin[-(4^(-n))+(x^n),-(1/(1-4 x))]-(I \!\(\*SuperscriptBox[\(2\), \(3 + 2\\ n\)]\) Mellin[-(4^(-n))+(x^n),(2 I ((Sqrt[1 - x]) (Sqrt[x])-2 (Sqrt[1 - x]) (x^(3/2))+4 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},x]))/(1-4 x)])/π

Finally, setting the option 'ExpandMellinExpression' either to 'True' or 'False' may speed up the computation depending on the input.";

ComputeMellinConvolution::usage="";

OnlyBSSums::usage="An option of GeneralInvMellin.";

HarmonicSumsInverseMellinTransform::usage="HarmonicSumsInverseMellinTransform[expr_,n_,x_,opts___Rule] computes the inverse Mellin transform of expr using the functions 'InvMellin' or 'GeneralInvMellin' depending on which one is more convenient for the job. It has the same options as 'GeneralInvMellin'.";

SolveDE::usage="SolveDE[homogeneousdiffeq,x] and SolveDE[homogeneousdiffeq,inhompart,x] obtains the solutions to differential equations. For example, the solutions to the differential equation

(1+x)^2 ((d^3)/(dx^3))f(x)+(1+x) ((d^3)/(dx^3))f(x)+(d/dx)f(x) = 0

can be obtained as follows:

In[1]:= SolveDE[(Subscript[D, x])+3 (1+x) (Subscript[D, x]^2)+(1+x)^2 (Subscript[D, x]^3), x]
Out[1]:= {{1,0},{0,1},{0,GL[{1/(1+VarGL)},x]},{0,GL[{1/(1+VarGL),1/(1+VarGL)},x]}}

This is a homogeneous differential equation, so the inhomogeneous solution is zero, as represented by the first term in the output, {1,0}, where the 1 is used only to indicate that this is a inhomogeneous solution. The three homogeneous solutions are then given by {0,1}, {0,GL[{1/(1+VarGL)},x]} and {0,GL[{1/(1+VarGL),1/(1+VarGL)},x]}. The zero at the first entry of each two-item list is used to indicate that this is a homogeneous solution. The second entry is the actual solution.
Notice that the differential equation in the input was written in operator form, with the derivatives indicated as powers of (Subscript[D, x]). We can also use a more standard form:

In[2]:= SolveDE[f'[x]+(1+x) (3 f''[x]+(1+x) (f^((3)))[x])==0,f[x],x]
Out[2]:= {{1,0},{0,1},{0,GL[{1/(1+VarGL)},x]},{0,GL[{1/(1+VarGL),1/(1+VarGL)},x]}}

Notice that in this case, f[x] must be provided as the second entry.
Inhomogeneous differential equations can also be solved by providing the inhomogeneous part as the second entry:

In[3]:= SolveDE[(Subscript[D, x])+3 (1+x) (Subscript[D, x]^2)+(1+x)^2 (Subscript[D, x]^3), H[-1,x], x]
Out[3]:= {{1,-3 x+(3+x) GL[{1/(1+VarGL)},x]+GL[{1/(1+VarGL),1/(1+VarGL)},x]},{0,1},{0,GL[{1/(1+VarGL)},x]},{0,GL[{1/(1+VarGL),1/(1+VarGL)},x]}}

We have the same three homogeneous solutions as before (since the homogeneous part is the same as in the previous example), and the inhomogeneous solution is given by {1,-3 x+(3+x) GL[{1/(1+VarGL)},x]+GL[{1/(1+VarGL),1/(1+VarGL)},x]} (again, the 1 is used only to indicate that this is a inhomogeneous solution). We can also use a more standard form:

In[4]:= SolveDE[(f^(′))[x]+(1+x) (3 f''[x]+(1+x) (f^((3)))[x])==H[-1,x],f[x],x]
Out[4]:= {{1,-3 x+(3+x) GL[{1/(1+VarGL)},x]+GL[{1/(1+VarGL),1/(1+VarGL)},x]},{0,1},{0,GL[{1/(1+VarGL)},x]},{0,GL[{1/(1+VarGL),1/(1+VarGL)},x]}}

or 

In[5]:= SolveDE[f'[x]+(1+x) (3 f''[x]+(1+x) (f^((3)))[x])-H[-1,x]==0,f[x],x]
Out[5]:= {{1,-3 x+(3+x) GL[{1/(1+VarGL)},x]+GL[{1/(1+VarGL),1/(1+VarGL)},x]},{0,1},{0,GL[{1/(1+VarGL)},x]},{0,GL[{1/(1+VarGL),1/(1+VarGL)},x]}}";

SolveDifferentialEquation::usage="This does exactly the same as SolveDE.";

UseHyperexponentialSolutions::usage="";

UseAlgebraicSolutions::usage="";

SimplifySolution::usage="";

DEFindLinearCombination::usage="Combines the solutions obtained with 'SolveDE', using initial conditions, in order to obtain the solution satisfying these conditions. For example, let's solve the following homogeneous differential equation:

In[1]:= sol = SolveDifferentialEquation[4 (Subscript[D, x]^2)+14 (1+x) (Subscript[D, x]^3)+8 (1+x)^2 (Subscript[D, x]^4)+(1+x)^3 (Subscript[D, x]^5),x]
Out[1]:= {{1,0},{0,x},{0,x GL[{1/(1+VarGL)},x]},{0,1},{0,2+GL[{1/(1+VarGL)},x]},{0,3+2 GL[{1/(1+VarGL)},x]+GL[{1/(1+VarGL),1/(1+VarGL)},x]}}

Since this a 5th order differential equation, we need 5 conditions, let's assume that we know the solution at x=0 to be equal to 19, and the 1st, 2nd, 3rd and 4th derivatives are equal to 5, -6, 10 and -27, respectively. Then the solution is

In[2]:= DEFindLinearCombination[sol,{0,{19,5,-6,10,-27}},x,4]
Out[2]:= 13+2 GL[{1/(1+VarGL)},x]-x GL[{1/(1+VarGL)},x]+3 (2+GL[{1/(1+VarGL)},x])+GL[{1/(1+VarGL),1/(1+VarGL)},x]

The 0 in {0,{19,5,-6,10,-27}} indicates that we are providing the values of the solution and its derivatives at x=0.";

DEToMellinRE::usage="Given a differential equation 'de' in 'x' satisfied by the function 'f', DEToMellinRE[de_,x_,g_[n_],f_,opts___Rule] finds a recursion relation satisfied by

g[n] = (∫_0^1)(x^n) f[x] \[DifferentialD]x

For example, lets consider the following function:

In[1]:= f[x] = ComputeGeneratingFunction[(-1)^i/i,x,{i,1,∞}] // GLToH // ToNotCyclotomic
Out[1]:= -H[-1,x]

It satisfies the following differential equation:

In[2]:= de = (Subscript[D, x])+(1+x) (Subscript[D, x]^2);

More precisely, 'de' is the left-hand side of a homogeneous differential equation (the right-hand side being zero, of course). Now we can obtain our recursion relation:

In[3]:= re = DEToMellinRE[de,x,g[n],-H[-1,x]] //  ReduceConstants
Out[3]:= -1+(-n+(n^2)) g[-2+n]+(n^2) g[-1+n]+2 n H[-1,1]==0

Notice that we have to give the explicit function -H[-1,x] as input.
We can check that indeed this recursion relation is satisfied by  (∫_0^1)(x^n) (-H[-1,x]) \[DifferentialD]x

In[4]:= Mellin[-H[1,x],x,n] // ReduceConstants
Out[4]:= 1/(1+n)^2-ln2/(1+n)+((-1)^(1 + n) ln2)/(1+n)+((-1)^(1 + n) S[-1,n])/(1+n)

We only do a check for a few values of n:

In[5]:= subs = Table[g[n]->1/(1+n)^2-ln2/(1+n)+((-1)^(1 + n) ln2)/(1+n)+((-1)^(1 + n) S[-1,n])/(1+n),{n,0,10}]
Out[5]:= {g[0]->1-2 ln2,g[1]->-(1/4),g[2]->5/18-(2 ln2)/3,g[3]->-(7/48),g[4]->47/300-(2 ln2)/5,g[5]->-(37/360),g[6]->319/2940-(2 ln2)/7,g[7]->-(533/6720),g[8]->1879/22680-(2 ln2)/9,g[9]->-(1627/25200),g[10]->20417/304920-(2 ln2)/11}

In[6]:= Table[re /. n->k /. subs // Expand,{k,2,11}]
Out[6]:= {True,True,True,True,True,True,True,True,True,True}";


REToMellinDE::usage="Given a recursion relation 're' in 'n' satisfied by g[n], REToMellinDE[re_,g_[n_],x_] and REToMellinDE[re_,inhom_,g_[n_],x_] find a differential equation satisfied by the inverse Mellin transform of g[n]. The inhomogeneous part of the recursion relation is 'inhom'. If no such inhomogeneous part is present, then this input is simply omitted.
 Example:

In[1]:= re = -(1+n) (2+n) (-1+6 ln2+2 ln2 n) g[n]+(-2-n) g[1+n]+(3+n)^2 (-1+4 ln2+2 ln2 n) g[2+n];

In[2]:= de = REToMellinDE[re,g[n],x] // ReduceConstants
Out[2]:= ((x^2)-(x^3)-4 ln2 (x^3)) (Subscript[D, x])+((x^2)-(x^4)-8 ln2 (x^4)) (Subscript[D, x]^2)+(2 ln2 (x^3)-2 ln2 (x^5)) (Subscript[D, x]^3)

One solution to this differential equation is -H[-1,x]=-Log[1+x]:

In[3]:= ((x^2)-(x^3)-4 ln2 (x^3)) (Subscript[D, x])+((x^2)-(x^4)-8 ln2 (x^4)) (Subscript[D, x]^2)+(2 ln2 (x^3)-2 ln2 (x^5)) (Subscript[D, x]^3) /. {(Subscript[D, x])->D[-H[-1,x],x],(Subscript[D, x]^2)->D[-H[-1,x],x,x],(Subscript[D, x]^3)->D[-H[-1,x],x,x,x]}  // Factor
Out[3]:= 0

It is easy to check that, indeed, the Mellin transform of -H[-1,x], i.e., (∫_0^1)(x^n) (-H[-1,x])\[DifferentialD]x, satisfies the original recursion relation 're':

In[4]:= Mellin[-H[1,x],x,n] // ReduceConstants
Out[4]:= 1/(1+n)^2-ln2/(1+n)+((-1)^(1 + n) ln2)/(1+n)+((-1)^(1 + n) S[-1,n])/(1+n)

We only do a check for a few values of n:

In[5]:= subs = Table[g[n]->1/(1+n)^2-ln2/(1+n)+((-1)^(1 + n) ln2)/(1+n)+((-1)^(1 + n) S[-1,n])/(1+n),{n,0,13}]
Out[5]:= {g[0]->1-2 ln2,g[1]->-(1/4),g[2]->5/18-(2 ln2)/3,g[3]->-(7/48),g[4]->47/300-(2 ln2)/5,g[5]->-(37/360),g[6]->319/2940-(2 ln2)/7,g[7]->-(533/6720),g[8]->1879/22680-(2 ln2)/9,g[9]->-(1627/25200),g[10]->20417/304920-(2 ln2)/11,g[11]->-(18107/332640),g[12]->263111/4684680-(2 ln2)/13,g[13]->-(237371/5045040)}

In[6]:= Table[re /. n->k /. subs // Expand,{k,0,11}]
Out[6]:= {0,0,0,0,0,0,0,0,0,0,0,0}";

HomogenousDE::usage="HomogenousDE[eq_,b_,x_] finds a homogeneous differential equation in the variable x from the inhomogeneous differential equation eq == b. Example:

In[1]:= HomogenousDE[(Subscript[D, x])^2+(Subscript[D, x])+1,H[1,x],x]
Out[1]:= (Subscript[D, x])+x (Subscript[D, x]^2)+x (Subscript[D, x]^3)+(-1+x) (Subscript[D, x]^4)

The output represents the left-hand side of the resulting homogeneous differential equation (the right-hand side is, of course, zero). Notice that the derivatives in eq are written as powers of (Subscript[D, x]).";

HomogenousRE::usage="HomogenousRE[eq_,b_,a_[n_]] (or equivalently, HomogenousRE[eq_==b_,a_[n_]]) finds a homogeneous difference equation from the inhomogeneous difference equation eq == b, for the function a[n]. Example:

In[1]:= HomogenousRE[f[n+1]+f[n],S[1,n],f[n]]
Out[1]:= (1+n) f[n]+(-2-n) f[1+n]+(-1-n) f[2+n]+(2+n) f[3+n]

The output represents the left-hand side of the resulting homogeneous difference equation (the right-hand side is, of course, zero).";

ToRU::usage="ToRU[expr] tries to rewrite roots of unity in expr in terms of ru[_,_]. Example:

In[1]:= ToRU[L[{(-1)^(1/3),(-1)^(2/3)},x]+L[{(-1)^(3/4),(-1)^(4/5),Exp[-7/8*I*Pi]},x]]
Out[1]:= L[{ru[1,6],ru[1,3]},x]+L[{ru[3,8],ru[2,5],ru[9,16]},x]";

FromRU::usage="Rewrites ru[_,_] in expr in terms of Mathematica expressions. Example:

In[1]:= FromRU[ru[1,3]]
Out[1]:= \!\(\*SuperscriptBox[\(E\), FractionBox[\(2\\ I\\ π\), \(3\)]]\)";

RemoveRationalSumLimit::usage="RemoveRationalSumLimit[expr_,n_] rewrites S-sums, CS-sums and BS-sums appearing in expr as functions of n/q with q ∈ Integers in terms of such sums evaluated at n. Example:

In[1]:= RemoveRationalSumLimit[S[2,n/2]+CS[{{2,1,1}},{1},n/2],n]
Out[1]:= (-3 n (1+n)-8 (1+n)^2-12 (-2 n-(n^2))-12 (-1+(1+n)^2))/(3 (1+n)^2)-(16/3) CS[{{2,1,-1}},∞]-(8/3) CS[{{2,1,-1}},∞]^2-2 (-1)^(1 + n) S[-2,n]-(1/2) (-1)^n S[-1,n]+(1/2) (-1+(-1)^(2 + n)) S[-1,∞]+(1/2) S[1,n]+2 S[2,n]+(-1)^n S[2,∞]

This works mostly for q=2. For other values of q, some issues might arise.";

GeneralInvMellinFromRecurrence::usage="GeneralInvMellinFromRecurrence[reIn_==bIn_,f_[n_],x_,initsIn_List,opts___Rule].";

MinimalInitialValue::usage="";

ReturnDifferentialEquation::usage="";

SymbolicInitialValues::usage="";

(*****BinomialSums*****)
GS::usage="GS[{__},n] is a generalized sum that uses a notation similar to that of the GL functions. In the following examples we can see their structure,

In[1]:= GS[{1/VarGL^2,1/VarGL},n] // ToHarmonicSumsSum
Out[1]:= (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), n])((Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])])1/(Subscript[t, 2]))/(Subscript[t, 1]^2)

In[2]:= GS[{1/VarGL^2,1/VarGL,HarmonicSumsBinomial[2VarGL,VarGL]},n] // ToHarmonicSumsSum
Out[2]:= (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), n])((Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])])((Underoverscript[(∑^(.)), ((Subscript[t, 3]) = 1), (Subscript[t, 2])])(2(Subscript[t, 3]))!/((Subscript[t, 3])!)^2)/(Subscript[t, 2]))/(Subscript[t, 1]^2)

In[3]:= GS[{1/Sqrt[1+VarGL],1/VarGL},n] // ToHarmonicSumsSum
Out[3]:= (Underoverscript[(∑^(.)), ((Subscript[t, 1]) = 1), n])((Underoverscript[(∑^(.)), ((Subscript[t, 2]) = 1), (Subscript[t, 1])])1/(Subscript[t, 2]))/(Sqrt[1 + (Subscript[t, 1])])

In[4]:= GS[{1/Sqrt[1+VarGL],1/VarGL},3]
Out[4]:= (11/12)+(1/(Sqrt[2]))+((Sqrt[3])/2)

In[5]:= GS[{1/VarGL^2,1/VarGL,HarmonicSumsBinomial[2VarGL,VarGL]},n] // ToHarmonicSumsSum // TransformToSSums
Out[5]:= BS[{{1,0,2},{1,0,1},{1,0,0}},{1,1,1},{{{},{}},{{},{}},{{2},{1,1}}},n]";

ReduceToGSBasis::usage="ReduceToGSBasis[expr,n] uses the shuffle algebra to reduce GS[_,n] to a basis. Example:

In[1]:= ReduceToGSBasis[GS[{\!\(\*FractionBox[\(\((2\\ VarGL)\)!\), \(VarGL\\ \*SuperscriptBox[\((\(VarGL!\))\), \(2\)]\)]\),\!\(\*FractionBox[\(\((2\\ VarGL)\)!\), \(VarGL\\ \*SuperscriptBox[\((\(VarGL!\))\), \(2\)]\)]\)},n]+GS[{(1/(VarGL^2)),(1/(VarGL^2)),(1/(VarGL^2))},n],n]
Out[1]:= (1/3) GS[{(1/(VarGL^6))},n]+(1/2) GS[{(1/(VarGL^4))},n] GS[{(1/(VarGL^2))},n]+(1/6) GS[{(1/(VarGL^2))},n]^3+(1/2) GS[{\!\(\*FractionBox[\(\((2\\ VarGL)\)!\), \(VarGL\\ \*SuperscriptBox[\((\(VarGL!\))\), \(2\)]\)]\)},n]^2+(1/2) GS[{\!\(\*FractionBox[SuperscriptBox[\((\(\((2\\ VarGL)\)!\))\), \(2\)], \(\*SuperscriptBox[\(VarGL\), \(2\)]\\ \*SuperscriptBox[\((\(VarGL!\))\), \(4\)]\)]\)},n]

In[2]:= % // ToHarmonicSumsSum // TransformToSSums
Out[2]:= (1/2) BS[{{1,0,1}},{1},{{{2},{1,1}}},n]^2+(1/2) BS[{{1,0,2}},{1},{{{2,2},{1,1,1,1}}},n]+(1/6) S[2,n]^3+(1/2) S[2,n] S[4,n]+(1/3) S[6,n]";

GL::usage="GL[{a__},x] gives generalized iterated integrals:

GL[{f[(Subscript[t, 1])],f[(Subscript[t, 2])],...,f[(Subscript[t, n - 1])],f[(Subscript[t, n])]},x] = (∫_0^x)\[DifferentialD](Subscript[t, 1])f((Subscript[t, 1]))(∫_0^(Subscript[t, 1]))\[DifferentialD](Subscript[t, 2])f((Subscript[t, 2])) ... (∫_0^(Subscript[t, n - 2]))\[DifferentialD](Subscript[t, n - 1])f((Subscript[t, n - 1]))(∫_0^(Subscript[t, n - 1]))\[DifferentialD](Subscript[t, n])f((Subscript[t, n]))

or

GL[{f[(Subscript[t, 1])],f[(Subscript[t, 2])],...,f[(Subscript[t, n - 1])],f[(Subscript[t, n])]},x] = (∫_0^x)\[DifferentialD](Subscript[t, 1])f((Subscript[t, 1])) GL[{f((Subscript[t, 2])),...,f((Subscript[t, n - 1])),f((Subscript[t, n]))},(Subscript[t, 1])]

with

GL[{0, 0, ... , 0, 0},x] =  (Log^n)[x]/n!
     <-- n times -->

The letters f((Subscript[t, k])) are usually indicated as functions of the same integration variable 'VarGL'. Example:

GL[{(1/VarGL),(1/VarGL),(1/(1 - VarGL))}, x] = H[0,0,1,x] = PolyLog[3,x]

The letters f((Subscript[t, k])) can be square root valued. Example:

GL[{(Sqrt[1 - VarGL]),(1/VarGL),(1/(Sqrt[1 + VarGL]))}, x] .";

GLb::usage="GLb[{a__},x] is a generalized iterated integral similar to the GL function. The difference lies in the integration boundaries. While the integrals appearing in the definition of a GL function have a lower bound equal to zero, in the GLb functions they instead have an upper bound equal to one:

GL[{f[(Subscript[t, 1])],f[(Subscript[t, 2])],...,f[(Subscript[t, n - 1])],f[(Subscript[t, n])]},x] = (∫_x^1)\[DifferentialD](Subscript[t, 1])f((Subscript[t, 1]))(∫_(Subscript[t, 1])^1)\[DifferentialD](Subscript[t, 2])f((Subscript[t, 2])) ... (∫_(Subscript[t, n - 2])^1)\[DifferentialD](Subscript[t, n - 1])f((Subscript[t, n - 1]))(∫_(Subscript[t, n - 1])^1)\[DifferentialD](Subscript[t, n])f((Subscript[t, n])) .";

GLbToGL::usage="GLbToGL[expr] expresses GLb functions in terms of GL functions. Example:

In[1]:= GLbToGL[ GLb[{(1/(1 - VarGL)),(1/(1 + VarGL))},x] ]
Out[1]:= -GL[{(1/(1 - VarGL))},x] (GL[{(1/(1 + VarGL))},1] - GL[{(1/(1 + VarGL))},x]) + GL[{(1/(1 + VarGL)),(1/(1 - VarGL))},1] - GL[{(1/(1 + VarGL)),(1/(1 - VarGL))},x] .";


GLToGLb::usage="GLToGLb[expr] expresses GL functions in terms of GLb functions. Example:

In[1]:= GLToGLb[ GL[{(1/(1 - VarGL)),(1/(1 + VarGL))},x] ]

Out[1]:= (GLb[{1/(1-VarGL)},0]-GLb[{1/(1-VarGL)},x]) GLb[{1/(1+VarGL)},0]-GLb[{1/(1-VarGL),1/(1+VarGL)},0]+GLb[{1/(1-VarGL),1/(1+VarGL)},x]
( GLb[{(1/(1 - VarGL))},0]-GLb[{(1/(1 - VarGL))},x] ) GLb[{(1/(1 + VarGL))},0] - GLb[{(1/(1 - VarGL)),(1/(1 + VarGL))},0] + GLb[{(1/(1 - VarGL)),(1/(1 + VarGL))},x]";


BS::usage="BS[(Subscript[m, 1]),...,(Subscript[m, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},{ {{(Subscript[j, 1, 1]),...(Subscript[j, 1, (Subscript[r, 1])])},{(Subscript[k, 1, 1]),...(Subscript[k, 1, (Subscript[s, 1])])}},...,{{(Subscript[j, n, 1]),...(Subscript[j, n, (Subscript[r, n])])},{(Subscript[k, n, 1]),...(Subscript[k, n, (Subscript[s, n])])}} },N] defines the binomial sums:

BS[(Subscript[m, 1]),...,(Subscript[m, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},{ {{(Subscript[j, 1, 1]),...(Subscript[j, 1, (Subscript[r, 1])])},{(Subscript[k, 1, 1]),...(Subscript[k, 1, (Subscript[s, 1])])}},...,{{(Subscript[j, n, 1]),...(Subscript[j, n, (Subscript[r, n])])},{(Subscript[k, n, 1]),...(Subscript[k, n, (Subscript[s, n])])}} },N] =  (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[\(\*SubsuperscriptBox[\(x\), \(1\), SubscriptBox[\(i\), \(1\)]] \(\*UnderoverscriptBox[\(∏\), \(t = 1\), SubscriptBox[\(r\), \(1\)]]\(\((\*SubscriptBox[\(j\), \(1, t\)] \*SubscriptBox[\(i\), \(1\)])\)!\)\)\), \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(1\), SubscriptBox[\(m\), \(1\)]]\\ \(\*UnderoverscriptBox[\(∏\), \(t = 1\), SubscriptBox[\(s\), \(1\)]]\(\((\*SubscriptBox[\(k\), \(1, t\)] \*SubscriptBox[\(i\), \(1\)])\)!\)\(\\ \)\)\)\)]\) (∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[\(\*SubsuperscriptBox[\(x\), \(2\), SubscriptBox[\(i\), \(2\)]] \(\*UnderoverscriptBox[\(∏\), \(t = 1\), SubscriptBox[\(r\), \(2\)]]\(\((\*SubscriptBox[\(j\), \(1, t\)] \*SubscriptBox[\(i\), \(1\)])\)!\)\)\), \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(2\), SubscriptBox[\(m\), \(2\)]]\\ \(\*UnderoverscriptBox[\(∏\), \(t = 1\), SubscriptBox[\(s\), \(2\)]]\(\((\*SubscriptBox[\(k\), \(1, t\)] \*SubscriptBox[\(i\), \(1\)])\)!\)\)\)\)]\) ... (∑_((Subscript[i, n]) = 1)^(Subscript[i, n - 1]))\!\(\*FractionBox[\(\*SubsuperscriptBox[\(x\), \(n\), SubscriptBox[\(i\), \(n\)]] \(\*UnderoverscriptBox[\(∏\), \(t = 1\), SubscriptBox[\(r\), \(n\)]]\(\((\*SubscriptBox[\(j\), \(n, t\)] \*SubscriptBox[\(i\), \(n\)])\)!\)\)\), \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(n\), SubscriptBox[\(m\), \(n\)]]\\ \(\*UnderoverscriptBox[\(∏\), \(t = 1\), SubscriptBox[\(s\), \(n\)]]\(\((\*SubscriptBox[\(k\), \(n, t\)] \*SubscriptBox[\(i\), \(n\)])\)!\)\)\)\)]\)

The indices (Subscript[m, 1]),...,(Subscript[m, n]) are the standard ones appearing in a harmonic sum, and the {(Subscript[x, 1]),...,(Subscript[x, n])} are the corresponding additional factors of (Subscript[x, l]^(Subscript[i, l])) (1≤l≤n) in the numerator of the summands.
The indices (Subscript[j, l, r]) indicate possible additional factorials of the form ((Subscript[j, l, r]) × (Subscript[i, l]))! in the numerator of the summands, while the indices (Subscript[k, l, r]) indicate possible additional factorials of the form ((Subscript[k, l, r]) × (Subscript[i, l]))! in the denominator of the summands. If any of the lists {(Subscript[j, l, 1]),...(Subscript[j, l, (Subscript[r, l])])} or {(Subscript[k, l, 1]),...(Subscript[k, l, (Subscript[s, l])])} is empty, then no such factorials appear for the corresponding summation index (Subscript[i, l]).

Examples:

BS[2,3,1, {x,y,z}, { {{1,2},{3,4}} , {{1,1,1},{2,2}} , {{2},{3,3,4}} }, N]  =  (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[\(\*SuperscriptBox[\(x\), SubscriptBox[\(i\), \(1\)]] \(\*SubscriptBox[\(i\), \(1\)]!\) \(\((2\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\), \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(1\), \(2\)]\\ \\ \(\((3\\ \*SubscriptBox[\(i\), \(1\)])\)!\) \(\((4\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\)\)]\) (∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[\(\*SuperscriptBox[\(y\), SubscriptBox[\(i\), \(2\)]] \*SuperscriptBox[\((\(\*SubscriptBox[\(i\), \(2\)]!\))\), \(3\)]\), \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(2\), \(3\)]\\ \\ \*SuperscriptBox[\((\(\((2\\ \*SubscriptBox[\(i\), \(2\)])\)!\))\), \(2\)]\)\)]\) (∑_((Subscript[i, 3]) = 1)^(Subscript[i, 2]))\!\(\*FractionBox[\(\*SuperscriptBox[\(z\), SubscriptBox[\(i\), \(3\)]] \(\((2\\ \*SubscriptBox[\(i\), \(3\)])\)!\)\), \(\(\\ \\ \)\(\*SubscriptBox[\(i\), \(3\)]\\ \*SuperscriptBox[\((\(\((3 \*SubscriptBox[\(i\), \(3\)])\)!\))\), \(2\)] \(\((4 \*SubscriptBox[\(i\), \(3\)])\)!\)\)\)]\) ,

BS[2,3, {x,y}, { {{1,2},{3,4}} , {{},{}} }, N] =  (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[\(\*SuperscriptBox[\(x\), SubscriptBox[\(i\), \(1\)]] \(\*SubscriptBox[\(i\), \(1\)]!\) \(\((2\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\), \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(1\), \(2\)]\\ \\ \(\((3\\ \*SubscriptBox[\(i\), \(1\)])\)!\) \(\((4\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\)\)]\) (∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[SuperscriptBox[\(y\), SubscriptBox[\(i\), \(2\)]], \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(2\), \(3\)]\)]\) ,

BS[2,3, {x,y}, { {{1,2},{}} , {{},{3,2}} }, N] =  (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[\(\*SuperscriptBox[\(x\), SubscriptBox[\(i\), \(1\)]] \(\*SubscriptBox[\(i\), \(1\)]!\) \(\((2\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\), \(\(\\ \\ \)\*SubsuperscriptBox[\(i\), \(1\), \(2\)]\(\\ \\ \)\)]\) (∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[SuperscriptBox[\(y\), SubscriptBox[\(i\), \(2\)]], \(\(\\ \\ \)\(\*SubsuperscriptBox[\(i\), \(2\), \(3\)]\(\\ \)\(\((3\\ \*SubscriptBox[\(i\), \(2\)])\)!\) \(\((2 \*SubscriptBox[\(i\), \(2\)])\)!\)\(\\ \)\)\)]\) .

If all of the lists {(Subscript[j, l, 1]),...(Subscript[j, l, (Subscript[r, l])])} and {(Subscript[k, l, 1]),...(Subscript[k, l, (Subscript[s, l])])} are empty, then the binomial sum reduces to a standard harmonic sum, i.e.

BS[(Subscript[m, 1]),...,(Subscript[m, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},{ {{},{}},...,{{},{}} },N] = S[(Subscript[m, 1]),...,(Subscript[m, n]),{(Subscript[x, 1]),...,(Subscript[x, n])},N] .

BS also allows for cyclotomy, i.e., instead of the indices (Subscript[m, 1]),...,(Subscript[m, n]), we can have lists of indices of the form {{(Subscript[a, 1]),(Subscript[b, 1]),(Subscript[c, 1])},...,{(Subscript[a, n]),(Subscript[b, n]),(Subscript[c, n])}}. For example,

BS[{{1,2,3},{3,2,2}},{x,y},{{{2,1},{3,4}},{{1,1},{5}}},N] =  (∑_((Subscript[i, 1]) = 1)^N)\!\(\*FractionBox[\(\*SuperscriptBox[\(x\), SubscriptBox[\(i\), \(1\)]] \(\*SubscriptBox[\(i\), \(1\)]!\) \(\((2\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\), \(\(\\ \)\(\*SuperscriptBox[\((\*SubscriptBox[\(i\), \(1\)] + 2)\), \(3\)] \(\((3\\ \*SubscriptBox[\(i\), \(1\)])\)!\) \(\((4\\ \*SubscriptBox[\(i\), \(1\)])\)!\)\)\)]\) (∑_((Subscript[i, 2]) = 1)^(Subscript[i, 1]))\!\(\*FractionBox[\(\*SuperscriptBox[\(y\), SubscriptBox[\(i\), \(2\)]] \*SuperscriptBox[\((\(\*SubscriptBox[\(i\), \(2\)]!\))\), \(2\)]\), \(\(\\ \\ \)\(\*SuperscriptBox[\((3 \*SubscriptBox[\(i\), \(2\)] + 2)\), \(2\)] \(\((5 \*SubscriptBox[\(i\), \(2\)])\)!\)\)\)]\) .";

SToBS::usage="Converts S-sums into the form of BS-sums. Example:

In[1]:= SToBS[S[1,1,n]+2*S[2,-1,1,n]]
Out[1]:= BS[{{1,0,1},{1,0,1}},{1,1},{{{},{}},{{},{}}},n]+2 BS[{{1,0,2},{1,0,1},{1,0,1}},{1,-1,1},{{{},{}},{{},{}},{{},{}}},n]";

BSToS::usage="BSToS rewrites BS[_,_,_,_] in terms of S[__,_] as far as possible. Examples:

In[1]:= BS[{{1,0,2}},{x},{{{},{}}},n] // BSToS
Out[1]:= S[2,{x},n]

In[2]:= BS[{{1,0,1}},{x},{{{},{}}},n]+BS[{{1,0,2},{2,0,3}},{x,y},{{{},{}}},n] //BSToS
Out[2]:= S[1,{x},n]+(1/8) S[2,3,{x,y},n]

The result can also be given in terms of cyclotomic sums:

In[3]:= BS[{{1,0,1},{1,0,2},{2,1,-1}},{x,y,z},{{{},{}},{{},{}},{{},{}}},n] //BSToS
Out[3]:= CS[{{1,0,1},{1,0,2},{2,1,-1}},{x,y,z},n]";

BSCancel::usage="BSCancel[expr] eliminates common indices in binomial sums leading to common factors in the numerator and denominators of the summands. Example:

In[1]:= BSCancel[ BS[2,3, {x,y}, { {{1,2},{2,4}} , {{},{}} }, N] + BS[2,3, {x,y}, { {{1,2},{2,4}} , {{3,1},{3,3}} }, N] ]
Out[1]:= BS[2,3,{x,y},{{{1},{4}},{{},{}}},N]+BS[2,3,{x,y},{{{1},{4}},{{1},{3}}},N]";


BSForwardIndex::usage="BSForwardIndex[expr_,c_] tries to move the index c of the BS-sums in expr to the front. Example:

In[1]:= BSForwardIndex[BS[{{1,0,1},{1,0,2}},{1,x},{{{},{}},{{2},{1,1}}},n],{{1,0,2},x,{{2},{1,1}}}]
Out[1]:= BS[{{1,0,1}},{1},{{{},{}}},n] BS[{{1,0,2}},{x},{{{2},{1,1}}},n]+BS[{{1,0,3}},{x},{{{2},{1,1}}},n]-BS[{{1,0,2},{1,0,1}},{x,1},{{{2},{1,1}},{{},{}}},n]

Notice that the index has to be consistent with the BS-sums provided. In the example, the index {1,0,2} is associated with x and with {{2},{1,1}}, so we request to move the index {{1,0,1},x,{{2},{1,1}}}.";

BSBackwardIndex::usage="BSBackwardIndex[expr_,c_] tries to move the index c of the BS-sums in expr to the end. Example:

In[1]:= BSBackwardIndex[BS[{{1,0,1},{1,0,2}},{x,1},{{{2},{1,1}},{{},{}}},n], {{1,0,1},x,{{2},{1,1}}}]
Out[1]:= BS[{{1,0,1}},{x},{{{2},{1,1}}},n] BS[{{1,0,2}},{1},{{{},{}}},n]+BS[{{1,0,3}},{x},{{{2},{1,1}}},n]-BS[{{1,0,2},{1,0,1}},{1,x},{{{},{}},{{2},{1,1}}},n]

Notice that the index has to be consistent with the BS-sums provided. In the example, the index {1,0,1} is associated with x and with {{2},{1,1}}, so we request to move the index {{1,0,1},x,{{2},{1,1}}}.";

Hw::usage="Hw[(Subscript[f, (Subscript[n, i])]),...(Subscript[f, (Subscript[n, k])]),x] with (Subscript[n, i])∈{0,-1,1,-2,2,(Subscript[w, 1]),...(Subscript[w, 32])} is a type of generalized iterated integral, where the possible letters are restricted to the set

(Subscript[f, 0])[x]=(1/x),  (Subscript[f, -1])[x]=(1/(1 + x)),  (Subscript[f, 1])[x]=(1/(1 - x)),  (Subscript[f, -2])[x]=(1/(2 + x)),  (Subscript[f, 2])[x]=(1/(2 - x)),  (Subscript[f, r2])[x]=(1/(x - 1/2)),  (Subscript[f, mr2])[x]=(1/(x + 1/2)),  (Subscript[f, r4])[x]=(1/(x - 1/4)),  (Subscript[f, mr4])[x]=(1/(x + 1/4)),  (Subscript[f, (Subscript[w, 1])])[x]=(1/((Sqrt[x]) (Sqrt[1 - x]))),..., (Subscript[f, (Subscript[w, 32])])[x]=(1/((1 - x) (Sqrt[x]) (Sqrt[8 + x]))) .
Type '?(Subscript[f, (Subscript[w, i])])' for the definition of the remaining letters.";

HwExpansion::usage="HwExpansion[expr_, x_, n_, m_] calculates the expansion of Integrate[x^n*expr, {x, 0, 1}] with respect to n about infinity up to order m.
Example:

In[1]:= HwExpansion[1/(1+x), x, n, 4]
Out[1]:= \!\(\*FractionBox[\(1\), \(8\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(1\), \(4\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ n\)]\)";

HwToS::usage="Expresses Hw functions in terms of S-sums. Example:

In[1]:= HwToS[Hw[f1,fw2,x],x]
Out[1]:= -x Hw[fw2,0]+Hw[f1,fw2,0]+(Underoverscript[(∑^(.)), ((Subscript[ο, 1]) = 2), ∞])-\!\(\*FractionBox[\(\*SuperscriptBox[\(x\), SubscriptBox[\(ο\), \(1\)]]\\ Hw[fw2, 0]\), SubscriptBox[\(ο\), \(1\)]]\)+(Underoverscript[(∑^(.)), ((Subscript[ο, 1]) = 2), ∞])\!\(\*SuperscriptBox[\(x\), \(\*FractionBox[\(1\), \(2\)]\\ \((\(-1\) + 2\\ \*SubscriptBox[\(ο\), \(1\)])\)\)]\) (\!\(\*FractionBox[\(4\\ \((\*UnderoverscriptBox[SuperscriptBox[\(∑\), \(.\)], \(\*SubscriptBox[\(ι\), \(1\)] = 1\), SubscriptBox[\(ο\), \(1\)]]\*FractionBox[\(\*UnderoverscriptBox[SuperscriptBox[\(∏\), \(.\)], \(\*SubscriptBox[\(ι\), \(2\)] = 1\), SubscriptBox[\(ι\), \(1\)]]\((\*FractionBox[\(1 - 2\\ \*SubscriptBox[\(ι\), \(2\)]\), \(2\\ \*SubscriptBox[\(ι\), \(2\)]\)])\)\), SuperscriptBox[\((\(-1\) + 2\\ \*SubscriptBox[\(ι\), \(1\)])\), \(2\)]])\)\), \(1 - 2\\ \*SubscriptBox[\(ο\), \(1\)]\)]\)+\!\(\*FractionBox[\(4\\ \((\*UnderoverscriptBox[SuperscriptBox[\(∑\), \(.\)], \(\*SubscriptBox[\(ι\), \(1\)] = 1\), SubscriptBox[\(ο\), \(1\)]]\*FractionBox[\(\*UnderoverscriptBox[SuperscriptBox[\(∏\), \(.\)], \(\*SubscriptBox[\(ι\), \(2\)] = 1\), SubscriptBox[\(ι\), \(1\)]]\((\*FractionBox[\(1 - 2\\ \*SubscriptBox[\(ι\), \(2\)]\), \(2\\ \*SubscriptBox[\(ι\), \(2\)]\)])\)\), \(\(-1\) + 2\\ \*SubscriptBox[\(ι\), \(1\)]\)])\)\), \(1 - 2\\ \*SubscriptBox[\(ο\), \(1\)]\)]\)+\!\(\*FractionBox[\(8\\ \((\*UnderoverscriptBox[SuperscriptBox[\(∏\), \(.\)], \(\*SubscriptBox[\(ι\), \(1\)] = 1\), SubscriptBox[\(ο\), \(1\)]]\((\*FractionBox[\(1 - 2\\ \*SubscriptBox[\(ι\), \(1\)]\), \(2\\ \*SubscriptBox[\(ι\), \(1\)]\)])\))\)\\ \*SubscriptBox[\(ο\), \(1\)]\), SuperscriptBox[\((\(-1\) + 2\\ \*SubscriptBox[\(ο\), \(1\)])\), \(3\)]]\))";

ReduceToBSBasis::usage="ReduceToBSBasis[expr,n] uses the quasi shuffle algebra to reduce BS[_,n] to a basis. In addition, relations between letters are removed. Example:

In[1]:= ReduceToBSBasis[BS[{{1,0,1},{1,0,1}},{1,1},{{{2},{1,1}},{{2},{1,1}}},n]+S[1,1,1,n],n]
Out[1]:= (1/2) BS[{{1,0,1}},{1},{{{2},{1,1}}},n]^2+(1/2) BS[{{1,0,2}},{1},{{{2,2},{1,1,1,1}}},n]+(1/6) S[1,n]^3+(1/2) S[1,n] S[2,n]+(1/3) S[3,n]";

KeepLetters::usage="";

KeepBSSums::usage="";

f0::usage="f0[x_]:=1/x.";

f1::usage="f1[x_]:=1/(1-x).";

f2::usage="f2[x_]:=1/(2-x).";

fm1::usage="fm1[x_]:=1/(1+x).";

fm2::usage="fm2[x_]:=1/(2+x).";

fw1::usage="fw1[x_]:=1/Sqrt[x (1-x)].";

fw2::usage="fw2[x_]:=1/Sqrt[x (1+x)].";

fw3::usage="fw3[x_]:=1/(x Sqrt[1-x]).";

fw4::usage="fw4[x_]:=1/(x Sqrt[1+x]).";

fw5::usage="fw5[x_]:=1/Sqrt[(1+x) (2+x)].";

fw6::usage="fw6[x_]:=1/Sqrt[(1-x) (2-x)].";

fw7::usage="fw7[x_]:=1/Sqrt[(1-x) (2+x)].";

fw8::usage="fw8[x_]:=1/(x Sqrt[x-1/4]).";

fw9::usage="fw9[x_]:=1/((1-x) Sqrt[x]).";

fw10::usage="fw10[x_]:=1/(x Sqrt[2-x]).";

fw11::usage="fw11[x_]:=1/(x Sqrt[(1-x) (2-x)]).";

fw12::usage="fw12[x_]:=1/Sqrt[x (8-x)].";

fw13::usage="fw13[x_]:=1/((2-x) Sqrt[x (8-x)]).";

fw14::usage="fw14[x_]:=1/(x Sqrt[x+1/4]).";

fw15::usage="fw15[x_]:=1/(x Sqrt[(1+x) (2+x)]).";

fw16::usage="fw16[x_]:=1/(x Sqrt[2+x]).";

fw17::usage="fw17[x_]:=1/Sqrt[x (8+x)].";

fw18::usage="fw18[x_]:=1/((2+x) Sqrt[x (8+x)]).";

fw19::usage="fw19[x_]:=1/Sqrt[x (4-x)].";

fw20::usage="fw20[x_]:=1/Sqrt[x (4+x)].";

fw21::usage="fw21[x_]:=1/Sqrt[(4+x) (8+x)].";

fw22::usage="fw22[x_]:=1/((2+x) Sqrt[x-1/4]).";

fw23::usage="fw23[x_]:=1/((1+x) Sqrt[x (4+x)]).";

fw24::usage="fw24[x_]:=1/((2-x) Sqrt[x+1/4]).";

fw25::usage="fw25[x_]:=1/Sqrt[(4-x) (8-x)].";

fw26::usage="fw26[x_]:=1/((1-x) Sqrt[x (4-x)]).";

fw27::usage="fw27[x_]:=1/((x+1/2) Sqrt[x (4-x)]).";

fw28::usage="fw28[x_]:=1/(x Sqrt[x+1/8]).";

fmr2::usage="fmr2[x_]:=1/(1/2+x).";

fr2::usage="fr2[x_]:=1/(x-1/2).";

fmr4::usage="fmr4[x_]:=1/(1/4+x).";

fr4::usage="fr4[x_]:=1/(x-1/4).";

(**********)

VarGL::usage="VarGL represents the integration Variable in GL[_,_].";

GLIntegrate::usage="GLIntegrate[expr,x] computes the anti derivative of expr with respect to x. It also works with boundaries, GLIntegrate[expr,{x,a,b}].
Examples:

In[1]:= GLIntegrate[1/x,x]
Out[1]:= GL[{1/VarGL},x]

In[2]:= GLIntegrate[(1+(x^2)+2 (x^3))/(1+(x^4)),x]
Out[2]:= GL[{1/(1+(VarGL^4))},x]+GL[{(VarGL^2)/(1+(VarGL^4))},x]+2 GL[{(VarGL^3)/(1+(VarGL^4))},x]

In[3]:= GLIntegrate[GL[{1/VarGL},x]/(1-x),x]
Out[3]:= GL[{1/(1-VarGL),1/VarGL},x]

In[4]:= GLIntegrate[GL[{1/(1-VarGL)},x](1+(x^2))/(1+(x^4)),x]
Out[4]:= GL[{1/(1+(VarGL^4)),1/(1-VarGL)},x]+GL[{(VarGL^2)/(1+(VarGL^4)),1/(1-VarGL)},x]";

GLToS::usage="Expresses GL functions in terms of harmonic sums or cyclotomic harmonic sums. Examples:

In[1]:= GLToS[GL[{1/(1-VarGL),1/(1+VarGL)},x],x]
Out[1]:= (x^2)/2+(Underoverscript[(∑^(.)), ((Subscript[ο, 1]) = 3), ∞])((x^(Subscript[ο, 1])) ((Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 2), (Subscript[ο, 1])])(-1)^(Underscript[(Subscript[ι, 1]), .])/(-1+(Subscript[ι, 1]))))/(Subscript[ο, 1])

In[2]:= GLToS[GL[{1/(1-VarGL),1/√(1+VarGL)},x],x]
Out[2]:= (x^2)/2+(Underoverscript[(∑^(.)), ((Subscript[ο, 1]) = 3), ∞])(x^(Subscript[ο, 1])) (-((2 ((Underoverscript[(∑^(.)), ((Subscript[ι, 1]) = 1), (Subscript[ο, 1])])((Underoverscript[(∏^(.)), ((Subscript[ι, 2]) = 1), (Subscript[ι, 1])])((1-2 (Subscript[ι, 2]))/(2 (Subscript[ι, 2]))))/(-1+2 (Subscript[ι, 1]))))/(Subscript[ο, 1]))+(2 (Underoverscript[(∏^(.)), ((Subscript[ι, 1]) = 1), (Subscript[ο, 1])])((1-2 (Subscript[ι, 1]))/(2 (Subscript[ι, 1]))))/((Subscript[ο, 1]) (-1+2 (Subscript[ο, 1]))))";

GLToStandardForm::usage="GLToStandardForm[expr] tries to rewrite the letters of GL[_,_] in a 'standard form'. Examples:

In[1]:= GL[{\!\(\*FractionBox[\(1\), \(\*SqrtBox[\(VarGL\)] \*SqrtBox[\(1 - \\ VarGL\)]\)]\)},x] // GLToStandardForm
Out[1]:= 2 (Sqrt[1 - x]) (Sqrt[x])-4 (Sqrt[1 - x]) (x^(3/2))+8 GL[{(Sqrt[1 - VarGL]) (Sqrt[VarGL])},x]

Notice that the letters of the GL function in the output has square roots only in the numerator. This is what is meant by 'standard form, and it is the aim whenever possible.

In[2]:= GL[{(1/((Sqrt[1 - VarGL]) (1 + VarGL)^(1/3))),(1/((Sqrt[1 - VarGL]) (Sqrt[2 + VarGL])))},x] // GLToStandardForm
Out[2]:= -\!\(\*FractionBox[\(23\), \(18\\ \*SqrtBox[\(2\)]\)]\)-\!\(\*FractionBox[\(\*SqrtBox[\(1 - x\)] \*SuperscriptBox[\((1 + x)\), \(2/3\)]\), \(18\\ \*SqrtBox[\(2\)]\)]\)-\!\(\*FractionBox[\(7\\ \*SqrtBox[\(1 - x\)]\\ x\\ \*SuperscriptBox[\((1 + x)\), \(2/3\)]\), \(18\\ \*SqrtBox[\(2\)]\)]\)+(2/3) (1+x)^(2/3) (Sqrt[2 + x])+(x/3) (1+x)^(2/3) (Sqrt[2 + x])+\!\(\*FractionBox[\(91\), \(108\\ \*SqrtBox[\(2\)]\)]\) GL[{(Sqrt[1 - VarGL]) (1+VarGL)^(2/3)},x]-(1/9) (Sqrt[1 - x]) (1+x)^(2/3) GL[{(Sqrt[1 - VarGL]) (Sqrt[2 + VarGL])},x]-(7/9) (Sqrt[1 - x]) x (1+x)^(2/3) GL[{(Sqrt[1 - VarGL]) (Sqrt[2 + VarGL])},x]-(19/18) GL[{(1+VarGL)^(2/3) (Sqrt[2 + VarGL])},x]+(2/3) GL[{VarGL (1+VarGL)^(2/3) (Sqrt[2 + VarGL])},x]-(7/9) GL[{(VarGL^2) (1+VarGL)^(2/3)\!\(\*SqrtBox[\(\(\\ \)\(2 + VarGL\)\)]\)},x]+(91/54) GL[{(Sqrt[1 - VarGL]) (1+VarGL)^(2/3),(Sqrt[1 - VarGL]) (Sqrt[2 + VarGL])},x]

If it is not possible to put all the square roots in the numerator of the letters, it still tries to do it as much as possible: 

In[3]:= GL[{\!\(\*FractionBox[\(1\), \(\*SqrtBox[\(1 - VarGL\)]\\ \*SuperscriptBox[\((1 + VarGL)\), \(1/3\)] \*SqrtBox[\(2 + VarGL\)]\)]\)},x] // GLToStandardForm
Out[3]:= -(1/3) GL[{\!\(\*FractionBox[\(\*SqrtBox[\(\(1\)\(-\)\(VarGL\)\(\\ \)\)] \*SuperscriptBox[\((1 + VarGL)\), \(2/3\)]\), SqrtBox[\(2 + VarGL\)]]\)},x]+(1/2) GL[{\!\(\*FractionBox[\(\*SqrtBox[\(\(1\)\(-\)\(VarGL\)\(\\ \)\)] \*SqrtBox[\(2 + VarGL\)]\), SuperscriptBox[\((1 + VarGL)\), \(1/3\)]]\)},x]+(1/6) GL[{\!\(\*FractionBox[\(\*SuperscriptBox[\((1 + VarGL)\), \(2/3\)]\\ \*SqrtBox[\(2 + VarGL\)]\), SqrtBox[\(1 - VarGL\)]]\)},x]";

GLLetterExpand::usage="GLLetterExpand[expr] expands the letters of all GL[_,_]. Examples:

In[1]:= GLLetterExpand[GL[{(1+VarGL)^3},x]]
Out[1]:= GL[{1},x]+GL[{3 VarGL},x]+GL[{3 (VarGL^2)},x]+GL[{(VarGL^3)},x]

In[2]:= GLLetterExpand[GL[{(1+VarGL)/(1-VarGL)^(1/2)},x]]
Out[2]:= -GL[{(Sqrt[1 - VarGL])},x]+2 GL[{(1/(Sqrt[1 - VarGL]))},x]";

HExpansion::usage = "HExpansion[expr_, x_, n_, m_] calculates the expansion of Integrate[x^n*expr, {x, 0, 1}] with respect to n about infinity up to order m. It works well when expr involves H functions. Examples:

In[1]:= HExpansion[H[-1,x],x,n,7]
Out[1]:= ln2 ((1/(n^7))-(1/(n^6))+(1/(n^5))-(1/(n^4))+(1/(n^3))-(1/(n^2))+(1/n))+\!\(\*FractionBox[\(41\), \(8\\ \*SuperscriptBox[\(n\), \(7\)]\)]\)-\!\(\*FractionBox[\(35\), \(8\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(27\), \(8\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)-\!\(\*FractionBox[\(9\), \(4\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(5\), \(4\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)-\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)

In[2]:= HExpansion[H[0,-1,x],x,n,7]
Out[2]:= ln2 ((6/(n^7))-(5/(n^6))+(4/(n^5))-(3/(n^4))+(2/(n^3))-(1/(n^2)))+\!\(\*FractionBox[\(47\), \(4\\ \*SuperscriptBox[\(n\), \(7\)]\)]\)-\!\(\*FractionBox[\(59\), \(8\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+(4/(n^5))-\!\(\*FractionBox[\(7\), \(4\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+(\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(7\)]\)]\)-\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)-\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)-\!\(\*FractionBox[\(1\), \(2\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ n\)]\)) z2

In[3]:= HExpansion[H[-1,0,-1,-1,x],x,n,4]
Out[3]:= (ln2^4) (-\!\(\*FractionBox[\(1\), \(8\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(1\), \(8\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)-\!\(\*FractionBox[\(1\), \(8\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+\!\(\*FractionBox[\(1\), \(8\\ n\)]\))+li4half (-(3/(n^4))+(3/(n^3))-(3/(n^2))+(3/n))+(\!\(\*FractionBox[\(6\), \(5\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(6\), \(5\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+\!\(\*FractionBox[\(6\), \(5\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)-\!\(\*FractionBox[\(6\), \(5\\ n\)]\)) (z2^2)+(ln2^2) (-(1/(n^4))+\!\(\*FractionBox[\(1\), \(4\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+(\!\(\*FractionBox[\(3\), \(4\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(3\), \(4\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+\!\(\*FractionBox[\(3\), \(4\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)-(3/n)) z2)+(-\!\(\*FractionBox[\(9\), \(32\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(5\), \(32\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)-\!\(\*FractionBox[\(1\), \(16\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)) z3+ln2 (-\!\(\*FractionBox[\(1\), \(4\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+(-\!\(\*FractionBox[\(11\), \(4\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(11\), \(4\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)-\!\(\*FractionBox[\(11\), \(4\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+\!\(\*FractionBox[\(11\), \(4\\ n\)]\)) z3)";

GLExpansion::usage="GLExpansion[expr_, x_, n_, m_] calculates the expansion of Integrate[x^n*expr, {x, 0, 1}] with respect to n about infinity up to order m. It works well when expr involves GL functions. Examples:

In[1]:= GLExpansion[GL[{1/(1-VarGL)},x],x,n,5]
Out[1]:= (((3/2) - LG[n])/(n^2))+(((43/12) - LG[n])/(n^4))+((-(183/40) + LG[n])/(n^5))+((-(31/12) + LG[n])/(n^3))+((LG[n])/n)

In[2]:= GLExpansion[GL[{1/VarGL,1/(1-VarGL)},x],x,n,5] // Collect[#,{GL[__,1],LG[n]},Expand]&
Out[2]:= -\!\(\*FractionBox[\(23\), \(3\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)+\!\(\*FractionBox[\(49\), \(12\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(3\), \(2\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+((1/(n^5))-(1/(n^4))+(1/(n^3))-(1/(n^2))+(1/n)) GL[{(1/VarGL),(1/(1 - VarGL))},1]+((4/(n^5))-(3/(n^4))+(2/(n^3))-(1/(n^2))) LG[n]

In[3]:= GLExpansion[GL[{1/VarGL,1/(Sqrt[1 - VarGL])},x],x,n,5] // Collect[#,{GL[__,1],LG[n]},Expand]&
Out[3]:= (8/(n^5))-(6/(n^4))+(4/(n^3))-(2/(n^2))+\!\(\*FractionBox[\(753\\ \*SqrtBox[\(π\)]\), \(128\\ \*SuperscriptBox[\(n\), \(9/2\)]\)]\)-\!\(\*FractionBox[\(23\\ \*SqrtBox[\(π\)]\), \(8\\ \*SuperscriptBox[\(n\), \(7/2\)]\)]\)+((Sqrt[π])/(n^(5/2)))+(-(2/(n^5))+(2/(n^4))-(2/(n^3))+(2/(n^2))-(2/n)) GL[{((Sqrt[1 - VarGL])/VarGL)},1]";

SExpansion::usage="SExpansion[expr_,n_,ord_] calculates the expansion of an expr involing S-sums with respect to n about infinity up to order m. Example:

In[1]:= SExpansion[S[1,1,n],n,6]
Out[1]:= -\!\(\*FractionBox[\(1\), \(1440\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(1\), \(48\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)+\!\(\*FractionBox[\(1\), \(288\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(1\), \(8\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+\!\(\*FractionBox[\(3\), \(8\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)-\!\(\*FractionBox[\(1\), \(2\\ n\)]\)+(z2/2)+(-\!\(\*FractionBox[\(1\), \(252\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(1\), \(120\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(1\), \(12\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ n\)]\)) LG[n]+(((LG[n])^2)/2)";

BSExpansion::usage="BSExpansion[expr_,n_,ord_] calculates the expansion of an expr involving BS-sums with respect to n about infinity up to order m. Examples: 

In[1]:= BSExpansion[BS[{{1,0,1},{1,0,1}},{1,1},{{{},{}},{{},{}}},n],n,6]
Out[1]:= -\!\(\*FractionBox[\(1\), \(504\\ \*SuperscriptBox[\(n\), \(7\)]\)]\)-\!\(\*FractionBox[\(1\), \(1440\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(1\), \(48\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)+\!\(\*FractionBox[\(1\), \(288\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(1\), \(8\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+\!\(\*FractionBox[\(3\), \(8\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)-\!\(\*FractionBox[\(1\), \(2\\ n\)]\)+((π^2)/12)+(-\!\(\*FractionBox[\(1\), \(252\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(1\), \(120\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(1\), \(12\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+\!\(\*FractionBox[\(1\), \(2\\ n\)]\)) LG[n]+(((LG[n])^2)/2)

In[2]:= BSExpansion[BS[{{1,0,1},{1,0,1}},{1,1},{{{1,1},{2}},{{},{}}},n],n,6]
Out[2]:= (8/3) GL[{((Sqrt[1 - VarGL])/(4 - VarGL))},1]-(1/3) GL[{((Sqrt[1 - VarGL])/(4 - VarGL)),(1/(4 - VarGL))},1]+GL[{((Sqrt[1 - VarGL])/VarGL),(1/(4 - VarGL))},1]+\!\(\*SuperscriptBox[\(2\), \(\(-2\)\\ n\)]\) (Sqrt[n]) (Sqrt[(π/4)]) (\!\(\*FractionBox[\(1016108058869\), \(13377208320\\ \*SuperscriptBox[\(n\), \(7\)]\)]\)-\!\(\*FractionBox[\(1483944607\), \(79626240\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)+\!\(\*FractionBox[\(13823533\), \(2488320\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)-\!\(\*FractionBox[\(43451\), \(20736\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)+\!\(\*FractionBox[\(443\), \(432\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)-\!\(\*FractionBox[\(11\), \(18\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)+(-\!\(\*FractionBox[\(3812376007\), \(339738624\\ \*SuperscriptBox[\(n\), \(7\)]\)]\)+\!\(\*FractionBox[\(20012041\), \(7077888\\ \*SuperscriptBox[\(n\), \(6\)]\)]\)-\!\(\*FractionBox[\(2308873\), \(2654208\\ \*SuperscriptBox[\(n\), \(5\)]\)]\)+\!\(\*FractionBox[\(9565\), \(27648\\ \*SuperscriptBox[\(n\), \(4\)]\)]\)-\!\(\*FractionBox[\(227\), \(1152\\ \*SuperscriptBox[\(n\), \(3\)]\)]\)+\!\(\*FractionBox[\(13\), \(72\\ \*SuperscriptBox[\(n\), \(2\)]\)]\)-\!\(\*FractionBox[\(1\), \(3\\ n\)]\)) LG[n])";

AsymptoticExpansionTest::usage="AsymptoticExpansionTest[expr_,expan_,n_,ord_Integer,opts___Rule]";

MellinG::usage="MellinG[expr_,x_,n_] uses rewrite rules to try to compute the Mellin transform of expr";

ReduceToGLBasis::usage="ReduceToGLBasis[expr,x] uses the shuffle algebra to reduce GL[_,x] to a basis. Example:

In[1]:= ReduceToGLBasis[GL[{(1/(1 - VarGL)),(1/(1 - VarGL))},x]+GL[{(1/(1 + VarGL)),(1/(1 - VarGL))},x],x]
Out[1]:= (1/2) GL[{(1/(1 - VarGL))},x]^2+GL[{(1/(1 + VarGL)),(1/(1 - VarGL))},x]";

ReduceToGLbBasis::usage="ReduceToGLBasis[expr,x] uses the shuffle algebra to reduce GLb[_,x] to a basis. Example:

In[1]:= ReduceToGLbBasis[GLb[{(1/(1 - VarGL)),(1/(1 - VarGL))},x]+GLb[{(1/(1 + VarGL)),(1/(1 - VarGL))},x],x]
Out[1]:= (1/2) GLb[{(1/(1 - VarGL))},x]^2+GLb[{(1/(1 + VarGL)),(1/(1 - VarGL))},x]";

BSToGL::usage="BSToGL[expr_,x_,opts___Rule] uses rewrite rules to find integral representations of binomial sums at infinity. Examples:

In[1]:= BSToGL[BS[{{1,0,2}},{x},{{{2},{1,1}}},∞],x]
Out[1]:= -2 GL[{\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\)},x]+GL[{(1/VarGL),\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\)},x]

In[2]:= BSToGL[BS[{{1,0,1},{1,0,1}},{x,1},{{{2},{1,1}},{{},{}}},∞],x]
Out[2]:=8 x+2 \!\(\*SqrtBox[\(1 - 4\\ x\)]\) GL[{\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\)},x]-GL[{(1/VarGL),\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\)},x]+4 GL[{\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\),\!\(\*FractionBox[\(1\), \(1 - 4\\ VarGL\)]\)},x]-GL[{\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\),\!\(\*FractionBox[\(\(-1\) + \*SqrtBox[\(1 - 4\\ VarGL\)]\), \(VarGL\)]\)},x]-2 \!\(\*SqrtBox[\(1 - 4\\ x\)]\) H[1/4,x]+H[0,1/4,x]";

BinomialSumToGL::usage="BinomialSumToGL[f[n],x,{n,a,Infinity}] tries to find a closed form representation of Sum[f[n]*x^n,{n,a,Infinity}], by using the rewrite rules of BSToGL. Examples:

In[1]:= BinomialSumToGL[1/(2 n+3)^2,x,{n,1,Infinity}]
Out[1]:= -(1/9)+\!\(\*FractionBox[\(1\), \(4\\ \*SuperscriptBox[\(x\), \(3/2\)]\)]\) GL[{(1/VarGL),((Sqrt[VarGL])/(1 - VarGL))},x]

In[2]:= BinomialSumToGL[n!^2/(2*n)!/n,x,{n,1,Infinity}]
Out[2]:= (1/4) (2-x) x+\!\(\*FractionBox[SqrtBox[\(x\)], \(2\\ \*SqrtBox[\(4 - x\)]\)]\)GL[{(Sqrt[4 - VarGL]) (Sqrt[VarGL]))},x]";

PochhammerSumToGL::usage="Given Pochhammer[p,n]/(a*n+b)^c/(n+d)!*innersum[n] (a,b,c,g∈Integers, c>=0, innersum=1 or S[m__,n] or CS[m__,n]) PochhammerSumToGL[Pochhammer[p,n]/(a*n+b)^c/(n+d)!*innersum[n],x,{n,g,Infinity}] or PochhammerSumToGL[p,a,b,c,d,innersum[n],x,{n,g,Infinity}] tries to find a closed form representation of Sum[Pochhammer[p,n]/(a*n+b)^c/(n+d)!*innersum[n]x^n,{n,g,Infinity}] in terms of GL[_,x], by using rewrite rules. Example:

In[1]:= PochhammerSumToGL[((Pochhammer[-(1/2), n] S[1, n])/((n + 3)^2 (n - 1)!)),x,{n,1,∞}]
Out[1]:= \!\(\*FractionBox[\(1\), \(7350\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)(-1776+1776 (Sqrt[1 - x])+808 x-888 (Sqrt[1 - x]) x-319 (x^2)-888 (Sqrt[1 - x]) (x^2)-888 (x^3)-600 (x^4))+\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)2 (-404 (Sqrt[1 - x])+218 (Sqrt[1 - x]) x+111 (Sqrt[1 - x]) (x^2)+75 (Sqrt[1 - x]) (x^3)) GL[{(1/(1 - VarGL))},x]+\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)2 (-1664-404 (Sqrt[1 - x])+218 (Sqrt[1 - x]) x+111 (Sqrt[1 - x]) (x^2)+75 (Sqrt[1 - x]) (x^3)) GL[{(1/VarGL)},x]-\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)2 (-1664-404 (Sqrt[1 - x])+218 (Sqrt[1 - x]) x+111 (Sqrt[1 - x]) (x^2)+75 (Sqrt[1 - x]) (x^3)) GL[{((Sqrt[1 - VarGL])/VarGL)},x]+\!\(\*FractionBox[\(16\\ GL[{\*FractionBox[\(1\), \(VarGL\)], \*FractionBox[\(1\), \(VarGL\)]}, x]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)-\!\(\*FractionBox[\(16\\ GL[{\*FractionBox[\(1\), \(VarGL\)], \*FractionBox[SqrtBox[\(1 - VarGL\)], \(VarGL\)]}, x]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)+\!\(\*FractionBox[\(16\\ GL[{\*FractionBox[SqrtBox[\(1 - VarGL\)], \(VarGL\)], \*FractionBox[\(1\), \(1 - VarGL\)]}, x]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)+\!\(\*FractionBox[\(16\\ GL[{\*FractionBox[SqrtBox[\(1 - VarGL\)], \(VarGL\)], \*FractionBox[\(1\), \(VarGL\)]}, x]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)-\!\(\*FractionBox[\(16\\ GL[{\*FractionBox[SqrtBox[\(1 - VarGL\)], \(VarGL\)], \*FractionBox[SqrtBox[\(1 - VarGL\)], \(VarGL\)]}, x]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)";

PochhammerSumToH::usage="Given Pochhammer[p,n]/(n+b)^c/(n+d)!*S[m__,n] (b,c,d∈Integers, c>=0, innersum=1 or S[m__,n]) PochhammerSumToH[Pochhammer[p,n]/(n^c/(n+d)!*S[m,n],x,{n,g,Infinity}] tries to find a closed form of Sum[Pochhammer[p,n]/n^c/(n+d)!*S[m,n]x^n,{n,g,Infinity}] in terms of H[_,x]. Example:

In[1]:= PochhammerSumToH[((Pochhammer[-1/2, n] S[1, n])/((n + 3)^2 (n - 1)!)),x,{n,1,∞}]
Out[1]:= \!\(\*FractionBox[\(1\), \(7350\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)(11856 (-1+(Sqrt[1 - x]))+8 (319+107 (Sqrt[1 - x])) x+537 (x^2)+600 (-1+(Sqrt[1 - x])) (x^3))+\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)4 (16+1276 (Sqrt[1 - x])+218 (Sqrt[1 - x]) x+111 (Sqrt[1 - x]) (x^2)+75 (Sqrt[1 - x]) (x^3)) H[-1,(Sqrt[1 - x])]-\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)4 (Sqrt[1 - x]) (1276+218 x+111 (x^2)+75 (x^3)) H[0,(Sqrt[1 - x])]+H[0,1] (\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)4 (16+840 I π+1276 (Sqrt[1 - x])+218 (Sqrt[1 - x]) x+111 (Sqrt[1 - x]) (x^2)+75 (Sqrt[1 - x]) (x^3))-\!\(\*FractionBox[\(64\\ H[1, \*SqrtBox[\(1 - x\)]]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\))+H[-1,1] (-\!\(\*FractionBox[\(1\), \(3675\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)4 (16+1276 (Sqrt[1 - x])+218 (Sqrt[1 - x]) x+111 (Sqrt[1 - x]) (x^2)+75 (Sqrt[1 - x]) (x^3))+\!\(\*FractionBox[\(64\\ H[1, \*SqrtBox[\(1 - x\)]]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\))-\!\(\*FractionBox[\(96\\ H[\(-1\), 0, 1]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)+\!\(\*FractionBox[\(32\\ H[\(-1\), 0, \*SqrtBox[\(1 - x\)]]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)-\!\(\*FractionBox[\(64\\ H[\(-1\), 1, 1]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)-\!\(\*FractionBox[\(64\\ H[0, \(-1\), 1]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)-\!\(\*FractionBox[\(64\\ H[0, 0, 1]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)+\!\(\*FractionBox[\(32\\ H[0, 1, 1]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)-\!\(\*FractionBox[\(64\\ H[1, \(-1\), \*SqrtBox[\(1 - x\)]]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)+\!\(\*FractionBox[\(32\\ H[1, 0, \*SqrtBox[\(1 - x\)]]\), \(35\\ \*SuperscriptBox[\(x\), \(3\)]\)]\)";

ComputeGeneratingFunction::usage="Given a hypergeometric sequence f[n], ComputeGeneratingFunction[f[n],x,{n,a,Infinity}] tries to find a closed form representation of Sum[f[n]x^n,{n,a,Infinity}] by using closure properties and DSolve. 
Example:

In[1]:= ComputeGeneratingFunction[S[2,n],x,{n,1,∞}]
Out[1]:= (1/(1 - x)) GL[{(1/VarGL),(1/(1 - VarGL))},x]";

SpecialBSInfToH::usage="SpecialBSInfToH[expr_,x_] expresses special BS-sums evaluated at infinity in terms of H functions in the variable x. Examples:

In[1]:= SpecialBSInfToH[BS[{{1,0,1},{2,1,1}},{1,x},{{{},{}},{{},{}}},∞],x]
Out[1]:= (-GL[{((Sqrt[VarGL]))/(1-VarGL),1/(1-VarGL)},x]+GL[{((Sqrt[VarGL]))/(1-VarGL)},x] S[1,∞])/(2 (Sqrt[x]))

In[2]:= SpecialBSInfToH[BS[{{1,0,1},{1,0,1}},{x,1},{{{2},{1,1}},{{},{}}},∞],x]
Out[2]:= 8 x-4 GL[{1/VarGL,1/(1-4 VarGL)},x]+4 GL[{(\!\(\*SqrtBox[\(1 - 4\\ VarGL\)]\))/VarGL,1/(1-4 VarGL)},x]+GL[{(\!\(\*SqrtBox[\(1 - 4\\ VarGL\)]\))/VarGL,1/VarGL},x]-GL[{(\!\(\*SqrtBox[\(1 - 4\\ VarGL\)]\))/VarGL,(\!\(\*SqrtBox[\(1 - 4\\ VarGL\)]\))/VarGL},x]-2 \!\(\*SqrtBox[\(1 - 4\\ x\)]\) H[1/4,x]+2 \!\(\*SqrtBox[\(1 - 4\\ x\)]\) (GL[{(\!\(\*SqrtBox[\(1 - 4\\ VarGL\)]\))/VarGL},x]+H[{0,0},((Sqrt[x - 4])-(Sqrt[x]))/((Sqrt[x - 4])+(Sqrt[x]))]+2 H[{1,0},1]-2 H[{1,0},((Sqrt[x - 4])-(Sqrt[x]))/((Sqrt[x - 4])+(Sqrt[x]))])+H[0,1/4,x]

In[3]:= SpecialBSInfToH[BS[{{1,0,1},{1,0,1}},{1,x},{{{1,1},{2}},{{},{}}},∞],x]
Out[3]:= (1/4) ((-1+4 BS[{{1,0,1}},{1},{{{1,1},{2}}},∞]) H[1,x]+H[{0,0},((Sqrt[4 - x])+I (Sqrt[x]))/((Sqrt[4 - x])-I (Sqrt[x]))]-H[{6,0},1]+H[{6,0},((Sqrt[4 - x])+I (Sqrt[x]))/((Sqrt[4 - x])-I (Sqrt[x]))]+2 H[{6,1},1]-2 H[{6,1},((Sqrt[4 - x])+I (Sqrt[x]))/((Sqrt[4 - x])-I (Sqrt[x]))]-4 H[{0,0},{0,0},((Sqrt[4 - x])+I (Sqrt[x]))/((Sqrt[4 - x])-I (Sqrt[x]))]-4 H[{6,0},{0,0},1]+4 H[{6,0},{0,0},((Sqrt[4 - x])+I (Sqrt[x]))/((Sqrt[4 - x])-I (Sqrt[x]))])";

SpecialGLToH::usage="Expresses certain special GL with complicated letters entirely in terms of H functions. Example:

In[1]:= SpecialGLToH[GL[{(Sqrt[1 - VarGL])(Sqrt[VarGL]) ,1/VarGL},1]]
Out[1]:= -(1/2) GL[{1/(1-VarGL)},-1] GL[{1/(1+(VarGL^2))},-1]+(1/2) GL[{1/(1-VarGL)},-1] GL[{1/(1+(VarGL^2))},1]+GL[{1/(1+(VarGL^2))},-1] (-(1/8)-(1/2) GL[{VarGL/(1+(VarGL^2))},-1])-GL[{1/(1+(VarGL^2))},1] (-(1/8)-(1/2) GL[{VarGL/(1+(VarGL^2))},-1])+(1/2) GL[{1/(1+(VarGL^2)),1/(1-VarGL)},-1]-(1/2) GL[{1/(1+(VarGL^2)),1/(1-VarGL)},1]+(1/2) GL[{1/(1+(VarGL^2)),VarGL/(1+(VarGL^2))},-1]-(1/2) GL[{1/(1+(VarGL^2)),VarGL/(1+(VarGL^2))},1]

To see the final effect we apply now GLToH:

In[2]:= % // GLToH
Out[2]:= (1/2) H[{1,0},-1] H[{4,0},-1]-(1/2) H[{1,0},-1] H[{4,0},1]+H[{4,0},-1] (-(1/8)-(1/2) H[{4,1},-1])-H[{4,0},1] (-(1/8)-(1/2) H[{4,1},-1])-(1/2) H[{4,0},{1,0},-1]+(1/2) H[{4,0},{1,0},1]+(1/2) H[{4,0},{4,1},-1]-(1/2) H[{4,0},{4,1},1]

The transformation may lead to more complicated arguments:

In[3]:= SpecialGLToH[GL[{(Sqrt[VarGL]) (Sqrt[2 + VarGL]) },x]]
Out[3]:= ((2+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\)) (-x+\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\)) (1+(1+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\))^2))/(8 (1+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\))^2)+(1/2) GL[{(1/VarGL)},1+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\)]

In[4]:= % // GLToH
Out[4]:=((2+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\)) (-x+\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\)) (1+(1+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\))^2))/(8 (1+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\))^2)+(1/2) H[0,1+x-\!\(\*SqrtBox[\(x\\ \((2 + x)\)\)]\)]";

GLRemovePole::usage="GLRemovePole[expr_,p_] removes divergences arising from poles around p in all GL functions in expr. Example:

In[1]:= GLRemovePole[GL[{1/(1/2-VarGL)},x],1/2] // Factor
Out[1]:= -GL[{1/VarGL},-1+2 x]

Notice the transformation of the argument in the output.";

GLRegularize0::usage="GLRegularize0[expr_] regularizes all GL functions in expr around zero. Example:

In[1]:= GLRegularize0[GL[{Sqrt[1-VarGL]/VarGL},x]]
Out[1]:= GL[{(1/VarGL)},x]+GL[{((-1 + (Sqrt[1 - VarGL]))/VarGL)},x]

In this way, all GL functions in the output are well defined as iterated integrals (see also 'GL').";

GLRegularize1::usage="GLRegularize1[expr_] regularizes all GL functions in expr around 1. Example:

In[1]:= GLRegularize1[GL[{Sqrt[VarGL]/(1-VarGL)},x]]
Out[1]:= -GL[{(1/(1 + (Sqrt[VarGL])))},x]+GL[{(1/(1 - VarGL))},x]
In this way, all GL functions in the output are well defined as iterated integrals (see also 'GL').";

GLVariableToArgument::usage="GLVariableToArgument[GL[m,y],x,p],tries to move the variable x to the argument, p is the point where the derivatives are evaluted to compute the constants in the solution of the differential equation.
Examples:

In[1]:= GLVariableToArgument[GL[{1/(1+x*VarGL)},1],x]
Out[1]:= GL[{1/(1+VarGL)},x]/x

In[2]:= GLVariableToArgument[GL[{1/(1+x*VarGL)},1],x,1/2] // Expand
Out[2]:= GL[{1/(1+VarGL/2)},1]/(2 x)-GL[{1/(1+VarGL)},1/2]/x+GL[{1/(1+VarGL)},x]/x";

UseRelations::usage="";


(*****GetCoefficient*****)
GetCoefficient::usage="GetCoefficient[expr_,x_,n_] tries to compute the nth coefficient in the power series expansion of expr around 0 with respect to x. Examples:

In[1]:= GetCoefficient[H[1, x], x, n]
Out[1]:= (1/n)

In[2]:= GetCoefficient[H[-2, x], x, n]
Out[2]:= \!\(\*FractionBox[\(\*SuperscriptBox[\((\(-1\))\), \(1 + n\)]\\ \*SuperscriptBox[\(2\), \(-n\)]\), \(n\)]\)

In[3]:= GetCoefficient[H[-1,1, x]+H[-1,0,1,x], x, n]
Out[3]:= (1/(n^3))+(1/(n^2))+((((-1))^(1 + n))/n) (S[-2,n]+S[-1,n])";

GetMoment::usage="GetMoment[expr_,x_,n_] tries to compute the nth moment of expression expr with respect to x. GetMoment[H[-2, x], x, n]. Examples:

In[1]:= GetMoment[H[1, x], x, n]
Out[1]:= (1/n)

In[2]:= GetMoment[H[-2, x], x, n]
Out[2]:= \!\(\*FractionBox[\(\*SuperscriptBox[\((\(-1\))\), \(1 + n\)]\\ \*SuperscriptBox[\(2\), \(-n\)]\), \(n\)]\)

In[3]:= GetMoment[H[-1,1, x]+H[-1,0,1,x], x, n]
Out[3]:= (1/(n^3))+(1/(n^2))+((((-1))^(1 + n))/n) (S[-2,n]+S[-1,n])";

Begin["`Private`"]

End[]
Protect@@Names["newusagemessages`*"];
EndPackage[]