3
$\begingroup$

Mathematica often simplifies trigonometric expressions, for example replacing $\sin(\frac{\pi}{4})$ with $\frac{1}{\sqrt{2}}$, or replacing $\cos(\frac{3\pi}{8})$ with $\sin(\frac{\pi}{8})$. I'd like to know how to disable this functionality, leaving everything in the form in which it was entered. Is this possible, and how much granularity is there? Can it all be blanket disabled, or do I have to disable individual relationships? And is there any difference between the first simplification, from a trig function to a real number, and the second, where a trig function is replaced with another? Can I disable one and not the other? etc.

$\endgroup$

1 Answer 1

8
$\begingroup$

You may consider Inactivate:

Inactivate[Sin[Pi/4], Sin] (*Out: Inactive[Sin][Pi/4]*) 

You might also explicitly replace the trig functions with Inactive versions temporarily (this gives you very granular control):

Block[{Sin = Inactive[Sin], Cos = Inactive[Cos]}, {Sin[Pi/4] Cos[3 Pi/8]} ] (* Out: {Cos[(3 Pi)/8] Sin[Pi/4]} *) 

Mathematica graphics

Applying Activate to any expression containing inactive items will give you back the usual behavior.

$\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.