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.
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.
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])
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$
Mar 10, 2015 at 3:10
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
AutosimplifyTrigs
option is ignored by Simplify
and FullSimplify
, which still return Csc
, Cot
, Sec
. Instead, Mr. Wizard solution works in that case too.
$\endgroup$
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.
Print[Csc[x]]
and only this method will print 1/Sin[x]
$\endgroup$