{f[x_] = (E - x)/(E x), g[x_] = (-1 + 2 x^2)/x}
{Reduce[{#[f[x], 0]}, x, Reals] & /@ {Less, Greater},
Reduce[{#[g[x], 0]}, x, Reals] & /@ {Less, Greater}}
The last line of this code separately finds the ranges of x for which the two inequalities are greater than 0 and less than 0; they differ only in the inequality sign. For such code patterns that yield identical results, how can the code be shortened so that a single unified piece of code can simultaneously determine the ranges of x corresponding to “greater than 0” and “less than 0” for both inequalities?
My own attempt goes like this, but it still feels not concise enough—the Less and Greater function calls are repeated, and the two function variables are duplicated.
Reduce[{#1[#2, 0]}, x, Reals] & @@@ {{Less, f[x]}, {Greater,
f[x]}, {Less, g[x]}, {Greater, g[x]}}
