0

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:

$$\frac{\sin(2x)-\tan(2x)}{x^3}$$

As:

$$\frac{\sin(2x)-\frac{\sin(x)}{\cos(x)}}{x^3}?$$

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.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
Red Banana
  • 5,329
  • 2
  • 29
  • 47
  • 4
    (Sin[2 x] - Tan[2 x])/x^3 /. Tan[x_] -> HoldForm[Sin[x]/Cos[x]] ? – Syed Apr 01 '23 at 02:57
  • @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. – Red Banana Apr 01 '23 at 03:00

1 Answers1

1

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


Set the system option:

SetSystemOptions[
 "SimplificationOptions" -> "AutosimplifyTrigs" -> False];
Michael E2
  • 235,386
  • 17
  • 334
  • 747