# polylog(n,x) is the polylogarithm function Lin(x) of index n at the point x;
# polylog(n,x)=sum(x^k/k^n, k,1,inf);
# polylog(a,z,b) is incomplete polylogarithm function of integral from 0 to b;
# = z/gamma(a)*integrate(x^(a-1)/(e^x-z),x,0,b), = sum(z^k/k^a* gamma(a,k*b)/gamma(a),k,1,inf);
# polylog(n,x) := If(n>=1, -n*polylog(n-1,x)+ln(x)^n*x, If(n<-1, (-polylog(n+1,x)+ln(x)^(n+1)*x)/(n+1)));


polylog(x_) := x/(1-x);

polylog(n_,0) := 0;
polylog(n_,-1):= -eta(n);
polylog(n_,1):=zeta(n);
polylog(n_,inf) := inf;
polylog(n_,-inf) := -inf;
polylog(1,x_):= -log(1-x);
polylog(0,x_) := x/(1-x);
polylog(-1,x_) := x/(1-x)^2;

polylog(a_,x_,0):=0;
polylog(a_,b_,inf):= polylog(a,x);
polylog(a_,0,x_):=polylog(a,x);
polylog(n_,1,x_):= -zeta(n,1,x);
polylog(n_,-1,x_):= eta(n,1,x);
polylog(1,c_,x_):=log(c+exp(x))-x;