# 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(mittag(a_,x_)) := infsums(x^k/gamma(a*k+1), k); definition(mittag(a_,b_,x_)) := infsums(x^k/gamma(a*k+b), k); 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(sin(x_)) := i*sinh(i*x); definition(cos(x_)) := cosh(i*x); definition(tan(x_)) := sin(x)/cos(x); definition(cot(x_)) := 1/tan(x); definition(sec(x_)) := 1/cos(x); definition(csc(x_)) := 1/sin(x); #definition(asin(x_)) := integrates(1/sqrt(1-t^2),t,0,x); #definition(acos(x_)) := integrates(1/sqrt(1-t^2),t,x,1); #definition(atan(x_)) := integrates(1/sqrt(1+t^2),t,0,x); definition(atan(x_,y_)) := atan(y/x); definition(acot(x_)) := atan(1/x); definition(asec(x_)) := acos(1/x); definition(acsc(x_)) := asin(1/x); definition(sinh(x_)) := e^(x)/2-e^(-x)/2; definition(cosh(x_)) := e^(x)/2+e^(-x)/2; definition(tanh(x_)) := sinh(x)/cosh(x); definition(coth(x_)) := 1/tanh(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_)) := atanh(1/x); definition(asech(x_)) := acosh(1/x); definition(acsch(x_)) := asinh(1/x); definition(cis(x_)):=cos(x)+i*sin(x); definition(Ei(x_)) := integrates(exp(t)/t,t,-inf,x); definition(En(n_,x_)) := integrates(exp(-x*y)/y^n,y,1,inf); #definition(li(n_,x_)) := integrates(ln(t)^(n-1),t,0,x); 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(e^(-t^2),t,0,x); definition(erf(n_,x_)) := n!/sqrt(pi)*integrates(e^(-t^n),t,0,x); definition(erfi(x_)) := 2/sqrt(pi)*integrates(e^(t^2),t,0,x); definition(erfc(n_,x_)) := n!/sqrt(pi)*integrates(e^(-t^n),t,x,inf); definition(x_!) := prods(x,x); #definition(x_!) := infints(t^x*e^(-t),t); definition(gamma(x_)) := infints(t^(x-1)*e^(-t),t); #definition(Gamma(x_)) := integrates(t^(x-1)*e^(-t),t,0,inf); definition(gamma(n_,x_)) := integrates(t^(n-1)*e^(-t),t,x,inf); definition(smallgamma(n_,x_)) := integrates(t^(n-1)*e^(-t),t,0,x); #definition(loggamma(x_)) := log(gamma(x)); definition(psi(x_)):=ds(gamma(x))/gamma(x); definition(psi(x_,n_)):=ds(psi(x),x,n); definition(polylog(a_,x_)):= sums(x^k/(k^a),k,1,inf); definition(zeta(x_)):= when(re(x)>1,sums(k^(-x), k,1,inf)); definition(zeta(n_,x_)):= when(re(n)>1 and re(x)>0, infsums((x+k)^(-n), k)); definition(eta(x_)):= when(re(x)>1, -sums((-1)^k*k^(-x), k,1,inf)); definition(eta(n_,x_)):= when(re(n)>1 and re(x)>0, -infsums((-1)^k*(x+k)^(-n), k)); definition(harmonic(x_)):=psi(x+1)+gamma; definition(harmonic(a_,x_)):=zeta(a)-zeta(a,x+1); definition(lerch(x_,s_,a_)):=tosum(lerch(x,s,a)); definition(e^(x_)):= lims((1+1/k)^(k*x),k=inf); definition(log(x_)):=integrates(1/t,t,1,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_)):= sqrt(re(x)^2+im(x)^2); definition(sgn(x_)):= x/abs(x); definition(delta(x_)):= ds(theta(x)); definition(d(f(x_),x_)):= lims((f(x+delta)-f(x))/delta, delta=0); definition(ds(f_,x_,n_)):= 1/gamma(ceil(n)-n)*integrates(d(f,x,ceil(n))*(t-x)^(ceil(n)-n-1),x,0,t);