2
$\begingroup$

I would like to prevent automatic simplification of some trigonometric functions involving complex numbers.

The option AutosimplifyTrigs does the trick with 1/Cos[z], but not with Cos[I z].

1/Cos[z] SetSystemOptions["SimplificationOptions" -> "AutosimplifyTrigs" -> False]; 1/Cos[z] Cos[I z] 

gives

Sec[z] 1/Cos[z] Cosh[z] 

Is there a way to prevent the simplification Cos[I z] -> Cosh[z] ?

$\endgroup$
3
  • $\begingroup$ It depends on your further intentions. You did not describe them and this makes it difficult to answer you. The intentions may be different. Suppose you only need to show a final result of your calculations containing Cos[I z]. Then use HoldForm[Cos[I z]] or Cos[HoldForm[I z]]. Another possibility is that you will make further analytical calculations, but for whatever reason want to keep Cos[I z] as it is. Then use Cos[i z] instead. On the very last stage of your calculations you may replace i by I as follows expression/.i->I. $\endgroup$ Commented Sep 30, 2021 at 12:49
  • $\begingroup$ Continuation: However, in this second case, I would not make tricks, but let Mathematica act in its natural way. One can always replace Cosh[z]->Cos[HoldForm[I z]] (and possibly alike replacements, if needed) after the calculations have been finished. $\endgroup$ Commented Sep 30, 2021 at 12:53
  • $\begingroup$ My intentions are to show the final result, I simply don't like it to be Cosh. The solution Cosh[z]->Cos[HoldForm[I z]] is appropriate, but I find very strange that some simplifications are controlled by "AutosimplifyTrigs" (like 1/Cos[z]) and others are not. Is there any reason for this? $\endgroup$ Commented Oct 3, 2021 at 1:21

1 Answer 1

2
$\begingroup$
Clear["Global'*"]; $Version (* "12.3.1 for Mac OS X x86 (64-bit) (June 19, 2021)" *) 

You can use $Post

$Post = (# /. { Cosh[z_] :> HoldForm[Cos[I z]], Sinh[z_] :> HoldForm[Sin[I z]]/I}) &; SetSystemOptions["SimplificationOptions" -> "AutosimplifyTrigs" -> False]; {1/Cos[z], Cos[I z], Sin[I z]} 

enter image description here

However, ReleaseHold is undone by $Post for these functions unless $Post is cleared first

% // ReleaseHold 

enter image description here

$Post =. %% // ReleaseHold (* {1/Cos[z], Cosh[z], I Sinh[z]} *) SetSystemOptions[ "SimplificationOptions" -> "AutosimplifyTrigs" -> True]; 
$\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.