(*This is an example file for the use of the reduction library gtolrules.m in Mathematica,*)
(*by Hjalte Frellesvig,Damiano Tommasini,and Chris Wever.*)
(*For further details see ArXiv:xxxx.xxxxx.*)
(*Latest Changes: 8th of Jan, 2016*)

(*First import "gtolrules.m"*)
dir=NotebookDirectory[];
<<(dir<>"/gtolrules.m");
(*Now the rules gtolrules, itogrules, thetaback, and logback are defined*)

(*reduce for example the weight three GPL G(a,b,c;x)*)
G[a,b,c,x]/.gtolrules
(*replace MyLog, MyLi, MyH1, MyH2 and MyT*)
%/.logback//.thetaback

(*reduce for example the weight four GPL G(a,b,c,d;x)*)
G[a,b,c,d,x]/.gtolrules
(*replace MyLog, MyLi, MyT, MyH1, MyH2 and MyT*)
%/.logback//.thetaback

(*define point*)
point={a->0.14973911820963232-0.2135866813200692*I,b->0.1094629338907686-0.09349353729916371*I,c->-0.9632069808512039+0.4780369861529716*I,x->0.06932047483023104-0.038222239494253164*I};

(*to evaluate MyLi22 we may define li22back*)
li22back={MyLi22[x1_,x2_]:>NIntegrate[Log[z]*PolyLog[2,x1*x2*z]/(z-(1/x1)),{z,0,1}]};

(*evaluate a GPL with li22back*)
G[a,b,0,c,x]/.point/.gtolrules/.logback//.thetaback/.li22back

(*we can also use the lievaluateinterface Mathlink interface instead to evaluate the basis functions*)
(*SetDirectory[NotebookDirectory[]];
link=Install[Directory[]<>"/"<>"lievaluateinterface"];

G[a,b,0,c,x]/.point/.gtolrules/.{MyLog[x_]:>-Li[1,1-x],MyLi[n_,x_]:>Li[n,x],MyLi22[x1_,x2_]:>Li22[x1,x2]}//.thetaback*)

(*This is to test the itogrules:*)
(*I10[x,a,b,c] = Int[Li_2(t/a) log(1−t/b) log(1−t/c),{t,0,x}]*)

NIntegrate[(PolyLog[2,t/a]*Log[1-t/b]*Log[1-t/c])/.point,{t,0,(x/.point)}]
I10[x,a,b,c]/.itogrules/.gtolrules/.point/.logback/.li22back//.thetaback