Re: Replacement rules with I (sqrt(-1)
- To: mathgroup at smc.vnet.net
- Subject: [mg45060] Re: Replacement rules with I (sqrt(-1)
- From: bobhanlon at aol.com (Bob Hanlon)
- Date: Mon, 15 Dec 2003 06:02:54 -0500 (EST)
- References: <brhi2e$jha$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
FullForm /@ (expr={x+I*y, 3+I})
{Plus[x, Times[Complex[0,1],y]], Complex[3,1]}
I//FullForm
Complex[0,1]
There is a Complex[0, 1] to replace in the first expression but not in the
second. When having problems with a replacement rule you should check whether
the FullForm is what you expected. You can use
expr /. Complex[a_, b_] -> Complex[a, -b]
{x - I*y, 3 - I}
or
FullSimplify[Conjugate[expr], Element[{x,y}, Reals]]
{x - I*y, 3 - I}
Bob Hanlon
In article <brhi2e$jha$1 at smc.vnet.net>, Jean-Michel Collard
<jm at france-paris.org> wrote:
<< Can someone explain me this particular behavior :
x+I*y /. I -> -I
x-I y (* ok *)
3+I /. I-> -I
3+I (* ????? false *)