fixed in 10.1 (windows)
I have run into some strange behavior while doing some pattern matching. First, this works as expected:
Exp[2 I u x] /. Exp[Complex[0, a_] u x] :> a
(* 2 *)
However, when I replace x
with Sin[x]
I get:
Exp[2 I u Sin[x]] /. Exp[Complex[0, a_] u Sin[x]] :> a
(* E^(2 I u Sin[x]) *)
Also, dropping the u
returns normal behavior:
Exp[2 I Sin[x]] /. Exp[Complex[0, a_] Sin[x]] :> a
(* 2 *)
I don't have these problems when I'm not using Complex
. This looks like a bug to me, but perhaps I am not understanding how Complex
works. I do notice that Complex
treats numbers and symbols differently:
AtomQ[Complex[0, 2]]
(* True *)
AtomQ[Complex[0, b]]
(* False *)
Any ideas?
BTW - I'm using 10.0.2 on Mac OS X 10.10.2
False
when it should beTrue
:MatchQ[ff[I*u*f[x]], ff[Complex[0,_]*u*f[x]]]
. Changef[x]
tob[x]
in both places and it works correctly. $\endgroup$