Re: Assisting FullSimplify (last time to bother you with this topic)

• To: mathgroup at smc.vnet.net
• Subject: [mg56179] Re: Assisting FullSimplify (last time to bother you with this topic)
• From: Peter Pein <petsie at arcor.de>
• Date: Mon, 18 Apr 2005 03:08:38 -0400 (EDT)
• References: <d3qht2\$oi2\$1@smc.vnet.net> <d3t3b8\$8k8\$1@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Peter Pein wrote:
> Hugh Goyder wrote:
>
>>I started with the expression e1 below. FullSimplify does not make any
>>progress in making it simpler. By a mixture of working on parts of the
>>expression, luck and physical reasoning I worked out that the expression is
>>the same as that given in e2. (For example I knew the expression should be
>>real). Is there anyway that I could have directed FullSimplify to get from
>>e1 to e2, by for example setting options?
>>
>>(Cutting and pasting the code below into a notebook will make it readable.
>>It may then be evaluated.)
>>
>>Thanks
>>
>>Hugh Goyder
>>
>>
>>
>>e1 = (4*I*
>>E^(I*(a + b)*k)*(-E^(2*I*a*k) +
>>E^(2*I*(1 + ar)*k)))/(E^(2*I*(1 + a + ar)*k)*(-2 + Sr) +
>>E^(2*I*(a + b)*k)*(-2 + Sr) - E^(4*I*a*k)*Sr + E^(2*I*(1 + ar)*k)*Sr +
>>E^(2*I*(2*a + b)*k)*Sr - E^(2*I*(1 + ar + b)*k)*Sr -
>>E^(2*I*a*k)*(2 + Sr) - E^(2*I*(1 + a + ar + b)*k)*(2 + Sr))
>>
>>
>>
>>e2 = -(Sin[(1 - a + ar)*k]/((-Cos[(1 + ar)*k])*Cos[b*k] +
>>Sr*Cos[a*k]*Sin[(1 - a + ar)*k]*Sin[b*k]))
>>
>>FullSimplify[e1]
>>
>>FullSimplify[e1 == e2]
>>
>>LeafCount[e1]
>>
>>LeafCount[e2]
>>
>>
>
> In[6]:=
>    e3a = FullSimplify[ComplexExpand[Re[e1],
>            TargetFunctions -> {Re, Im}]];
>    e3  = FullSimplify[Numerator[e3a]/
>          Collect[TrigExpand[ExpandAll[Denominator[e3a]]],
>            Cos[#1*k]& /@ {a, b}, FullSimplify]]]
> Out[6]=
>   Sin[(1 - a + ar)*k] /
>     ( Cos[(1 + ar)*k]*Cos[b*k] +
>       Sr*Cos[a*k]*Sin[(-1 + a - ar)*k]*Sin[b*k] ) }
>   Simplify[e2 == e3]
>   LeafCount /@ {e1, e2, e3}
> Out[7]=
>   True
> Out[8]=
>   {148, 45, 43}
>
Even shorter (and 70 times faster) is:

e4 = FullSimplify@
Map[Collect[#, Cos[(a | b) k], TrigFactor] &,
Together@TrigExpand@ExpandAll@ExpToTrig@
(e1 /. ar -> br - 1), {2}
] /. br -> ar + 1

which results in

-1/(Cos[(ar + 1)*k]*Cos[b*k]*Csc[(a - ar - 1)*k] +
Sr*Cos[a*k]*Sin[b*k]))

--
Peter Pein
Berlin

```

• Prev by Date: Re: Typesetting Mathematica code
• Next by Date: Bug in UI?