# reverse function; #inverse(a_,x_):=replace(solve(a-aaa,x),aaa,x); inverse(a_ or b_, x_):= (inverse(a,x) or inverse(b,x)); inverse(left_=r_, x_) := solve(left=r,x); inverse(b_+a_,x_):= If(isfree(a,x), replace(inverse(b,x),x,x-a)); inverse(c_+x_+x_^2, x_) := If(isfree(c,x), (-1/2+sqrt(1-4*c+4*x)/2 or -1/2-sqrt(1-4*c+4*x)/2)); inverse(c_+x_+a_*x_^2, x_) := If(isfree(a,c,x), ((-1+sqrt(1+4*a*x-4*a*c))/(2*a) or (-1-sqrt(1+4*a*x-4*a*c))/(2*a)) ); inverse(c_+b_*x_+x_^2, x_) := If(isfree(b,c,x), (-b/2+sqrt(b^2+4*x-4*c)/2 or -b/2-sqrt(b^2+4*x-4*c)/2)); inverse(c_+b_*x_+a_*x_^2, x_) := If(isfree(a,b,c,x), ((-b+sqrt(b^2-4*a*c+4*a*x))/(2*a) or (-b-sqrt(b^2-4*a*c+4*a*x))/(2*a))); inverse(e^(-y_)+e^y_,x_):= replace(inverse(y,x),x,acosh(x/2) ); inverse(a_+e^x_+e^(-x_),x_):= If(isfree(a,x),acosh((x-a)/2) ); inverse(e^(y_)/(1-e^y_),x_):=replace(inverse(y,x),x,log(x/(x+1))); inverse(a_*b_,x_):=If(isfree(a,x), replace(inverse(b,x),x,x/a)); inverse(y_^a_,x_):=If(isfree(a,x), replace(inverse(y,x),x,x^(1/a)), If(isfree(y,x), replace(inverse(a,x),x,log(x)/log(y)) )); inverse(e^(y_)/y_,x_):=replace(inverse(y,x),x,-inverseei(0,-x)); inverse(1/(1+y_)*y_,x_):=replace(inverse(y,x),x,x/(1-x)); inverse(1/(1-y_)*y_,x_):=replace(inverse(y,x),x,x/(x+1)); inverse(d(y_,x_,n_),x_):=d(y,x,-n); inverse(d(y_,x_),x_):=integrate(y,x); inverse(integrate(y_,x_),x_):=d(y,x); inverse(difference(y_,x_),x_):=sum(y,x); inverse(sum(y_,x_),x_):=difference(y,x); inverse(inverse(y_,x_),x_):=y; inverse(mittag(a_,y_),x_):=replace(inverse(y,x),x,log(1-a,x)); inverse(log(a_,y_),x_):=replace(inverse(y,x),x,mittag(1-a,x)); inverse(gamma(n_,y_),x_):=replace(inverse(y,x),x,inversegamma(n,x)); inverse(e^(y_),x_):=replace(inverse(y,x),x,log(x)); inverse(exp(y_),x_):=replace(inverse(y,x),x,log(x)); inverse(log(y_),x_):=replace(inverse(y,x),x,e^(x)); inverse(log10(y_),x_):=replace(inverse(y,x),x,10^(x)); #inverse(sin(y_),x_):=replace(inverse(y,x),x,asin(x)); inverse(cos(y_),x_):=replace(inverse(y,x),x,acos(x)); inverse(tan(y_),x_):=replace(inverse(y,x),x,atan(x)); inverse(cot(y_),x_):=replace(inverse(y,x),x,acot(x)); inverse(sec(y_),x_):=replace(inverse(y,x),x,asec(x)); inverse(csc(y_),x_):=replace(inverse(y,x),x,acsc(x)); inverse(sinh(y_),x_):=replace(inverse(y,x),x,asinh(x)); inverse(cosh(y_),x_):=replace(inverse(y,x),x,acosh(x)); inverse(tanh(y_),x_):=replace(inverse(y,x),x,atanh(x)); inverse(coth(y_),x_):=replace(inverse(y,x),x,acoth(x)); inverse(sech(y_),x_):=replace(inverse(y,x),x,asech(x)); inverse(csch(y_),x_):=replace(inverse(y,x),x,acsch(x)); inverse(asin(y_),x_):=replace(inverse(y,x),x,sin(x)); inverse(acos(y_),x_):=replace(inverse(y,x),x,cos(x)); inverse(atan(y_),x_):=replace(inverse(y,x),x,tan(x)); inverse(acot(y_),x_):=replace(inverse(y,x),x,cot(x)); inverse(asec(y_),x_):=replace(inverse(y,x),x,sec(x)); inverse(acsc(y_),x_):=replace(inverse(y,x),x,csc(x)); inverse(asinh(y_),x_):=replace(inverse(y,x),x,sinh(x)); inverse(acosh(y_),x_):=replace(inverse(y,x),x,cosh(x)); inverse(atanh(y_),x_):=replace(inverse(y,x),x,tanh(x)); inverse(acoth(y_),x_):=replace(inverse(y,x),x,coth(x)); inverse(asech(y_),x_):=replace(inverse(y,x),x,sech(x)); inverse(acsch(y_),x_):=replace(inverse(y,x),x,csch(x)); inverse(sqrt(y_),x_):=replace(inverse(y,x),x,x^2); inverse(cbrt(y_),x_):=replace(inverse(y,x),x,x^3); inverse(sin(x_),x_):=asin(x); inverse(x_,x_):=x; inverse(y_):=inverse(y,x);