Re: Choosing preferred functions for Trig Simplification?
- To: mathgroup at smc.vnet.net
- Subject: [mg83204] Re: Choosing preferred functions for Trig Simplification?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Thu, 15 Nov 2007 05:31:46 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <fhegov$m8b$1@smc.vnet.net>
AES wrote:
> In Simplifying expressions containing multiple Trig functions, I'd like
> to persuade Mathematica to limit its vocabulary to Sin, Cos and Tan,
> and avoid Sec, Csc and Cot (while continuing to put expressions into the
> simplest Together form, and so on).
>
> Are there simple tricks or Assumptions or options to do this?
You could use the option *ComplexityFunction* and define your own
complexity function that would penalized the usage of the unwanted
trigonometric functions. For instance,
In[1]:= f[e_] := 100 Count[e, _Sec | _Csc | _Cot, {0, Infinity}] +
LeafCount[e]
In[2]:= expr = (TrigExpand[Cot[x + y]] + Sec[y])
Out[2]=
Cos[x] Cos[y] Sin[x] Sin[y]
Sec[y] + ----------------------------- - -----------------------------
Cos[y] Sin[x] + Cos[x] Sin[y] Cos[y] Sin[x] + Cos[x] Sin[y]
In[3]:= Simplify[expr, ComplexityFunction -> #] & /@ {Automatic, f}
LeafCount /@ %
Out[3]=
1
{- Csc[x + y] Sec[y] (Cos[x] + Cos[x + 2 y] + 2 Sin[x + y]),
2
-Sin[x] (-1 + Sin[y]) + Cos[x] (Cos[y] + Tan[y])
------------------------------------------------}
Cos[y] Sin[x] + Cos[x] Sin[y]
Out[4]= {25, 31}
Regards,
--
Jean-Marc