0
$\begingroup$

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.

$\endgroup$
2
  • 4
    $\begingroup$ (Sin[2 x] - Tan[2 x])/x^3 /. Tan[x_] -> HoldForm[Sin[x]/Cos[x]] ? $\endgroup$ 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$ Commented Apr 1, 2023 at 3:00

1 Answer 1

1
$\begingroup$

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


Set the system option:

SetSystemOptions[ "SimplificationOptions" -> "AutosimplifyTrigs" -> False]; 
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.