Function Repository Resource:

# TrigContract

Attempt to express weighted sums of sines and cosines having the same period in terms of cosines alone

Contributed by: Wolfram Staff
 ResourceFunction["TrigContract"][expr] evaluates TrigReduce[expr] and attempts to contract weighted sums of sines and cosines with the same period. ResourceFunction["TrigContract"][expr,var] treats all variables other than var as constants.

## Details and Options

ResourceFunction["TrigContract"] attempts to combine terms of the form aSin[x]+bCos[x] into .
ResourceFunction["TrigContract"] automatically threads over lists in expr.
Given the option "ExpandTrigsOfSum" True, ResourceFunction["TrigContract"] expands the terms in the form of Sin[α+β] and Cos[α+β] into sines and cosines of α and β.
The default "ExpandTrigsOfSum"Automatic employs heuristics to decide whether to expand the sums.

## Examples

### Basic Examples (1)

Combine sums of sines and cosines:

 In[1]:=
 Out[1]=
 In[2]:=
 Out[2]=

### Scope (4)

TrigContract can handle symbolic parameters:

 In[3]:=
 Out[3]=

Treat x as the main variable and y as a constant:

 In[4]:=
 Out[4]=

Treat y as the main variable and x as a constant:

 In[5]:=
 Out[5]=

Here TrigContract picks y as the main variable and treats x as a constant:

 In[6]:=
 Out[6]=

 In[7]:=
 Out[7]=

Use symbolic manipulations to handle trigonometric functions other than sines and cosines:

 In[8]:=
 Out[8]=

### Options (2)

#### ExpandTrigsOfSum (2)

With "ExpandTrigsOfSum"True, TrigContract finds possible contractions for sines and cosines of sums, but may produce relatively more complicated results:

 In[9]:=
 Out[9]=
 In[10]:=
 Out[10]=

Prevent expanding terms in the form (Sin|Cos)[x±y]:

 In[11]:=
 Out[11]=

### Properties and Relations (2)

TrigContract and TrigExpand are, generically, inverses of each other:

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

TrigContract produces a result equivalent to the result of TrigReduce:

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

### Possible Issues (3)

Without specifying the variable, TrigContract may not always fully contract expr that contains symbolic parameters:

 In[17]:=
 Out[17]=

Specify the variable:

 In[18]:=
 Out[18]=

Simplify the terms of the product:

 In[19]:=
 Out[19]=

## Version History

• 1.0.0 – 02 December 2020