# infsum(y,x) is infinite sum y; infsum(a_+b_,x_):=infsum(a,x)+infsum(b,x); #infsum(k_*y_,x_) := If(isfree(k,x), k*infsum(y,x)); #infsum((k_+x_)^a_, k_):=zeta(-a,x); infsum(x_^(2k_+1)*1/(2k_+1)! *(-1)^k_,k_) := sin(x); infsum(x_^(2k_)*1/(2k_)!*(-1)^k_,k_) := cos(x); infsum((-1)^k_*e^(2i*k_*x_),k_):= -i/2*tan(x); infsum(x_^(2k_+1)*1/(2k_+1)*(-1)^k_,k_) := atan(x); infsum(x_^(2k_+1)/(2k_+1)!,k_) := sinh(x); infsum(x_^(2k_)/(2k_)!,k_) := cosh(x); infsum((-1)^k_*e^(2k_*x_),k_):= -1/2*tanh(x); infsum(x_^(2k_+1)/(2k_+1),k_):=atanh(x); infsum(x_^k_,k_):= when(abs(x)<1, 1/(1-x)); infsum(x_^(-k_),k_):= when(abs(x)>1, x/(x-1)); infsum(k_*x_^(k_-1),k_):= when(abs(x)<1,1/(1-x)^2); infsum(x_^k_/k_,k_) := when(abs(x)<1, -log(1-x)); infsum((1-x_)^k_/k_,k_) := when(abs(x)<1, -log(x)); infsum((-1)^(k_+1)*x_^k_/k_,k_) := when(abs(x)<1, log(1+x)); infsum((a_+k_)^x_,k_):= zeta(a,-x); #infsum(k_^x_,k_):= zeta(-x); #infsum((-1)^k*k_^x_,k_):= eta(-x); #infsum(x_^k_*k_^b_,k_):= polylog(-b,x); #infsum(x_^k_*(a_+k_)^b_,k_):= polylog(a,-b,x); #infsum((-1)^k_/k_,k_):= -log(2); infsum(x_^k_/k_!,k_) := exp(x); infsum(x_^(a_+k_)/k_!,k_) := x^a*e^x; infsum(x_^(a_*k_)/k_!,k_) := exp(x^a); infsum((-1)^k_/k_!*x_^k_,k_) := exp(-x); infsum(k_/k_!*x_^k_,k_) := x*exp(x); infsum(1/k_/k_!*x_^k_,k_) := ei(x)-log(x)-gamma; infsum((-1)^k_*k_/k_!*x_^k_,k_) := x*exp(-x); infsum(x_^k_/(a_*k_)!, k_):=mittag(a,x); infsum(x_^k_/(a_*k_+b_)!, k_):=mittag(a,b-1,x); infsum(x_^k_/gamma(a_*k_+b_), k_):=mittag(a,b,x); infsum(1/k_!,k_):= e; infsum(k_/k_!,k_):= e; infsum(k_^2/k_!,k_):= 2e; infsum(k_^3/k_!,k_):= 5e; infsum((-1)^k_/k_!, k_) := exp(-1); infsum(e^(a_*x_),x_) := when(a<0, exp(-a)/(exp(-a)-1)); infsum(exp(-k_*x_),k_):=1/(exp(x)-1); infsum(e^(-x_),x_) := exp(1)/(exp(1)-1); infsum(exp(-x_),x_) := exp(1)/(exp(1)-1); infsum(x_*e^(-x_),x_) := exp(1)/(exp(1)-1)^2; infsum(k_,k_):= infinity; infsum(y_):= infsum(y,k);