Function Repository Resource:

# LogContract

Contracts sums of logarithms into a single logarithm

Contributed by: Carl Woll
 ResourceFunction["LogContract"][expr] contracts sums of Log expressions into a single Log expression.

## Details and Options

ResourceFunction["LogContract"] converts aLog[b] to Log[ba] plus an extra term that depends on the branch cut of Log for the given arguments.
ResourceFunction["LogContract"] converts Log[a]+Log[b] to Log[ab] plus an extra term that depends on the branch cut of Log for the given arguments.
ResourceFunction["LogContract"] automatically threads over lists, as well as equations, inequalities and logic functions.
Products that contain a Log expression are converted into an equivalent Log expression where the factor is included as the exponent.
ResourceFunction["LogContract"] has the option Assumptions, specifying assumptions to use.
The default setting for the Assumptions option is True, corresponding to no assumptions.
With the setting Automatic for the Assumptions option, a maximal set of assumptions is made, disregarding all issues of branches of multivalued functions.

## Examples

### Basic Examples (3)

Reproduce a basic Log identity:

 In[1]:=
 Out[1]=

Find conditions for which Log[a]-Log[b] is equal to Log[a/b]:

 In[2]:=
 Out[2]=

Contract logs, disregarding branch cut issues:

 In[3]:=
 Out[3]=

The result is not generically true:

 In[4]:=
 Out[4]=

### Scope (2)

 In[5]:=
 Out[5]=

LogContract is essentially the inverse of PowerExpand for logarithmic expressions:

 In[6]:=
 Out[6]=

Contracting to the original expression:

 In[7]:=
 Out[7]=

### Options (2)

#### Assumptions (2)

The default option setting for Assumptions is \$Assumptions. By default , meaning that LogContract gives a universally correct result:

 In[8]:=
 Out[8]=

With the setting Automatic, a maximal set of assumptions are used and the output is not generically correct:

 In[9]:=
 Out[9]=

A simpler result is obtained with suitable assumptions:

 In[10]:=
 Out[10]=

Contract logs assuming real arguments:

 In[11]:=
 Out[11]=
 In[12]:=
 Out[12]=
 In[13]:=
 Out[13]=

### Possible Issues (1)

The default option for LogContract is , unlike PowerExpand which uses Automatic as the default:

 In[14]:=
 Out[14]=
 In[15]:=
 Out[15]=

Carl Woll

## Version History

• 1.0.0 – 22 October 2019