MathGroup Archive 2005

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

Search the Archive

Re: Simplifying Conjugate[] with 5.2 Mac

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59832] Re: Simplifying Conjugate[] with 5.2 Mac
  • From: "James Gilmore" <james.gilmore at yale.edu>
  • Date: Tue, 23 Aug 2005 04:51:31 -0400 (EDT)
  • Organization: Yale University
  • 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>
  • Sender: owner-wri-mathgroup at wolfram.com

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

------------------------------------------------------
>
>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: with 5.2 Mac
  • Previous by thread: Re: Simplifying Conjugate[] with 5.2 Mac
  • Next by thread: Re: Re: Simplifying Conjugate[] with 5.2 Mac