# definition of a function; definition(a_*b_):= If(not(isfunction(a)), a*definition(b), If(not(isfunction(b)), b*definition(a) )); definition(a_+b_):=If(isfree(a,x), a+definition(b), definition(a)+definition(b)); definition(a_-b_):=If(isfree(a,x), a-definition(b), definition(a)-definition(b)); definition(-b_):= -definition(b); definition(d(f(x_),x_)):= lims((f(x+delta)-f(x))/delta, delta->0); definition(ds(f_,x_,n_)):= if(n<0,1/gamma(ceil(n)-n)*integrates(d(f,x,ceil(n))*(t-x)^(ceil(n)-n-1),x,0,t)); definition(d(f(x_),x_,n_)):=if(n<0,int(f(x),x,-n)); definition(int(f(x_),x_)):=F(x)+constant; definition(int(f(x_),x_,n_)):=d(f(x),x,-n); definition(int(f(x_),x_,a_,b_)):=F(b)-F(a); #definition(mittag(a_,x_)) := sums(x^k/gamma(a*k+1), k,0,oo); #definition(mittag(a_,b_,x_)) := sums(x^k/gamma(a*k+b), k,0,oo); definition(mittag(0.5,x_)) := (1+erf(x))*exp(x^2); #definition(Ei(x_)) := integrates(exp(t)/t,t,-inf,x); definition(En(n_,x_)) := Gamma(1-n,x)*x^(n-1); #definition(li(n_,x_)) := integrates(ln(t)^(n-1),t,0,x); def(inverseW(x)):=exp(x)*x; def(W(x)):=inverses(exp(x)*x); def(Dawson(x_)) := erfi(x)*exp(-x^2)*sqrt(pi)/2; def(Dawsonminus(x_)) := erf(x)*exp(x^2)*sqrt(pi)/2; definition(gauss(x_)):=exp(-x^2/2)/sqrt(2pi); #definition(Phi(x_)):= erf(x/sqrt(2))/2+1/2; #definition(Phi(a_,x_)):= erf(x/sqrt(2))/2-erf(a/sqrt(2))/2; #definition(erf(x_)) := 2/sqrt(pi)*integrates(exp(-t^2),t,0,x); #definition(erf(n_,x_)) := n!/sqrt(pi)*integrates(exp(-t^n),t,0,x); #definition(erfi(x_)) := 2/sqrt(pi)*integrates(exp(t^2),t,0,x); #definition(erfc(n_,x_)) := n!/sqrt(pi)*integrates(exp(-t^n),t,x,inf); definition(erfc(x_)) := 1-erf(x); def(beta( x_, y_)) := Gamma(x)*Gamma(y)/Gamma(x+y); def(beta( x_, y_, z_, w_ )) := beta(y,z,w) - beta(x,z,w); def(betaRegularized( x_, y_, z_, w_ )) := betaRegularized(y,z,w) - betaRegularized(x,z,w); definition(x_!!) := prods(2x,x); definition(x_!) := prods(x,x); def(GammaQ(x_,y_,z_)):= GammaQ(x,z)-GammaQ(x,y); def(GammaQ(n_,x_)):=Gamma(n,x)/Gamma(n); #definition(Gamma(x_)) := integrates(t^(x-1)*exp(-t),t,0,inf); #definition(Gamma(n_,x_)) := integrates(t^(n-1)*exp(-t),t,x,oo); #definition(gamma(n_,a_,b_)) := integrates(t^(n-1)*exp(-t),t,a,b); #definition(smallgamma(n_,x_)) := integrates(t^(n-1)*exp(-t),t,0,x); #definition(smallgamma(n_,a_,b_)) := integrates(t^(n-1)*exp(-t),t,a,b); definition(Gamma(n_,a_,b_)) := Gamma(n,b)-Gamma(n,a); definition(smallgamma(n_,a_,b_)) := Gamma(n,b)-Gamma(n,a); definition(logGamma(x_)) := log(Gamma(x)); definition(psi(x_)):=ds(gamma(x))/gamma(x); definition(psi(x_,n_)):=ds(psi(x),x,n); #definition(Phi(x_,s_,c_)):=sums(x^k*(c+k)^(-s),k,0,oo); #definition(Phi(x_,s_)):=sums(x^k*k^(-s),k,1,oo); #definition(polylog(a_,x_)):= sums(x^k/(k^a),k,1,inf); #definition(polylog(a_,b_,x_)):= sums(x^k/((b+k)^a),k,0,inf); definition(H(n_,x_)):=zeta(x)-zeta(x,n+1); definition(cis(x_)):=cos(x)+i*sin(x); definition(sinc(x_,y_)) := sin(abs(x,y))/abs(x,y); definition(sinc(x_)) := sin(x)/x; definition(sin(x_)) := i/2*(exp(i*x)-exp(-i*x)); definition(cos(x_)) := (exp(i*x)+exp(-i*x))/2; definition(tan(x_)) := sin(x)/cos(x); definition(cot(x_)) := cos(x)/sin(x); definition(sec(x_)) := 1/cos(x); definition(csc(x_)) := 1/sin(x); definition(asin(x_)) := (-i)*log(i*x+(1-x^2)^(1/2)); definition(acos(x_)) := pi/2-asin(x); definition(atan(x_)) := 0.5*i*log(1/(1+i*x)*(1+(-i)*x)); definition(atan2(y_,x_)) := atan(y/x); definition(acot(x_)) := 1/2 *i *log(1 - i/x) - 1/2 *i *log(1 + i/x); definition(asec(x_)) := pi/2 + i *log(sqrt(1 - 1/x^2) + i/x); definition(acsc(x_)) := (-i)*log(i/x+(1-1/x^2)^(1/2)); #definition(sinh(n_,x_)) := exp(x)/2-exp(-x)*(-1)^n/2; #definition(cosh(n_,x_)) := exp(x)/2+(-1)^n*exp(-x)/2; definition(sinh(x_)) := exp(x)/2-exp(-x)/2; definition(cosh(x_)) := exp(x)/2+exp(-x)/2; definition(tanh(x_)) := sinh(x)/cosh(x); definition(coth(x_)) := cosh(x)/sinh(x); definition(sech(x_)) := 1/cosh(x); definition(csch(x_)) := 1/sinh(x); definition(asinh(x_)) := ln(x+sqrt(1+x^2)); definition(acosh(x_)) := ln(x+sqrt(x^2-1)); definition(atanh(x_)) := ln((1+x)/(1-x))/2; definition(acoth(x_)) := ln((x-1)/(1+x))/2; definition(asech(x_)) := ln(1/x+sqrt(1/x^2-1)); definition(acsch(x_)) := ln(1/x+sqrt(1/x^2+1)); definition(exp(x_)):= lims((1+x/k)^k,k->inf); definition(log(x_)):= inverses(exp(x)); definition(log(n_,x_)):=(log(x)+psi(1)-psi(1-n))/gamma(1-n)/x^n; definition(re(x_)):= (x+conjuate(x))/2; definition(im(x_)):= (x-conjuate(x))/2; definition(abs(x_,y_)):= sqrt(x^2+y^2); definition(abs(x_)):= sqrt(re(x)^2+im(x)^2); definition(sgn(x_)):= x/abs(x); definition(delta(x_)):= ds(theta(x));