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: [mg59863] Re: [mg59832] Re: Simplifying Conjugate[] with 5.2 Mac
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Wed, 24 Aug 2005 06:30:49 -0400 (EDT)
  • References: <de45i8$qtf$1@smc.vnet.net> <de6maf$cj5$1@smc.vnet.net> <de9cqi$q5a$1@smc.vnet.net> <debt13$9bu$1@smc.vnet.net> <200508230851.EAA03009@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 23 Aug 2005, at 10:51, James Gilmore wrote:

> Hi,
>
>
> Thank you so much! This is a great definition, ConjugateSimple 
> [z_] := z /.
> Complex[a_,b_]->Complex[a,-b]. Significantly better than my wrong hack
> attempt.
>
>
> Does anybody know of any cases where this definition fails to  
> conjugate a
> term, when all variables apart from the I's in the expression, are  
> known to
> be real?
>
> James Gilmore


It won't work even in numerical cases where complex numbers are  
expressed without explicit I  such as Root objects or:


w = Last[x /. Solve[x^5 == 1, x]]


(-1)^(4/5)

In this case


ComplexExpand[Conjugate[(-1)^(4/5)]]

-(-1)^(1/5)

or


FullSimplify[Conjugate[(-1)^(4/5)],
   ComplexityFunction ->
    (LeafCount[#1] + 100*Count[#1, Conjugate, Infinity,
        Heads -> True] & )]

-(-1)^(1/5)

but Complex[a_,b_]->Complex[a,-b] will obviously have no effect.

Andrzej Kozlowski


>
> ------------------------------------------------------
>
>>
>> This definition is too simple:
>>
>>
>
>
>> In[6]:=
>> ConjugateSimple[1+2I]//OutputForm
>> Out[6]//OutputForm=
>> 1 + 2 I
>>
>>
>
>
>> A better definition would use Complex, as in Complex[a_,b_]- 
>> >Complex[a,-b].
>>
>>
>
>
>> [snip]
>>
>>
>
>
>> Carl Woll
>> Wolfram Research
>>
>>
> --------------------------------------------------------
>
> "James Gilmore" <james.gilmore at yale.edu> wrote in message
> news:debt13$9bu$1 at smc.vnet.net...
>
>> "Steuard Jensen" <sbjensen at midway.uchicago.edu> wrote in message
>> news:de9cqi$q5a$1 at smc.vnet.net...
>>
>>> Quoth "James Gilmore" <james.gilmore at yale.edu> in article
>>> <de6maf$cj5$1 at smc.vnet.net>:
>>> [I wrote:]
>>>
>>>>> In[5]:= Simplify[Conjugate[x+I y]]
>>>>>
>>>>> Out[5]= Conjugate[x + I y]
>>>>>
>>>
>>>
>>>> With regard to this behaviour, it may be useful to use PlusMap  
>>>> (or Map
>>>> if
>>>> there are always at least two terms when expanded), see  
>>>> FurtherExamples,
>>>> in
>>>> the Map documentation.
>>>> $Assumptions = {{a, b} \[Element] Reals};
>>>> PlusMap[f_, expr_ /; Head[expr] =!= Plus, ___] := f[expr];
>>>> PlusMap[f_, expr_Plus, r___] := Map[f, expr, r];
>>>> Trace[Simplify[PlusMap[Conjugate, Expand[a + I*b]]]]
>>>> Trace[Simplify[PlusMap[Conjugate, Expand[a + b]]]]
>>>>
>>>
>>> This approach would presumably work in principle (since we've seen
>>> that Simplify can deal with one term at a time).  But in  
>>> practice, my
>>> expressions often involve products and sums of many terms at many
>>> levels.  So I would either need to devise a way to Map Conjugate
>>> properly onto each term by hand (at which point I might as well just
>>> change all the I's to -I's myself!), or come up with an automated  
>>> way
>>> of doing it
>>>
>>
>> Are you just interested in changing I's to -I's? If so, I would  
>> suggest
>> that
>> you forget about Conjugate altogether and use pattern matching  
>> instead.
>> This
>> will give you an efficient method that will not depend on the  
>> internals of
>> Conjugate. You will also not have to deal with changes in future  
>> versions
>> of
>> Mathematica.
>>
>> The other suggestions in this thread are compared to the pattern  
>> matching
>> method below. It is clear pattern matching is the most efficient  
>> for the
>> simple form tested:
>> $ProductInformation
>> {"ProductIDName" -> "Mathematica", "ProductKernelName" ->
>> "Mathematica 5 Kernel", "ProductVersion" ->
>> "5.0 for Microsoft Windows (June 11, 2003)",
>> "ProductVersionNumber" -> 5.}
>> ConjugateSimple[z_] := z /. {I -> -I, -I -> I}
>>
>
>
>


  • Prev by Date: Re: with 5.2 Mac
  • Next by Date: Re: Re: Random sampling of an arbitrary distribution
  • Previous by thread: Re: Simplifying Conjugate[] with 5.2 Mac
  • Next by thread: Re: Re: Simplifying Conjugate[] with 5.2 Mac