|
[Date Index]
[Thread Index]
[Author Index]
Re: Re: Trigonometric simplification
- To: mathgroup at smc.vnet.net
- Subject: [mg68906] Re: [mg68881] Re: Trigonometric simplification
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Wed, 23 Aug 2006 07:15:20 -0400 (EDT)
- References: <ecbnnc$r29$1@smc.vnet.net><ecc2pn$ajl$1@smc.vnet.net> <200608220920.FAA26920@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 22 Aug 2006, at 11:20, carlos at colorado.edu wrote:
>> Hi Carlos,
>>
>> Using TrigReduce before Simplify will do it:
>>
>> r = Tan[a]^2/(Sec[a]^2)^(3/2);
>> Simplify[TrigReduce[r], Assumptions -> {a > 0, Sec[a] > 0}]
>>
>> --> Cos[a]*Sin[a]^2
>>
>> Best regards,
>> Jean-Marc
>
> Thanks, that works perfectly. Actually Sec[a]>0 as assumption
> is sufficient. This is correct from the problem source, since
> the angle is in the range (-Pi/2,Pi/2)
>
> Here is a related question. How can I get Mathematica to pass from
>
> d = 2 + 3*Cos[a] + Cos[3*a] (* leaf count 10 *)
>
> to
>
> 1 + 2*Cos[a]^3 (* leaf count 8 *)
>
> TrigExpand[d] gives
>
> 2 + 3*Cos[a] + Cos[a]^3 - 3*Cos[a]*Sin[a]^2
>
> Applying Simplify to that yields 2 + 3*Cos[a] + Cos[3*a] so we are
> back to the beggining.
>
You seem to be very keen on getting Mathematica to perform some
pretty unorthodox sort of mathematics. Please note:
d = 2 + 3*Cos[a] + Cos[3*a] ;
e=1+2*Cos[a]^3;
d/.a->Pi/2
2
e/.a->Pi/2
1
Actually, the answer you want is double the one you posted, that is
4*Cos[a]^3 + 2. I think the only way to get it is to define a
complexity function which will penalise (with sufficient severity)
multiple angles in "simplified" answers, while also trying to
minimise LeafCount. Here is such one such function:
f[d_] := 10*Plus @@ Cases[{d}, Cos[n_ x_] | Sin[n_ x_] -> n, Infinity]
+LeafCount[d]
For example:
f[d]
40
f[e]
8
With this ComplexityFunction we get:
FullSimplify[d, ComplexityFunction -> f]
4*Cos[a]^3 + 2
The reason why LeafCount alone is insufficient and why you need a
factor such as 10, is that it is not enough that the final output has
a lower value of ComplexityFunction but also all the intermediate
expression that Mathematica tries before arriving at that output.
This makes finding the right function often quite tricky.
Andrzej Kozlowski
Prev by Date:
General--Difficulties in Understanding Mathematica Syntax
Next by Date:
Re: Re: Trigonometric simplification
Previous by thread:
Re: Re: Trigonometric simplification
Next by thread:
Re: Trigonometric simplification
|