from sympy import symbols, integrate, pprint
# Define the symbols
epsilon, x = symbols('epsilon x', real=True)
X = symbols('X', real=True, positive=True)
integ = (1 + epsilon * x)**2 / (1 - x)**2
integ_result = integrate(integ,(x))
pprint(integ_result)
2
2 ε + 2⋅ε + 1
ε ⋅x + 2⋅ε⋅(ε + 1)⋅log(x - 1) - ────────────
x - 1