Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Attempt to express weighted sums of sines and cosines having the same period in terms of cosines alone
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. |
Combine sums of sines and cosines:
In[1]:= | ![]() |
Out[1]= | ![]() |
In[2]:= | ![]() |
Out[2]= | ![]() |
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]= | ![]() |
TrigContract threads over lists:
In[7]:= | ![]() |
Out[7]= | ![]() |
Use symbolic manipulations to handle trigonometric functions other than sines and cosines:
In[8]:= | ![]() |
Out[8]= | ![]() |
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]= | ![]() |
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]= | ![]() |
This work is licensed under a Creative Commons Attribution 4.0 International License