simplify(ds(ds(y_,x_),t_)):=d(d(y,x),t); #simplify(a_ and b_):=simplify(a) and simplify(b); simplify(a_=b_):=simplify(a)-simplify(b)=0; simplify(log(x_+sqrt(1+x_^2))):=asinh(x); simplify(log(x_+sqrt(x_^2-1))):=acosh(x); simplify(log((1+x_)/(x_-1))):= 2acoth(x); simplify(log((1+x_)/(1-x_))):= 2atanh(x); #simplify(ln(n_,x)):= If(n>0 and isinteger(n), -(-1)^n*(n-1)!/x^n); simplify(ln(n_,x_)):= If(n>0,-(-1)^n*(n-1)!/x^n, (log(x)+psi(1)-psi(1-n))/gamma(1-n)*pow(x,-n) ); simplify(log(Gamma(x_))):=logGamma(x); #simplify(log(gamma(x_))):=loggamma(x); simplify(Gamma(x_-1)/Gamma(x_)):=1/(x-1); simplify(Gamma(x_)/Gamma(x_-1)):= x-1; simplify(sin(x_)^n_):=if(n<0,csc(x)^(-n)); simplify(cos(x_)^n_):=if(n<0,sec(x)^(-n)); simplify(tan(x_)^n_):=if(n<0,cot(x)^(-n)); simplify(cot(x_)^n_):=if(n<0,tan(x)^(-n)); simplify(csc(x_)^n_):=if(n<0,sin(x)^(-n)); simplify(sec(x_)^n_):=if(n<0,cos(x)^(-n)); simplify(1/cos(x_)*sin(x_)):=tan(x); simplify(cos(x_)/sin(x_)):=cot(x); simplify(asin(1/x_)):=acsc(x); simplify(acos(1/x_)):=asec(x); simplify(atan(1/x_)):=acot(x); simplify(acot(1/x_)):=atan(x); simplify(a_*exp(-x_)+b_*exp(x_)):= If(a==-b, 2b*sinh(x)); simplify(a_*exp(-x_)-a_*exp(x_)):= -2a*sinh(x); simplify(a_*exp(x_)-a_*exp(-x_)):= 2a*sinh(x); simplify(a_*exp(-x_)+a_*exp(x_)):= 2a*cosh(x); simplify(exp(-x_)+exp(x_)):= 2cosh(x); simplify(exp(x_)-exp(-x_)):= 2sinh(x); simplify(exp(-x_)-exp(x_)):= -2sinh(x); simplify(a_*exp(-i*x_)-a_*exp(i*x_)):= -2a*i*sin(x); simplify(a_*exp(-i*x_)+(-a_)*exp(i*x_)):= 2a*i*sin(x); simplify(a_*exp(-i*x_)+a_*exp(i*x_)):= 2a*cos(x); simplify(1/(exp(a_)+exp(b_))):=exp(-a)/(exp(b-a)+1); simplify(1/(exp(-x_)+exp(x_))) := sech(x); simplify(1/(exp(x_)-exp(-x_))) := csch(x); simplify(1/sinh(x_)):=csch(x); simplify(1/cosh(x_)):=sech(x); simplify(1/tanh(x_)):=coth(x); simplify(1/coth(x_)):=tanh(x); simplify(1/csch(x_)):=sinh(x); simplify(1/sech(x_)):=cosh(x); simplify(1/cosh(x_)*sinh(x_)):=tanh(x); simplify(cosh(x_)/sinh(x_)):=coth(x); simplify(log(x_+(1+x_^2)^(1/2))):=asinh(x); simplify(log(x_+(x_^2-1)^(1/2))):=acosh(x); simplify(asinh(1/x_)):=acsch(x); simplify(acosh(1/x_)):=asech(x); simplify(atanh(1/x_)):=acoth(x); simplify(acoth(1/x_)):=atanh(x); simplify(x_+(1+x_^2)^(1/2)):=exp(asinh(x)); simplify(x_+(x_^2-1)^(1/2)):=exp(acosh(x)); simplify(sin(i*x_)):= -i*sinh(x); simplify(cos(i*x_)):= cosh(x); simplify(tan(i*x_)):= i*tanh(x); simplify(asin(i*x_)):= -i*asinh(-x); simplify(acos(i*x_)):= -i*acosh(-x); simplify(atan(i*x_)):= i*atanh(x); simplify(sinh(i*x_)):= -i*sin(x); simplify(cosh(i*x_)):= cos(x); simplify(tanh(i*x_)):= i*tan(x); simplify(asinh(i*x_)):= -i*asin(-x); simplify(acosh(i*x_)):= -i*acos(-x); simplify(atanh(i*x_)):= i*atan(x); simplify(sgn(x_)*abs(x_)):=x; simplify(x_/abs(x_)):=sgn(x); simplify(x_/sgn(x_)):=abs(x); simplify(exp(a_*log(x_))):=x^a; simplify(exp(log(x_))):=x; simplify(cos(x_)*sin(x_)) := sin(2x)/2; simplify(sin(a_)*cos(b_)+cos(a_)*sin(b_)):=sin(a+b); simplify(sin(a_)*cos(b_)-cos(a_)*sin(b_)):=sin(a-b); simplify(cos(a_)*cos(b_)- sin(a_)*sin(b_)):=cos(a+b); simplify(cos(a_)*cos(b_)+ sin(a_)*sin(b_)):=cos(a-b); simplify((x_^n_-1)/(x_-1)):=If(n>0, sum(x^k,k,0,n-1,1)); simplify((x_^n_-1)/(1-x_)):=If(n>0, sum(-x^k,k,0,n-1,1)); simplify((1-x_^n_)/(x_-1)):=If(n>0, sum(-x^k,k,0,n-1,1)); simplify((1-x_^n_)/(1-x_)):=If(n>0, sum(x^k,k,0,n-1,1)); simplify(x_/(2-3*x_+x_^2)):=2/(x-2)-1/(x-1); simplify(cosh(x_)+sinh(x_)):=exp(x); simplify(cosh(x_)-sinh(x_)):=exp(-x); simplify(cosh(x_)^2-sinh(x_)^2):=1; simplify(cos(x_)^2+sin(x_)^2):=1; simplify(sec(x_)^2-tan(x_)^2):=1; simplify(csc(x_)^2-cot(x_)^2):=1; simplify(tan(x_)^2-sec(x_)^2):= -1; simplify(-1+sin(x_)^2):= -cos(x)^2; simplify(-1+cos(x_)^2):= -sin(x)^2; simplify((-a_)^n_):=if(iseven(n),a^n, if(isodd(n),-a^n )); simplify(sqrt(x_)):=x^(1/2); simplify(cbrt(x_)):=x^(1/3); simplify(mittag(a_,b_)*mittag(a_,c_)):=mittag(a,b+c); simplify(mittag(a_,b_)/mittag(a_,c_)):=mittag(a,b-c); simplify(mittag(2,x_^2)):=cosh(x); simplify(mittag(2,-x_^2)):=cos(x); simplify(mittag(a_,x_)^n_):=mittag(a,n*x); simplify(GammaQ(a_,x_)*Gamma(a_)):=Gamma(a,x); simplify(Gamma(a_,x_)/GammaQ(a_,x_)):=Gamma(a); simplify(Gamma(n_,a_,x_)):=d(Gamma(a,x),x,n); simplify(Gamma(n_,x_,0)):=d(Gamma(x),x,n); simplify(pow(a_,b_)):=a^b; simplify(1/pow(a_,b_)):=a^(-b); simplify(Dawson(x_)):=exp(-x*x)*erfi(x)*sqrt(pi)/2;