# convert to sin(x) or cos(x); #totrig(x_):=if(iscomplex(x),totrig(tocomplex(x))); totrig(Complex(a_,b_)):= abs(a,b)*(cos(todegree(atan2(b,a)))+i*sin(todegree(atan2(b,a)))); totrig(exp(x_)) := cos(i*x)-i*sin(i*x); totrig(exp(a_*degree)) := cos(im(a)*degree)+i*sin(im(a)*degree); totrig(a_*exp(-i*x_)+a_*exp(i*x_)) := 2a*cos(x); totrig(sinc(x_)):=sin(x)/x; totrig(cis(x_)):=cos(x)+i*sin(x); totrig(polar(r_,x_)):=r*cos(x)+r*i*sin(x); totrig(sinh(x_)):= -i*sin(i*x); totrig(cosh(x_)):= cos(i*x); totrig(tanh(x_)):= -i*tan(i*x); totrig(coth(x_)):= i*cot(i*x); totrig(csch(x_)):= i*csc(i*x); totrig(sech(x_)):= sec(i*x); totrig(asinh(x_)):= -i*asin(i*x); totrig(acosh(x_)):= acos(i*x); totrig(atanh(x_)):= -i*atan(i*x); totrig(acoth(x_)):= i*acot(i*x); totrig(acsch(x_)):= i*acsc(i*x); totrig(asech(x_)):= asec(i*x); totrig(log(x_+sqrt(1+x_^2))):= -i*asin(i*x); totrig(log(x_+sqrt(x_^2-1))):= -i*acos(i*x); totrig(log((1+x_)/(1-x_))):= -i*atan(i*x); totrig(log((1+x_)/(x_-1))):= i*acot(i*x); totrig(log((1+sqrt(x_^2+1))/x_)):= i*acsc(i*x); totrig(log((1+sqrt(1-x_^2))/(1-(1-x_^2)^(1/2)))):= asec(i*x); totrig(log(i*x_+sqrt(1-x_^2))):= i*asin(x); totrig(log(i*x_+sqrt(x_^2-1))):= i*acos(x); totrig(log((1-i*x_)/(1+i*x_))):= 2i*atan(x); totrig(log((1+i*x_)/(i*x_-1))):= -2i*acot(x); totrig(log((1+sqrt(-x_^2+1))/x_/i)):= -2i*acsc(x); totrig(log((1+sqrt(1+x_^2))/(1-(1+x_^2)^(1/2)))):= 2asec(x);