Re: Symbolic complex conjugation?
- To: mathgroup at smc.vnet.net
- Subject: [mg89974] Re: Symbolic complex conjugation?
- From: magma <maderri2 at gmail.com>
- Date: Wed, 25 Jun 2008 06:30:01 -0400 (EDT)
- References: <g3q7vb$aus$1@smc.vnet.net>
On Jun 24, 9:32 am, AES <sieg... at stanford.edu> wrote:
> I'm sorry, but I just don't understand why the following test case works
> just fine:
>
> [In copying it, I've substituted "Isymbol" for the \[ImaginaryI] that
> actually appears in the Out[] cells.]
>
> In[202]:= eqna={a+I b==0};
> solna=Solve[eqna,b];
> b=b/.solna[[1]];
> bStar=b/.{I->-I};
> {b, Star}
>
> Out[205]={ -Isymbol a, Isymbol a }
>
> but the actual calculation that prompted the test case doesn't:
>
> In[206]:= eqnp={((dwa/2)+I(w-wa))p-I (kappa/(2 w))dN e==0};
> solnp=Solve[eqnp,p];
> p=p/.solnp[[1]];
> pStar=p/.{I->-I}
>
> Out[208]= { (dN e kappa)/(w (-Isymbol dwa+2 w-2 wa)),
> (dN e kappa)/(w (-Isymbol dwa+2 w-2 wa)) }
>
> And actually, I guess my real concern is not understanding "how it
> happens" -- but more "how it can happen" that Mathematica can do
> something this potentially damaging to some innocent user.
Changing I into -I is not a good idea. Never.
In your p you have -I which is internally Complex[0,-1] as you can see
with
p//FullForm
So your I->-I is never carried out.
In your test case b was I a , so the replacement was carried out.
If you want to Conjugate a complex number p, use Conjugate[p] and then
ComplexExpand, if all your variables are supposed to be Real.
ComplexExpand[Conjugate[p]]
will give you the correct answer.