### The Maxima on-line user's manual

Algebra Calculator

#### Logcontract

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`

```          (%i1) 2*(a*log(x) + 2*a*log(y))\$
(%i2) logcontract(%);
2  4
(%o2)                     a log(x  y )```

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))`.

```(%o1)                                true
(%i2) ```

### Related Examples

##### logcontract

logcontract(log(y)=2....

Calculate

##### logcontract-solve

f:log2(x+1)+log2(x-5)=4;

g:logcontract(f);

v:solve(g=4,x);

Calculate

##### logcontract-rat-ratsimpexpons-ratsubst-true

a:(x^k-1)/(2^k-1);

b:(x^k-x-1)/(2^k-2);

c: rat(b-a);

Calculate

##### logcontract

log2(x):=log(x)/log(2);

f:log2(x+1)+log2(x-5);

g:logcontract(f);

Calculate

##### logcontract-solve

f:log2(x+1)+log2(x-5)=4;

g:logcontract(f);

v:solve(g=4,x);

Calculate

##### logcontract-solve

log2(x):=log(x)/log(2);

f:log2(x+1)+log2(x-5);

g:logcontract(f);

Calculate

##### logcontract

log2(x):=log(x)/log(2);

f:log2(x+1)+log2(x-5);

g:logcontract(f);

Calculate

##### logcontract-rat-ratsimpexpons-ratsubst-true

a:(x^k-1)/(2^k-1);

b:(x^k-x-1)/(2^k-2);

c: rat(b-a);

Calculate

##### logcontract-solve

log2(x):=log(x)/log(2);

f:log2(x+1)+log2(x-5);

g:logcontract(f);

Calculate

##### logcontract-solve

f:log2(x+1)+log2(X-5);

g:logcontract(f);

v:solve(g=4,x);

Calculate