# Setting numerator terms to zero only

I have many expressions of the form $c_1/\epsilon, c_2/\epsilon \dots ,c_n/\epsilon$ where $n$ is a large number and I also have expressions of the form $b_1\epsilon, b_2\epsilon, \dots ,b_m \epsilon$ where $m$ is also very large. $c_i$ and $b_i$ are just $\epsilon$-independent variables or numbers.

I would like to put the terms in which $\epsilon$ appears in the numerator to zero without affecting the terms in which $\epsilon$ appears in the denominator. Is there a way to automate this in Mathematica? Probably the answer is yes and the solution is very simple but I have not found the correct syntax yet.

   expr/.eps->0


gives rise to errors because of producing indeterminate forms, as expected.

Thanks!

• Would something like (Numerator[expr] /. eps -> 0)/Denominator[expr] work? – J. M. will be back soon Oct 27 '17 at 11:46
• (b1 \[Epsilon])/n1 + k1/\[Epsilon] + (b2 \[Epsilon])/n2 + k2/\[Epsilon] /. Power[\[Epsilon], -1] :> 0 ?? – Ali Hashmi Oct 27 '17 at 11:49
• @J.M That gave me a 1/0 error again :/ – CAF Oct 27 '17 at 11:54
• @AliHashmi This works except it gets rid of the denominator terms instead. If I replace -1 with +1 it gives me an error. – CAF Oct 27 '17 at 11:55
• Could you post an example expression, then? It's hard to give a useful suggestion if other people can only guess at what your expressions look like. – J. M. will be back soon Oct 27 '17 at 11:57

expr =
{(256 m2)/(ϵ M (-1 + b x) (1 + b x)), (256 ϵ m1)/(M^3 (-1 + b x) (1 + b x))};

Replace[#,Times[PatternSequence[___, Verbatim[ϵ]]] -> 0, {1}] & /@ expr
(* {(256 m2)/(M (-1 + b x) (1 + b x) ϵ), 0} *)

• I made an edit. since the attribute of Times is Orderless we do not need OrderlessPatternSequence and therefore PatternSequence will suffice – Ali Hashmi Oct 27 '17 at 13:07

It would be nice to obtain a more direct route but the following simple trick gets the job done:

   expr/.{1/eps->x};
%/.{eps->0}
%/.{x->1/eps}


You could use @DanielLichtblau's solution from the comments:

Normal @ Series[{b1 ϵ, b2 ϵ, c1/ϵ, b3 ϵ, c2/ϵ, c3/ϵ}, {ϵ, 0, 0}]


{0, 0, c1/ϵ, 0, c2/ϵ, c3/ϵ}

If the input expression expr only contains terms of the form 1/eps and eps, then you can use Coefficient:

Dot[Coefficient[expr, eps, {-1, 0}], {1/eps, 1}]