So I wanted to replace i with 0 in my equation (pls don't ask why). I tried several options but none of them gave the result I wanted. What should I do?
or use Re[] to get the real part of an expression.
Although you can do
Replace[I + 4, Complex[x_, 1] -> x]
and do what you want.
Regards,
Neil
You can check the full form of an expression
In[1]:= FullForm[4+I] Out[1]//FullForm= Complex[4,1] In[2]:= FullForm[x+I] Out[2]//FullForm= Plus[4,x]
The first case is atomic thus no substitution happens.