When I ask Mathematica to do this:

(Sin[2 x] - Tan[2 x])/x^3 /. Tan[x_] -> Sin[x]/Cos[x]

It makes no change because Mathematica interprets Tan[x] as the same thing as Sin[x]/Cos[x]. Is it possible to force Mathematica to rewrite:




I know this has to do with evaluation control but I'm looking at the documentation and am not finding anything that resembles this. At the time, I know I could make this converting everything to string and using string substitutions but I guess this would be kinda cumbersome for my needs.

  • 4
    $\begingroup$ (Sin[2 x] - Tan[2 x])/x^3 /. Tan[x_] -> HoldForm[Sin[x]/Cos[x]] ? $\endgroup$
    – Syed
    Commented Apr 1, 2023 at 2:57
  • $\begingroup$ @Syed This is really nice. I was trying some of these functions (Hold, HoldForm, etc) but wasn't sure where is the right place to apply them. I also found a "cheap" way, which is convert the functions I have like Cos[x] to cos[x], make whatever operations I need on it and then convert it back. $\endgroup$
    – Red Banana
    Commented Apr 1, 2023 at 3:00

1 Answer 1


Update. Duplicate: Replacing Tan[x] with Sin[x]/Cos[x]

Set the system option:

 "SimplificationOptions" -> "AutosimplifyTrigs" -> False];

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