# Mathematica Sec and Csc

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.

-

## migrated from math.stackexchange.comJul 2 '12 at 9:38

This question came from our site for people studying math at any level and professionals in related fields.

What do you mean by prevent? Why do you think sec csc are old fashioned –  Nunoxic Jul 2 '12 at 9:09
Those functions are no more "old fashioned" than logarithms and cotangents. –  Siminore Jul 2 '12 at 9:12
@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$". –  Day Late Don Jul 2 '12 at 9:17
@Siminore Your statement is not true. At least here in Germany, nowadays nobody will use Sec or Csc. –  user1642 Jul 2 '12 at 10:17

## 2 Answers

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.

-

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])

-
why not close then? –  rm -rf Jul 2 '12 at 13:42
@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. –  Mr.Wizard Jul 2 '12 at 14:07