I’d like to use the TrigReduce function on a sum of n sinusoids to any power, and am running into an issue with Mathematica’s default ordering of symbols. Is there a way that I can specify an order of f symbols for TrigReduce, such that f1 < f2 < f3 {…}, while keeping notation symbolic?

For example, using numeric values work nicely:

enter image description here

But if symbols are used alone, I want to specify that f2 is the larger value in this example, so instead of f1-f2, TrigReduce would ideally yield the term f2-f1.

enter image description here

For perspective, the end goal is the general formula will output a list pairing each calculated numeric value with its associated symbolic f relationship (with f1 < f2 < f3 < f4, etc), but as it is, TrigReduce's symbol ordering doesn't always work as it doesn't know my preference for ascending values.

Thanks in advance!


It isn't TrigReduce doing this. Mathematica automatically sorts expressions into canonical order. The sort is basically structural/lexical, so knowledge of symbolic inequalities isn't applicable.

  • $\begingroup$ Is there a way to provide symbolic inequalities for functions though? How would I use TrigReduce so it would yield the expression with the desired relationship? $\endgroup$ – TikiTiki Mar 6 '18 at 0:50
  • 1
    $\begingroup$ Forget TrigReduce. It is not the cause of your problem. To see what's happening, type Cos[x]-1. Mathematica will automatically rearrange it. You could Hold your expression and then rearrange it internally, but that's complicated and requires a great deal of Mathematica expertise to do correctly. $\endgroup$ – John Doty Mar 6 '18 at 14:35
  • $\begingroup$ One possibility is to make your output into a List with a substitution like Plus->List. Then sort that. $\endgroup$ – John Doty Mar 6 '18 at 14:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.