MathGroup Archive 2008

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

Search the Archive

Re: Symbolic complex conjugation?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90007] Re: Symbolic complex conjugation?
  • From: David Bailey <dave at Remove_Thisdbailey.co.uk>
  • Date: Thu, 26 Jun 2008 04:42:51 -0400 (EDT)
  • References: <g3q7vb$aus$1@smc.vnet.net>

AES 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.
> 
Pattern matching is not about doing maths (although it is useful for 
simple variable substitution), but about performing structural 
operations on expressions, as the following examples should illustrate:

In[115]:= Sin[1+a] /. Sin[x_]->Cos[x]
Out[115]= Cos[1+a]

In[118]:= Sin[1+a]/. 1->4
Out[118]= Sin[4+a]

In[119]:= 2I /.I -> -I
Out[119]= 2 I

In[120]:= 1+x+x^2 /. x^2 -> y
Out[120]= 1+x+y

In[121]:= Sin[x]/x /. x->0
Out[121]= Indeterminate

David Bailey
http://www.dbaileyconsultancy.co.uk




  • Prev by Date: Re: How to get the size of Inset in Graphics?
  • Next by Date: Re: Re: simple iteration question-thanks
  • Previous by thread: Re: Symbolic complex conjugation?
  • Next by thread: VectorAngle