Collecting logarithms

### 9.3.5 Collecting logarithms

The lncollect command collects the logarithm in an expression; namely, it rewrites sums of logarithms as the logarithm of a product.

- lncollect takes expr, an expression.
- lncollect(expr) returns expr with the logarithms collected.

It may be a good idea to factor the expression with factor before collecting by lncollect).

#### Examples

lncollect(ln(x+1)+ln(x-1))

ln | ⎛ ⎝ | ⎛ ⎝ | x+1 | ⎞ ⎠ | ⎛ ⎝ | x−1 | ⎞ ⎠ | ⎞ ⎠

lncollect(exp(ln(x+1)+ln(x-1)))

| ⎛ ⎝ | x+1 | ⎞ ⎠ | ⎛ ⎝ | x−1 | ⎞ ⎠

##### Remark.

Note that, for Xcas, log is the natural logarithm, the same as ln; for the base 10 logarithm, use log10.