# Collecting logarithms: lncollect

### 5.24.5 Collecting logarithms: lncollect

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

- lncollect takes one argument:
  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.

- Input:
  lncollect(ln(x+1)+ln(x-1))
  Output:

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

- Input:
  lncollect(exp(ln(x+1)+ln(x-1)))
  Output:

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

Warning!!!
For Xcas, log is the natural logarithm, the same as ln; for the base 10 logarithm, use log10.