# it converts y to sum; # tosum(y_,x_,a_,n_,x_):= Block(p:=sum(D(y_,x_,j)*xx^j/j!, j,1,n_ ,1), Replace(Replace(p,x_,a_),xx,x)); tosum(y_,x_,x0_,m_,n_):= sum(chop(n(d(y,x,x0,k+n-1)/gamma(k+n)))*(x-x0)^(k+n-1),k,m) ; tosum(y_,x_):= sum(d(y,x,0,k)*x^k/(k!),k,5); tosum(a_*y_,x_):= If(not(isfunction(a)), a*tosum(y,x), If(not(isfunction(y)), y*tosum(a,x) )); tosum(a_+y_,x_):= If(isfree(a,x), a+tosum(y,x), If(isfree(y,x), tosum(a,x)+y,tosum(a,x)+tosum(y,x) )); tosum(-y_,x_):= -tosum(y,x); tosum(a_+b_):= If(not(isfunction(a)), a+tosum(b), tosum(a)+tosum(b)); tosum(a_*b_):= If(not(isfunction(a)), a*tosum(b), If(not(isfunction(b)), b*tosum(a), tosum(a)*tosum(b) )); tosum(-y_):= -tosum(y); tosum(d(y_,x_)):= d(tosum(y),x); tosum(d(y_,x_,n_)):= d(tosum(y),x,n); tosum(integrate(y_,x_)):= integrate(tosum(y),x); tosum(d(f(x_),x_,v_)):= lims(gamma(v+1)/delta*infsums((-1)^j/(gamma(j+1)*gamma(v-j+1))*f(x-delta*j),j), delta=0); tosum(bernoulli(n_,x_) ) := sums(binomial(n,k)*bernoulli(n-1,k)*x^k,k,0,n); #tosum(Sophomore(x_)):= -infsum1s((-k)^(-k),k)*GammaQ(x); tosum(Sophomore(x_)):= -infsum1s((-k)^(-k)/gamma(k)*gamma(k,-k*log(x)),k); tosum(Sophomore2(x_)):= infsum1s(k^(-k),k)*GammaQ(x); tosum(Cl(a_,x_)):= infsum1s(sin(k*x)/k^a,k); tosum(Ein(x_)):= -infsum1s((-1)^k*x^k/(k*k!),k); tosum(Ei(x_)):= gamma+log(x)+infsum1s(x^k/(k*k!),k); tosum(beta(x_)):= infsums((-1)^k/(2k+1)^x, k); tosum(zeta(x_)):= sums(k^(-x), k,1,oo); tosum(zeta(a_,x_)):= sums((k+x)^(-a), k,0,oo); tosum(zeta(a_,x_,c_)):= sums((k+x)^(-a), k,0,c-1); tosum(eta(x_)):= -sums((-1)^k*k^(-x), k,1,oo); tosum(eta(a_,x_)):= -sums((-1)^k*(k+x)^(-a), k,0,oo); tosum(eta(a_,x_,c_)):= -sums((-1)^k*(k+x)^(-a), k,0,c-1); tosum(mittag(a_,x_)):= sums(x^k/((a*k)!), k,0,oo); tosum(mittag(a_,b_,x_)):= sums(x^k/gamma(a*k+b), k,0,oo); tosum(polylog(a_,b_,x_)):= sums(x^k/k^a*GammaQ(a,b*k), k,1,oo); tosum(polylog(a_,x_)):= sums(x^k/k^a, k,0,oo); tosum(Phi(x_,s_,a_)):= sums(x^k/(a+k)^s, k,0,oo); tosum(Phi(x_,s_)):= sums(x^k/(k)^s, k,1,oo); tosum(psi(n_,x_)):= -(-1)^n*n!*sums(1/(k+x)^(n+1),k),0,oo; tosum(psi(x_)):= gamma-sums(1/(k+x),k,0,oo); tosum(erf(x_)) := 2* sums((-1)^k* x^(1 + 2 k)/((1 + 2 k)* k!),k,0,oo)/sqrt(pi); tosum(erfi(x_)) := 2* sums(x^(1 + 2 k)/((1 + 2 k)* k!),k,0,oo)/sqrt(pi); tosum(harmonic(x_)):=sums(1/k,k,1,x); tosum(harmonic(a_,x_)):=sums(1/k^a,k,1,x); tosum(Gamma(a_,x_)):=Gamma(a)*exp(-x)*sums(x^k/(k!),k,0,a-1); tosum(Gamma(a_)):=Gamma(a,y)*exp(y)/sums(y^k/(k!),k,0,a-1); tosum(En(a_,x_)):=x^(a-1)*Gamma(1-a)*exp(-x)*sums(x^k/(k!),k,0,-a); tosum(En(1,x_)):= -gamma-log(x)-sums((-1)^k*x^k/(k*k!),k,1,oo); #tosum(erf(x_)):= 1-exp(-x^2)/x/sqrt(pi)*infsums((-1)^k*(2k-1)!!/(2x^2)^k,k); tosum(li(n_,x_)):= sums(x^k/k^n,k,1,oo); tosum(log(x_)):= -sums((1-x)^k/k,k,1,oo); tosum(log(1+x_)):= infsums((-1)^k*x^(1+k)/(1+k),k); #tosum(log(1-x_)):= -infsum1s(x^k/k,k); tosum(sin(x_)):= infsums((-1)^k*x^(2k+1)/((2k+1)!),k); tosum(cos(x_)):= infsums((-1)^k*x^(2k)/((2k)!),k); tosum(tan(x_)):= infsums(k*x^(2k+1)/((2k+1)!!),k); tosum(sec(x_)):= infsums(x^(2 k)* Euler(2 k)/((2k)!),k); #tosum(asin(x_)):= infsum1s(x^(1 + 2 k)*(2k-1)!!/((2k)!!*(2k+1)),k)+x; tosum(asin(x_)):= infsums((2k-1)!!/((2k)!!*(2k+1))*x^(2k+1),k); tosum(acos(x_)):= pi/2-infsums(x^(1 + 2 k)*(2k-1)!!/((2k)!!*(2k+1)),k); #tosum(acos(x_)):= pi/2-infsums(x^(1 + 2 k)*pochhammer(1/2,k)/(k! + 2 k* k!),k); tosum(atan(x_)):= infsums((-1)^k*x^(2k+1)/(2k+1),k); tosum(acot(x_)):= pi/2-infsums((-1)^k*x^(2k+1)/(2k+1),k); tosum(cosh(a_,x_^a_)):= E(a,x^a)/2+E(a,-x^a)/2; tosum(sinh(a_,x_^a_)):= E(a,x^a)/2-E(a,-x^a)/2; tosum(sinh(x_)):= infsums(x^(2k+1)/((2k+1)!),k); tosum(cosh(x_)):= infsums(x^(2k)/((2k)!),k); tosum(tanh(x_)):= -2*infsums((-1)^k*exp(2k*x),k); tosum(asinh(x_)):= infsums((-1)^k*(2k-1)!!/((2k)!!*(2k+1))*x^(2k+1),k); tosum(atanh(x_)):= infsums(x^(2k+1)/(2k+1),k); tosum(si(x_)):= infsums((-1)^k*x^(2k+1)/((2k+1)!*(2k+1)),k); tosum(ci(x_)):= infsums((-1)^k*x^(2k)/((2k)!*k),k)/2; tosum(shi(x_)):= infsums(x^(2k+1)/((2k+1)!*(2k+1)),k); tosum(chi(x_)):= infsums(x^(2k)/((2k)!*k),k)/2; tosum(sqrt(x_)):=tosum(x^(1/2)); tosum(cbrt(x_)):=tosum(x^(1/3)); tosum(exp(x_)):= infsums(x^k/(k!),k); tosum(exp(x_)*x_):= infsums(x^k/k!,k)*x; tosum(exp(x_)*x_^n_):= infsums(x^k/k!,k)*x^n; tosum(exp(a_*x_)*x_^n_):= infsums((a*x)^k/k!,k)*x^n; tosum(1/(exp(x_)-1)):=infsums(exp(-k*x),k); #tosum((1+x_)^n_):= when(abs(x)<1,infsums(binomial(n,k)*x^k), when(abs(x)>1, infsums(binomial(n,k)/x^k)*x^n )); #tosum((1+x_)^n_):= if(n== -0.5, infsums((-1)^(2k+1)*(2k-1)!!/((2k)!!)*x^k), if(n==0.5, 1+infsum1s((-1)^(2k+1)*(2k-3)!!/((2k)!!)*x^k), infsums(binomial(n,k)*x^k,k) )); tosum((1+x_)^n_):= infsums(binomial(n,k)*x^k,k); tosum((-1+x_)^n_):= if(n<0,(-1)^n*infsums(fallingfactorial(k,-n-1)*x^(k+n+1),k),(-1)^n*infsums(binomial(n,k)*(-x)^k,k) ); tosum((1-x_)^n_):= if(n== -0.5,infsums((2k-1)!!/((2k)!!)*x^k), if(n==0.5,1-infsum1s((2k-3)!!/((2k)!!)*x^k), if(n<0,infsums(fallingfactorial(k,-n-1)*x^(k+n+1),k), infsums(binomial(-n,k)*x^k,k) ))); #tosum(1/(-1+x_)):= -infsums(x^k,k); #tosum(1/(1-x_)):= infsums(x^k,k); tosum(1/(1+x_)):= infsums((-x)^k,k); tosum((-1+x_^n_)/(-1+x_)):=sums(x^k,k,0,n-1); tosum((1-x_^n_)/(1-x_)):=sums(x^k,k,0,n-1); tosum(x_,x_):=x;