22
$\begingroup$

How can I prevent Mathematica from using the "old fashioned" functions "Sec" and "Csc"?

In Germany these functions are "old fashioned" as they are not taught anymore at school.

$\endgroup$
  • 1
    $\begingroup$ Those functions are no more "old fashioned" than logarithms and cotangents. $\endgroup$ – Siminore Jul 2 '12 at 9:12
  • 16
    $\begingroup$ @Nunoxic: I don't know about the "old fashioned" bit, but I perhaps Klaus (like myself) would simply prefer seeing expressions like "$\frac{x + y}{\sin x \cos y}$" rather than "$(x+y)\csc x \sec y$". $\endgroup$ – Day Late Don Jul 2 '12 at 9:17
  • 7
    $\begingroup$ @Siminore Your statement is not true. At least here in Germany, nowadays nobody will use Sec or Csc. $\endgroup$ – user1642 Jul 2 '12 at 10:17
  • 1
    $\begingroup$ @Siminore: Csc, Sec are hardly much used in any parts of the world, at any level of school, not only in Germany. In Italy and Switzerland they are not used at all (they where mentioned once in the entire curriculum up to a M.Sc. at the Swiss Federal Institute of Technology, and they where not even taught in the USA when I was there), and hardly anyone uses them in the technics / physics. The reason being: they mostly worsen the readability of complex formula... Even though I know how to handle them, I hate them!! $\endgroup$ – Dieter Ernst Dec 1 '16 at 1:48
  • 2
    $\begingroup$ I want to add my voice to those who do not like Ccs and sec. Whenever I see them I have in my mind convert them to normal sin/cos. I wish Mathematica does not use them either. $\endgroup$ – Nasser Apr 7 '17 at 4:21
26
$\begingroup$

This is similar to my Log question and similar methods can be used.

$PrePrint = # /. {
     Csc[z_] :> 1 / Defer@Sin[z],
     Sec[z_] :> 1 / Defer@Cos[z]
  } &;

Example:

(x + y) Csc[x] Sec[y]
(x + y)/(Cos[y] Sin[x])
| improve this answer | |
$\endgroup$
  • $\begingroup$ why not close then? $\endgroup$ – rm -rf Jul 2 '12 at 13:42
  • $\begingroup$ @R.M well I meant similar in the generic sense. I see this as a closely related but at present different question, and someone may post an answer that goes much deeper than my simple one. Perhaps if that doesn't happen this question can be merged with mine and become a second example. $\endgroup$ – Mr.Wizard Jul 2 '12 at 14:07
  • $\begingroup$ This was useful. Some, like me, will want to extend this to Cot, as follows. $PrePrint = # /. { Csc[z_] :> 1 / Defer@Sin[z], Sec[z_] :> 1 / Defer@Cos[z], Cot[z_] :> Defer@Cos[z] / Defer@Sin[z] } &; $\endgroup$ – Rico Picone Mar 10 '15 at 3:10
8
$\begingroup$

Using the neat trick Chip showed in this answer:

SetSystemOptions["SimplificationOptions" -> "AutosimplifyTrigs" -> False];

TrigFactor[(x + y) Csc[x] Sec[y]]
   (x + y)/(Cos[y] Sin[x])

TrigFactor[Sec[t]^2]
   1/Cos[t]^2
$\endgroup$
6
$\begingroup$

According to this MathGroup post, it's possible to get rid of the superfluous Csc and Sec by doing the following:

Unprotect[Csc, Sec];
Format[Csc[x_]] := HoldForm[1/Sin[x]];
Format[Sec[x_]] := HoldForm[1/Cos[x]];
Protect[Csc, Sec];

That old solution at least gives you the following:

Csc[t]

$\frac{1}{\sin(t)}$

Sec[t]

$\frac{1}{\cos(t)}$

but it still won't be able to print out

$\frac{1}{\cos^2(t)}$

if you type in Sec[t]^2. Instead you get

$\left(\frac{1}{\cos(t)}\right)^2$

But maybe that's OK for your taste. If not, then Mr. Wizard's solution is better because it does put the square in the denominator.

| improve this answer | |
$\endgroup$
  • $\begingroup$ +1, this method is only one that worked for me actually since I was using print[] to print an expression with Csc. For example, Print[Csc[x]] and only this method will print 1/Sin[x] $\endgroup$ – Nasser Apr 7 '17 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.