Is there any way to force Mathematica to not use double and half angle formulae etc. when simplifying Trigonometric expressions?

For example,Simplify[Sin[x]/(1 + Cos[x])] will give us Tan[x/2]. The angle x was changed to x/2.

I don't want the angle to change during simplification. So, Mathematica should not convert x to 2x or 3x or x/2 or x/3 etc.

Can I force Mathematica to simplify an expression under this constraint?


1 Answer 1


You may do the following:

g[e_] := Count[e, x/2, Infinity];
Simplify[Sin[x]/(1 + Cos[x]), ComplexityFunction -> g]

(*  Sin[x]/(1 + Cos[x])  *)

Though in the present case you get the same. However, in a more complex case it can help.

Have fun!

  • $\begingroup$ Hi @Alexei. :) Thank you for the answer. Could you please explain how the above code works? $\endgroup$ Aug 6, 2018 at 15:25
  • $\begingroup$ @iKnowNothing Is there something about ComplexityFunction you don't understand or is it Count? (There are similar examples in the docs.) $\endgroup$
    – Michael E2
    Aug 6, 2018 at 16:06
  • $\begingroup$ I don't understand the first line. :) I understand the first line of the documentation of count. Count[{a, b, a, a, b, c, b}, b] but that does not clarify how the Count in this situation works. $\endgroup$ Aug 6, 2018 at 16:35
  • $\begingroup$ The first line defines a function, g, that will be used instead of the built-in ComplexityFunction applied with Simplify. g takes an expression e and counts the number of times x/2 enters e. Infinity in the third position indicates that this should be counted on all levels of the expression. $\endgroup$ Aug 7, 2018 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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