MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Simplifying Conjugate[] with 5.2 Mac

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59800] Re: [mg59784] Re: Simplifying Conjugate[] with 5.2 Mac
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 22 Aug 2005 02:48:17 -0400 (EDT)
  • References: <de45i8$qtf$1@smc.vnet.net> <de6m64$ci0$1@smc.vnet.net> <200508210751.DAA26538@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com



On 21 Aug 2005, at 09:51, Steuard Jensen wrote:
>
> Now that's just weird, given that the help for Refine already explains
> that "Refine is one of the transformations tried by Simplify."
>
>
> But unfortunately, it looks like none of this actually solves my
> problem, because _everything_ seems to fail on even slightly more
> complicated expressions:
>
> In[1]:= $Assumptions = {Element[{x, y, w, z}, Reals]};
> ...
> In[6]:= Simplify[Conjugate[(x+I y)(w+I z)],
>                  TransformationFunctions\[Rule]{Automatic,Refine}]
>
> Out[6]= Conjugate[(x+I y) (w+I z)]
>
> In[7]:= FullSimplify[Conjugate[(x+I y)(w+I z)]]
>
> Out[7]= Conjugate[(x+I y) (w+I z)]
>
> In[8]:= Refine[Conjugate[(x+I y)(w+I z)]]
>
> Out[8]= Conjugate[(x+I y) (w+I z)]

Now you are running into a different (though common) problem:


LeafCount[Conjugate[(x + I*y)*(w + I*z)]]


16

=
LeafCount[ComplexExpand[Conjugate[
     (x + I*y)*(w + I*z)]]]

19

So the expanded expression is actually considered to be "more  
complicated" by the default complexity function. If you change the  
complexity function FullSimplify will behave as expected:



FullSimplify[Conjugate[(x + I*y)*
     (w + I*z)], ComplexityFunction ->
    (LeafCount[#1] + 100*Count[#1, Conjugate,
       Infinity, Heads -> True] & )]
r
(x - I*y)*(w - I*z)




I am not actually convinced that the new behaviour of Simplify  
(surely not of FullSimplify) is unintentional. I suspect some  
transformations have been removed form Simplify to improve performance.

If you do not like to use FullSimplify you could try to add  
transformations to Simplify (and also change the complexity function,  
for example to the one used above).

One, perhaps radical, approach might be to add ComplexExpand in the  
following way. First we evaluate your assumptions:

$Assumptions = {Element[{x, y, w, z}, Reals]};

We will use the transformation function:


f[expr_Conjugate] := With[{vars=Cases 
[expr,_Symbol,Infinity]},ComplexExpand[expr,
    Complement[vars,
     Flatten[Cases[$Assumptions,
       (x_) â?? Reals :> (x /.
         Alternatives -> List), {1}]]]]]

f works like this:



f[Conjugate[x + I*y]]


x - I*y


but


f[Conjugate[x + I*p]]


x - Im[p] - I*Re[p]


If you use this f as your additional transformation function you will  
get the simplification you wanted:


Simplify[Conjugate[(x + I*y)*(w + I*z)],
   TransformationFunctions ->
    {Automatic, f}, ComplexityFunction ->
    (LeafCount[#1] + 100*Count[#1,
        Conjugate, Infinity, Heads ->
         True] & )]


(x - I*y)*(w - I*z)


I have not try to test the performance of Simplify with this extra  
transformation function vs. FullSimplify but I expect it to be  
somewhat better.

Andrzej Kozlowski

>
> That last one is the real kicker: it looks like Refine itself can no
> longer handle complicated expressions as of 5.2!  Every one of these
> examples simplifies properly in 5.0.
>
> So what's up with this behavior?  It's hard to imagine that these
> changes in behavior were intentional, so I can only assume that they
> were side effects of some other change in the program.  Anyone have
> any idea what that might have been?  And more to the point, who should
> I talk to if I hope to see it fixed in the future?
>
> In the meantime, I'll keep looking for workarounds for my own purposes
> (maybe I'll try defining Conjugate[expr_Plus]:=Map[Conjugate,expr]
> and similar rules by hand, for instance; that could potentially help,
> though it seems too clumsy to be entirely reliable).  But the
> Mathematica experience has suddenly gotten a lot more painful!
>
>                         Steuard Jensen
>
>


  • Prev by Date: Re: Mathematica and Robotics
  • Next by Date: Re: Simplifying Conjugate[] with 5.2 Mac
  • Previous by thread: Re: Simplifying Conjugate[] with 5.2 Mac
  • Next by thread: Re: with 5.2 Mac