# How to use replace for only one term in a long expression in Mathematica?

I am doing some Cauchy integration and in some intermediate steps I have something that looks like that:

(..many_terms...+I*\epsilon(k1-p1))/k1


where \epsilon is very small and positive. For my purpose I am only concerned with the sign in front of the I*\epsilon term. Now my question is: How can I tell Mathematica to substitute the I*\epsilon(k1-p1)/k1 term by -I*\epsilon for k1<p1 and k1>0 .I tried using replace (/.) but it does not do anything. I would very much appreciate any help or insight since this situation shows up many times in what I am currently doing.

• can you make up a MWE ? – Nasser Jul 26 at 9:11
• Have you tried expression //Conjugate //ComplexExpand? This may be mathematically the more honest way to go. – Roman Jul 26 at 9:14
• And you want the substitution on Mathematica code or in $\LaTeX$ code? If in Mathematica, Why is your questions written with $\LaTeX$ code? Please edit your question and clarify. – rhermans Jul 26 at 10:00
• Perhaps Series[expr, {epsilon,, 0, 1}] or rather SeriesCoefficient – Michael E2 Jul 26 at 13:52