# log(x) is natural log of base e;
# log(n,x) is log(x) of base n;
# expand(log(a_*b_)) := log(a)+log(b);
# expand(log(a_^b_)) := b*log(a);
log(a_=b_) := log(a)=log(b);
log(a_*b_) := if(a>0,log(a)+log(b));
log(a_^b_) := if(a>0,b*log(a));
log(-1):=pi*i;
log(1):=0;
log(e):=1;
log(gamma(x_)):=loggamma(x);
log(exp(x_)) := x;
log(e^(x_)) := x;
log(a_,x_):=log(x)/log(a);