1
$\begingroup$

I'm working on a code to display(Print[]) the answers of some excercises for my students. Some of the answers have parts like 1/Cot(x). I want to prevent Mathematica to transform this expression into Tan(x).

I've tried (as a suggestion from another thread)

Simplify[1/Cot[y], Trig -> False] 

But it doesn't work. I can't use Hold[] either because the expression is making reference to a previous calculation and I need to evaluate it. Any tips?? I have Mathematica 11.2 and pardon my english. Thanks!!

$\endgroup$
3
  • $\begingroup$ For some reason when I apply Style to Print it display it as I wanted but I don't understand why. If I have the code Print[1/Cot[y]] It doesn't work, it just display Tan[y] but If I have Print[1/Style[Cot[y], Hue[0.5]]] Then it does display 1/Cot[y] Not sure why this is the case $\endgroup$ Commented Jun 10, 2021 at 0:04
  • $\begingroup$ do not think there is a way. You can do tricks like $PrePrint = # /. {1/Cot[z_] :> 1/Defer@Cot[z]} &; then 1/Cot[y] will remain as is, but then Tan[x] will now will become 1/Cot[x] as well, which is probably not what you want. $\endgroup$ Commented Jun 10, 2021 at 0:35
  • $\begingroup$ Chip's answer in the linked question should do what you want. If it doesn't, edit your question to explain why and we can reopen. $\endgroup$ Commented Jun 10, 2021 at 1:22

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.