Maxima Function
logcontract (expr)
Recursively scans the expression expr, transforming
subexpressions of the form a1*log(b1) + a2*log(b2) + c into
log(ratsimp(b1^a1 * b2^a2)) + c
If you do declare(n,integer); then logcontract(2*a*n*log(x)); gives
a*log(x^(2*n)). The coefficients that "contract" in this manner are
those such as the 2 and the n here which satisfy
featurep(coeff,integer). The user can control which coefficients are
contracted by setting the option logconcoeffp to the name of a
predicate function of one argument. E.g. if you like to generate
SQRTs, you can do logconcoeffp:'logconfun$logconfun(m):=featurep(m,integer) or ratnump(m)$ . Then
logcontract(1/2*log(x)); will give log(sqrt(x)).