# inverse Laplace transform; inverselaplace(a_ and b_,s_,x_):=inverselaplace(a,s_,x_) and inverselaplace(b,s_,x_); inverselaplace(laplace(a_,x_,s_)*s_^m_, s_,x_) := d(a,x,m); inverselaplace(laplace(a_,x_,s_)*s_, s_,x_) := d(a,x); inverselaplace(laplace(y(x_)^a_,x_,s_)*s_^m_, s_,x_) := d(y^(-a),y,m)=c_1; inverselaplace(x(s_),s_,x_):= x(x); inverselaplace(x(s_)*s_,s_,x_):= d(x(x),x); inverselaplace(x(s_)*s_^n_,s_,x_):= d(x(x),x,n); inverselaplace(y(s_),s_,x_):= y(x); inverselaplace(y(a_+s_),s_,x_):= y(x)*exp(-a*x); inverselaplace(y(s_)*s_,s_,x_):= d(y(x),x); inverselaplace(y(s_)*s_^n_,s_,x_):= d(y(x),x,n); inverselaplace(y(a_+s_)*s_^n_,s_,x_):= E(-n,(-n)!*d(exp(-a*x),x,n)); inverselaplace(log(s_),s_,x_):= -1/x; inverselaplace(log(s_+a_),s_,x_):= -exp(-a*x)/x; inverselaplace(log(s_)*s_^n_,s_,x_):=if(n<0, (-log(x)+loggamma(-n))*x^(-1-n)/gamma(-n)); inverselaplace(log(s_)*s_^(-2),s_,x_):= -log(x)*x-gamma*x+x; inverselaplace(log(s_)/(s_+a_),s_,x_):=if(a<0, exp(-a*x)*(log(-a)-Ei(a*x)) ); inverselaplace(sqrt(s_), s_,x_) := 1/sqrt(pi*x); inverselaplace(sqrt(a_*s_), s_,x_) := if(isfree(a,s),sqrt(a)/sqrt(pi*x) ); inverselaplace(sqrt(a_+s_), s_,x_) := if(isfree(a,s), -1/2*1/sqrt(pi*x^3)*exp(-a*x) ); inverselaplace(1/(s_^a_+c_),s_,x_) :=mittag(a,-c*x^a); inverselaplace(s_^b_/(s_^a_+c_),s_,x_) :=x^(-b-a)*mittag(a,-b-a+1,-c*x^a); inverselaplace((a_+s_)^n_, s_,x_) := if(isfree(a,n,s), exp(-a*x)*x^(-1-n)/(-n-1)!); inverselaplace((a_-s_)^n_, s_,x_) := if(isfree(a,n,s), (-1)^n*exp(a*x)*x^(-1-n)/(-n-1)!); inverselaplace((a_+s_)^n_*s_, s_,x_) := if(isfree(a,n,s), (-a)*exp(-a*x)*x^(-1-n)/(-n-1)!+exp(-a*x)*x^(-2-n)/(-2-n)!); inverselaplace((a_+s_)^n_*s_^m_, s_,x_) := if(isfree(a,n,m,s), if(n>0 and n==-m-1, exp(-a*x)/n!*d(exp(a*x)*x^n,x,n), d(exp(a*x)*x^n,x,n)/(-n-1)! )); inverselaplace((1+a_/s_)^n_/s_, s_,x_) := if(isfree(a,n,s) and n>0, exp(-a*x)/n!*d(exp(a*x)*x^n,x,n) ); inverselaplace(1/(a_+s_^2), s_,x_) := if(isfree(a,s),sin(sqrt(a)*x)/sqrt(a)); inverselaplace(s_^n_/(a_+s_^2), s_,x_) := if(isfree(a,s),a^((n-1)/2)*sin(n,sqrt(a)*x)); inverselaplace(s_/(a_+s_^2), s_,x_) := if(isfree(a,s),cos(sqrt(a)*x)); inverselaplace(1/s_/(a_+s_^2), s_,x_) := if(isfree(a,s),-1/a*cos(sqrt(a)*x)); inverselaplace(1/(s_+a_), s_,x_) := if(isfree(a,s),exp(-a*x)); inverselaplace(1/(s_+y_), s_,x_) := if(isfree(y,s),exp(-y*x)); inverselaplace(1/(-s_+a_), s_,x_) := if(isfree(a,s), -exp(a*x)); inverselaplace(1/(s_+a_)/s_, s_,x_) := if(isfree(a,s),1/a-exp(-a*x)/a ); inverselaplace(1/(a_+s_^0.5), s_,x_) := if(isfree(a,s),1/sqrt(pi*x)-a*exp(a^2*x)*erfc(a*sqrt(x)) ); inverselaplace(1/(a_+s_)/s_^0.5, s_,x_) := if(isfree(a,s),exp(-a*x)*erf(sqrt(-a*x))/sqrt(-a) ); inverselaplace(1/(a_+s_)/s_^2, s_,x_) := if(isfree(a,s),exp(-a*x)/a^2+x/a-1/a^2); inverselaplace(1/(s_+a_)/(s_+b_), s_,x_) := if(isfree(a,b,s),exp(-b*x)/(a-b)-exp(-a*x)/(a-b) ); inverselaplace(s_/(s_+a_)/(s_+b_), s_,x_) := if(isfree(a,b,s),b*exp(-b*x)/(a-b)-a*exp(-a*x)/(a-b) ); inverselaplace(1/(s_+a_)/(s_^2+b_), s_,x_) := if(isfree(a,b,s),exp(-a*x)/(a^2+b)+a*sin(sqrt(b)*x)/(a^2+b)/sqrt(b)-cos(sqrt(b)*x)/(a^2+b) ); inverselaplace(s_^n_, s_,x_) := x^(-n-1)/(-n-1)!; inverselaplace(s_,s_,x_) := 0; inverselaplace(y_,s_):=inverselaplace(y,s,x); inverselaplace(y_):=inverselaplace(y,s,x);