Re: Trouble computing conjugates
- To: mathgroup at smc.vnet.net
- Subject: [mg88558] Re: Trouble computing conjugates
- From: Szabolcs Horvát <szhorvat at gmail.com>
- Date: Thu, 8 May 2008 04:14:58 -0400 (EDT)
- Organization: University of Bergen
- References: <fvs2k5$enp$1@smc.vnet.net>
Roy wrote:
> I'm having trouble getting mathematica to compute complex conjugates
> of some fairly simple expressions:
>
> If I type the following:
>
> $Assumptions = {g \[Element] Reals, f \[Element] Reals}
> u1 = f + \[ImaginaryI] g
> u2 = f - \[ImaginaryI] g
>
> Then the command:
>
> Refine[Conjugate [c1 u1]]
>
> returns:
>
> f - \[ImaginaryI] g) Conjugate[c1]
>
> and the command:
>
> Refine[Conjugate[c1 u1 + u2]]
>
> returns:
>
> f + \[ImaginaryI] g + (f - \[ImaginaryI] g) Conjugate[c1]
>
> as I would expect. But the command:
>
> Refine[Conjugate[c1 u1 + c2 u2]]
>
> returns:
>
> Conjugate[c2 (f - \[ImaginaryI] g) + c1 (f + \[ImaginaryI] g)]
>
> i.e. it refuses to distribute the complex conjugate throughout the
> expression. What I would like it to tell me is:
>
> (f + \[ImaginaryI] g) Conjugate[c2] + (f - \[ImaginaryI] g)
> Conjugate[c1]
For this particular example, you could manually distribute Conjugate
over the sum:
Refine@Distribute[Conjugate[c1 u1 + c2 u2]]
FunctionExpand works, too:
Conjugate[c1 u1 + c2 u2] // FunctionExpand
>
> The closest I have been able to come to getting what I want is by
> using:
>
> ComplexExpand[Refine[Conjugate[ c1 u1 + c2 u2]], {c1, c2}]
>
> but this separates c1 and c2 into their real and imaginary parts. The
> above expressions are much simpler than the ones I REALLY want
> Mathematica's help in simplifying. If I use this ComplexExpand
> command, then I'm going to have to recombine them into complex numbers
> again, which would be very very bad.
>
I hope that FunctionExpand will work for your more complicated example.
If it doesn't (or it has side effects that you want to avoid), you
could experiment with something like
Refine[ expr /.
HoldPattern@Conjugate@Plus[terms__] :>
Distribute@Conjugate@Plus[terms]
]
The HoldPattern was necessary to prevent Plus[terms__] from evaluating
to terms__