       Re: A Problem with Simplify

• To: mathgroup at smc.vnet.net
• Subject: [mg87513] Re: A Problem with Simplify
• From: Alexey Popkov <popkov at gmail.com>
• Date: Sat, 12 Apr 2008 06:56:28 -0400 (EDT)
• References: <ftkb7f\$a9m\$1@smc.vnet.net> <200804110542.BAA04641@smc.vnet.net>

```On 11 =C1=D0=D2, 14:00, Andrzej Kozlowski <a... at mimuw.edu.pl> wrote:
> On 11 Apr 2008, at 14:42, Alexey Popkov wrote:
>
> > Recently I also have found another strange bug in Simplfy (not so
> > dangerous):
> > FullSimplify[Sin[x]*Cos[x]]
> > gives Sin[x]*Cos[x] instead Sin[2*x]/2. The workaround is
> > FullSimplify[2*Sin[x]*Cos[x]]/2
>
> This is not a bug!
>
> In:= LeafCount[Sin[x]*Cos[x]]
> Out= 5
>
> In:= LeafCount[Sin[2*x]/2]
> Out= 8
>
> In other words, Sin[x] Cos[x] is considered simpler by Simplify than =9A
> Sin[2*x]/2, that's all. Indeed:
>
> In:= Simplify[Sin[2*x]/2]
> Out= Cos[x]*Sin[x]
>
> If you want Simplify to return Sin[2*x]/2 use a different complexity =9A
> functions:
>
> =9A Simplify[Sin[x]*Cos[x], ComplexityFunction ->
> =9A =9A =9A (LeafCount[#1] + 10*Count[#1, _Cos,
> =9A =9A =9A =9A =9A =9A =9A =9AInfinity] & )]
> =9A (1/2)*Sin[2*x]

This is very useful example for me. Thank you. Now it is clear.

```

• Prev by Date: Re: Directory of Mathematica Add-Ons
• Next by Date: Re: what does Method->"HighDimensionalEmbedding" actually do for GraphPlot?
• Previous by thread: Re: Re: A Problem with Simplify
• Next by thread: Re: A Problem with Simplify