Just try this sample:
I /. HoldPattern@I -> a
(* I *)
Why does it fail to replace I
with a
? I've checked // Hold // FullForm
but found nothing useful.
Answer
@xzczd has always struck me as a very mature person, and this question hasn't really changed that opinion :-)
The answer is because I
evaluates internally as Complex[0,1]
, so
I /. HoldPattern[Complex[0, _]] -> a
would work, or even
I /. HoldPattern[Complex[0, 1]] -> a
and in a more practical example,
FourierTransform[f[tt], tt, I ww] /.
HoldPattern@FourierTransform[a_, t_, Complex[0, 1] w_] :>
myfourier[a, t, J w]
(* myfourier[f[tt], tt, J ww] *)
Comments
Post a Comment